import org.aspectj.org.eclipse.jdt.internal.compiler.ast.FieldReference;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.MessageSend;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.SuperReference;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BlockScope;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope;
InterTypeDeclaration dec;
ReferenceBinding onType;
TypeBinding superType;
+ private int depthCounter = 0; // Keeps track of whether we are inside any nested local type declarations
EclipseFactory world;
public InterSuperFixerVisitor(InterTypeDeclaration dec, EclipseFactory world, Scope scope) {
this.dec = dec;
this.onType = dec.onTypeBinding;
this.world = world;
-
// AMC with the java 5 compiler the superclass() of an interface is object,
// not a parent interface (if one exists)
if (onType.isInterface() && onType.superInterfaces().length == 1) {
public void endVisit(MessageSend send, BlockScope scope) {
send.receiver = fixReceiver(send.receiver, scope);
}
+
+
+ public boolean visit(TypeDeclaration localTypeDeclaration, BlockScope scope) {
+ depthCounter++;
+ return super.visit(localTypeDeclaration, scope);
+ }
+
+ public void endVisit(TypeDeclaration localTypeDeclaration,BlockScope scope) {
+ depthCounter--;
+ }
private Expression fixReceiver(Expression expression, BlockScope scope) {
+ if (depthCounter!=0) return expression; // Don't mess with super calls down in nested local type declarations (pr90143)
if (expression instanceof SuperReference) {
SuperReference superRef = (SuperReference) expression;
if (superType == null) {
protected Object method() {
return null;
}
+
}
abstract aspect A {
- interface C2 { }
+ interface C { }
- public void C2.hello() {
+ public void C.hello() {
new MyClass() {
protected Object methodX() {
- return
-//super.
-method();
+ return super.method();
}
};
}
+
+ class C2 { }
- // ok
- class C { }
- public void C.hello() {
+ public void C2.hello() {
new MyClass() {
protected Object methodX() {
return super.method();
}
};
}
-
+
}
return new File("../tests/src/org/aspectj/systemtest/ajc150/ajc150.xml");
}
+ public void testCantCallSuperMethods_pr90143() { runTest("cant call super methods");}
/*
public void testBrokenDispatchByITD_pr72834() { runTest("broken dispatch");}
public void testMissingAccessor_pr73856() { runTest("missing accessor");}
- public void testCantCallSuperMethods_pr90143() { runTest("cant call super methods");}
public void testCunningDeclareParents_pr92311() { runTest("cunning declare parents");}
public void testGenericITDsAndAbstractMethodError_pr102357() { runTest("generic itds and abstract method error");}
public void testITDCtor_pr112783() { runTest("Problem with constructor ITDs");}