Bug 198196 - super call in nested anonymous classes in itd's causes VerifyError or IncompatibleClassChangeError
Summary: super call in nested anonymous classes in itd's causes VerifyError or Incompa...
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P2 normal (vote)
Target Milestone: 1.6.1   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-28 21:12 EDT by Vincenz Braun CLA
Modified: 2008-06-16 23:11 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vincenz Braun CLA 2007-07-28 21:12:59 EDT
It may be a duplicate of 134425. But the setting is not that similar.
Take this example:

public interface Marker {

	String toString();
}

public class Foo {
	
	public static void main(String[] args) {
		System.err.println(new Foo().toString());
	}
}

public aspect MarkerAspect  {

	declare parents: Foo implements Marker;

	public String Marker.toString() {
		new Runnable() {
			public void run() {
				Marker.super.toString();
			}
		}.run();
		return super.toString();
	}
}

You will get an:
Exception in thread "main" java.lang.IncompatibleClassChangeError
	at test.MarkerAspect$1.run(MarkerAspect.aj:10)
	at test.MarkerAspect.ajc$interMethod$test_MarkerAspect$test_Marker$toString(MarkerAspect.aj:12)
	at test.Foo.toString(Foo.java:1)
	at test.Foo.main(Foo.java:6)

Slightly changing MarkerAspect:
public aspect MarkerAspect  {

	declare parents: Foo implements Marker;

	public String Foo.toString() {
		new Runnable() {
			public void run() {
				Foo.super.toString();
			}
		}.run();
		return super.toString();
	}
}	
And you will get:
Exception in thread "main" java.lang.VerifyError: (class: test/MarkerAspect$1, method: run signature: ()V) Incompatible object argument for function call
	at test.MarkerAspect.ajc$interMethod$test_MarkerAspect$test_Foo$toString(MarkerAspect.aj:8)
	at test.Foo.toString(Foo.java:1)
	at test.MarkerAspect.ajc$interMethodDispatch1$test_MarkerAspect$test_Foo$toString(MarkerAspect.aj)
	at test.Foo.main(Foo.java:6)
Comment 1 Eclipse Webmaster CLA 2007-07-29 09:23:32 EDT
Changing OS from Mac OS to Mac OS X as per bug 185991
Comment 2 Andrew Clement CLA 2007-10-26 08:19:10 EDT
investigate in 1.5.4 timeframe
Comment 3 Andrew Clement CLA 2008-06-16 23:11:32 EDT
Fixed.  The cases here now work. 

The necessary accessors were created in the right places (luckily) but I just had to convince the compiler to modify the Ast appropriately at the super references.  For the <Class>.super references I had to port the fix across for fixing intertype declaration superfixervisitor into the superfixervisitor.  For the  <Interface>.super reference I had to ensure the right instance is used and the super call dispatch method we already generated (on the target interface and implementations) was called.  I'm not 100% sure about the <Interface> case and would like to see how it gets used now I've implemented it.

fixes in next dev build.