fix for Bugzilla Bug 61572

ITDs on inner classes should be static contexts
This commit is contained in:
acolyer 2004-08-10 16:26:24 +00:00
parent b75cd93e0d
commit c5d8476b23
3 changed files with 44 additions and 0 deletions

44
tests/bugs/PR61572.aj Normal file
View File

@ -0,0 +1,44 @@
/* intertype method declarations should be a static context;
it is incorrect to refer to instance variables of the
originating aspect. ajc fails to check this properly when
an ITD method is applied to an inner class.
The example below compiles fine, but then throws
java.lang.NoSuchFieldError: zzz
when run.
*/
aspect NewFoo {
int zzz = 3;
public void Aaa.Ccc.bar() {
System.out.println(zzz); // CE L19: illegal reference to zzz
}
}
class Aaa {
public class Ccc {
}
public Ccc ccc;
public Aaa() {
ccc = new Ccc();
}
}
class IllegalRef {
public static void main(String[] args) {
Aaa aaa = new Aaa();
aaa.ccc.bar();
}
}