diff options
4 files changed, 53 insertions, 19 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java index 45db5b357..45ee2e081 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java @@ -144,21 +144,19 @@ public class AjProblemReporter extends ProblemReporter { // if we implemented this method by an inter-type declaration, then there is no error //??? be sure this is always right ResolvedTypeX onTypeX = factory.fromEclipse(type); //abstractMethod.declaringClass); - for (Iterator i = onTypeX.getInterTypeMungers().iterator(); i.hasNext(); ) { + for (Iterator i = onTypeX.getInterTypeMungersIncludingSupers().iterator(); i.hasNext(); ) { ConcreteTypeMunger m = (ConcreteTypeMunger)i.next(); - if (m.matches(onTypeX)) { - ResolvedMember sig = m.getSignature(); - if (!Modifier.isAbstract(sig.getModifiers())) { - if (ResolvedTypeX - .matches( - AjcMemberMaker.interMethod( - sig, - m.getAspectType(), - sig.getDeclaringType().isInterface( - factory.getWorld())), - EclipseFactory.makeResolvedMember(abstractMethod))) { - return; - } + ResolvedMember sig = m.getSignature(); + if (!Modifier.isAbstract(sig.getModifiers())) { + if (ResolvedTypeX + .matches( + AjcMemberMaker.interMethod( + sig, + m.getAspectType(), + sig.getDeclaringType().isInterface( + factory.getWorld())), + EclipseFactory.makeResolvedMember(abstractMethod))) { + return; } } } diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index e07ae9507..b7a030283 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -7105,5 +7105,11 @@ </compile> <run class="ErroneousExceptionConversion1"/> </ajc-test> + + <ajc-test dir="bugs" pr="38824" + title="Anomalous handling of inter-type declarations to abstract base classes in aspectj 1.1"> + <compile files="AbstractBaseAndInterTypeInterface.java"> + </compile> + </ajc-test> </suite> diff --git a/tests/bugs/AbstractBaseAndInterTypeInterface.java b/tests/bugs/AbstractBaseAndInterTypeInterface.java new file mode 100644 index 000000000..7a70f9aae --- /dev/null +++ b/tests/bugs/AbstractBaseAndInterTypeInterface.java @@ -0,0 +1,30 @@ +// pr 38824 + + +public class AbstractBaseAndInterTypeInterface { + + interface I + { + public void foo(); + } + + /*abstract*/ class A implements I + { + } + + class B extends A + { + } + + private static aspect Test + { + protected interface ITest {}; + + declare parents: A implements ITest; + + public void ITest.foo() + { + System.out.println("Hi"); + } + } +}
\ No newline at end of file diff --git a/weaver/src/org/aspectj/weaver/ResolvedTypeX.java b/weaver/src/org/aspectj/weaver/ResolvedTypeX.java index 58b88dbca..81327819e 100644 --- a/weaver/src/org/aspectj/weaver/ResolvedTypeX.java +++ b/weaver/src/org/aspectj/weaver/ResolvedTypeX.java @@ -930,17 +930,17 @@ public abstract class ResolvedTypeX extends TypeX { return interTypeMungers; } - private List getInterTypeMungersIncludingSupers() { + /** + * ??? This method is O(N*M) where N = number of methods and M is number of + * inter-type declarations in my super + */ + public List getInterTypeMungersIncludingSupers() { ArrayList ret = new ArrayList(); collectInterTypeMungers(ret); return ret; } - /** - * ??? This method is O(N*M) where N = number of methods and M is number of - * inter-type declarations in my super - */ private void collectInterTypeMungers(List collector) { for (Iterator iter = getDirectSupertypes(); iter.hasNext();) { ResolvedTypeX superType = (ResolvedTypeX) iter.next(); |