Community
Participate
Working Groups
When I run this program: public class A { public static void main(String[] args) { System.out.println(new A().foo()); } } aspect Aspect1 { public A A.a; public String A.value; public String A.foo() { return a.value; } } I get the error: Exception in thread "main" java.lang.VerifyError: (class: Aspect1, method: ajc$interMethod$Aspect1$A$foo signature: (LA;)Ljava/lang/String;) Incompatible type for getting or setting field at A.<init>(A.java:1) at A.main(A.java:3) Javap reveals that the field name is missing the class name part: 1: getfield #50; //Field a:LA; 4: getfield #46; //Field A.value:Ljava/lang/String; If I replace a.value by this.a.value, the correct code is generated: 1: getfield #37; //Field A.a:LA; 4: getfield #46; //Field A.value:Ljava/lang/String;
this looks serious. tagging M4 and P1
The bug occurs when the JDT compiler tries to update the codegenBinding for the field in the case that the actual receiver type != the declaring class of the field (to preserve the receiver type in the bytecode, as per 1.4 onwards). With an ITD, the receiver type was set to the Aspect type, and updating the codegenBinding with the aspect as the new declaring type causes the problem. Now looking into the cleanest fix for this in the codebase...
fix now available in latest published build on the download page.