public abstract class bug {
protected void kill() {System.out.println("okay");}
protected abstract void init();
public static bug getBug() {return new bug(){protected void init()
{kill();}};}
public static void main(String s[]) { bug.getBug().init(); }
}
$ gcj -C bug.java
$ java bug # => NullPointerException
The above code will produce a null pointer exception because kill()
is not called via "invokevirtual" but referenced through "this", which
is not available in the above context.
--
Summary: gcj creates incorrect (byte-)code
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: java
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jost2345 at users dot sourceforge dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25379