summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2005-11-04 16:26:06 +0000
committeraclement <aclement>2005-11-04 16:26:06 +0000
commit21cf37dd535baf1b9977044ce4f05520538116ba (patch)
tree2408636915b2a65b7c84b439894e51725fe3d8e5
parentb943da4e1ea1e67a684ec23d50668fe28f8abe9c (diff)
downloadaspectj-21cf37dd535baf1b9977044ce4f05520538116ba.tar.gz
aspectj-21cf37dd535baf1b9977044ce4f05520538116ba.zip
Fix for pr90143: I'm on fire today ;)
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterSuperFixerVisitor.java14
-rw-r--r--tests/bugs150/pr90143/A.aj17
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java2
3 files changed, 22 insertions, 11 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterSuperFixerVisitor.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterSuperFixerVisitor.java
index 4b77f70e2..75d265b14 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterSuperFixerVisitor.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterSuperFixerVisitor.java
@@ -22,6 +22,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Expression;
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;
@@ -37,13 +38,13 @@ public class InterSuperFixerVisitor extends ASTVisitor {
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) {
@@ -65,8 +66,19 @@ public class InterSuperFixerVisitor extends ASTVisitor {
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) {
diff --git a/tests/bugs150/pr90143/A.aj b/tests/bugs150/pr90143/A.aj
index c02719275..923eaf12c 100644
--- a/tests/bugs150/pr90143/A.aj
+++ b/tests/bugs150/pr90143/A.aj
@@ -2,32 +2,31 @@ class MyClass {
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();
}
};
}
-
+
}
diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
index daa45d8b3..01344255a 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
@@ -42,10 +42,10 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
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");}