Bug 27812 - Classpath AWT Demo: anonymous class call miscompilation
Classpath AWT Demo: anonymous class call miscompilation
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: java
unknown
: P3 normal
: 4.3.0
Assigned To: Not yet assigned to anyone
:
Depends on: 28067
Blocks: 18131
  Show dependency treegraph
 
Reported: 2006-05-29 22:39 UTC by Bryce McKinlay
Modified: 2007-01-09 20:48 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bryce McKinlay 2006-05-29 22:39:50 UTC
GCJ miscompiles part of the classpath AWT demo application in:

classpath/examples/gnu/classpath/examples/awt/Demo.java

In an anonoymous inner class ActionListener implementation, an unqualified call to a superclass of the outer class is called on "this" instead of the outer class.

This happens with either source->native or source->bytecode compilation.

class Super
{
    void dispose()
    {
      System.out.println("OK");
    }
}

public class PR27812
{
  public static void main(String[] args)
  {
    Y y = new Y();
    y.y();
  }

  static interface I
  {
    abstract void actionPerformed();
  }

  static class Y extends Super
  {
    void y()
    {
      new I () {
	  public void actionPerformed () {
	    dispose();
	  }
	}.actionPerformed();
    }
  }
}

$ gcj -C PR27812.java
$ gij PR27812
Exception in thread "main" java.lang.NoSuchMethodError: method PR27812$Y$1.dispose with signature ()V was not found.
   at PR27812$Y$1.actionPerformed (PR27812.java:28)
   at PR27812$Y.y (PR27812.java:30)
   at PR27812.main (PR27812.java:14)
Comment 1 Tom Tromey 2007-01-09 20:48:38 UTC
All gcj front end bugs have been fixed by the gcj-eclipse branch merge.
I'm mass-closing the affected PRs.
If you believe one of these was closed in error, please reopen it
with a note explaining why.
Thanks.