Bug 2491 - Calling virtual method from anon class gets segv
Summary: Calling virtual method from anon class gets segv
Status: RESOLVED FIXED
Alias: None
Product: frysk
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Andrew Cagney
URL:
Keywords:
Depends on:
Blocks: 1839
  Show dependency treegraph
 
Reported: 2006-03-26 05:55 UTC by Andrew Cagney
Modified: 2006-03-26 05:57 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Cagney 2006-03-26 05:55:17 UTC
1  public abstract class Anon
     2  {
     3      static void staticCallee () {
     4          System.out.println ("staticCallee");
     5      }
     6      void callee () {
     7          System.out.println ("callee");
     8      }
     9      abstract void caller ();
    10      public static void main (String[] argv)
    11      {
    12          Anon a = new Anon () {
    13                  void caller () {
    14                      staticCallee ();
    15                      callee ();
    16                  }
    17              };
    18          a.caller ();
    19      }
    20  }

cagney@localhost$ gcj -g --main=Anon Anon.java
cagney@localhost$ ./a.out
staticCallee
Exception in thread "main" java.lang.NullPointerException
   at Anon$1.caller()
(/home/scratch/frysk/frysk/frysk-imports/tests/anoncall/Anon.java:15)
   at Anon.main(java.lang.String[])
(/home/scratch/frysk/frysk/frysk-imports/tests/anoncall/Anon.java:18)
   at gnu.java.lang.MainThread.call_main() (/usr/lib/libgcj.so.6.0.0)
   at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0)

cagney@localhost$ ecj Anon.java
cagney@localhost$ gij Anon
staticCallee
callee

rumor has it that this is fixed in CVS head.
Comment 1 Andrew Cagney 2006-03-26 05:57:56 UTC
Red Hat bug.
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=167342