From 0071cb4d0f30fc95f335eb6df73ad09e92d662ed Mon Sep 17 00:00:00 2001 From: acolyer Date: Wed, 14 Jan 2004 15:51:53 +0000 Subject: [PATCH] Fix for 38824. --- .../compiler/problem/AjProblemReporter.java | 26 ++++++++-------- tests/ajcTests.xml | 6 ++++ .../AbstractBaseAndInterTypeInterface.java | 30 +++++++++++++++++++ .../src/org/aspectj/weaver/ResolvedTypeX.java | 10 +++---- 4 files changed, 53 insertions(+), 19 deletions(-) create mode 100644 tests/bugs/AbstractBaseAndInterTypeInterface.java 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 @@ + + + + + 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(); -- 2.39.5