From 791f8a7c3f37d9b10b8ad1692df998733bbc2f20 Mon Sep 17 00:00:00 2001 From: acolyer Date: Tue, 20 Jun 2006 11:12:49 +0000 Subject: [PATCH] tests and fix for pr147845, generic abstract aspect 3+ deep hierarchies --- .../pr147845/GenericAspectHierarchy.aj | 30 +++++++++++++++++++ .../systemtest/ajc152/Ajc152Tests.java | 1 + .../org/aspectj/systemtest/ajc152/ajc152.xml | 7 +++++ .../src/org/aspectj/weaver/TypeVariable.java | 13 ++++---- 4 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 tests/bugs152/pr147845/GenericAspectHierarchy.aj diff --git a/tests/bugs152/pr147845/GenericAspectHierarchy.aj b/tests/bugs152/pr147845/GenericAspectHierarchy.aj new file mode 100644 index 000000000..b9c483105 --- /dev/null +++ b/tests/bugs152/pr147845/GenericAspectHierarchy.aj @@ -0,0 +1,30 @@ +interface MyBase { void foo(); }; +interface MyMarker extends MyBase { void bar(); } + +abstract aspect Base { + + pointcut somePC() : execution(* A.*(..)); + + declare warning : somePC() : "a match"; + +} + +abstract aspect Middle extends Base {} + +aspect Sub extends Middle {} + + +class C1 implements MyBase { + + public void foo() {} + +} + +class C2 implements MyMarker { + + public void foo() {} // CW L 25 + + public void bar() {} // CW L 27 + + +} \ No newline at end of file diff --git a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java index 6871867d8..f0be4c6ee 100644 --- a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java @@ -97,6 +97,7 @@ public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase { public void testDoubleAnnotationMatching_pr138223() { runTest("Double at annotation matching (no binding)");} public void testSuperCallsInAtAspectJAdvice_pr139749() { runTest("Super calls in @AspectJ advice");} public void testNoClassCastExceptionWithPerThis_pr138286() { runTest("No ClassCastException with perThis");} + public void testGenericAspectHierarchyWithBounds_pr147845() { runTest("Generic abstract aspect hierarchy with bounds"); } public void testDeclareAtMethodRelationship_pr143924() { //AsmManager.setReporting("c:/debug.txt",true,true,true,true); diff --git a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml index 1525089a0..d6a132ee5 100644 --- a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml +++ b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml @@ -712,5 +712,12 @@ + + + + + + + \ No newline at end of file diff --git a/weaver/src/org/aspectj/weaver/TypeVariable.java b/weaver/src/org/aspectj/weaver/TypeVariable.java index f66b95661..13026970a 100644 --- a/weaver/src/org/aspectj/weaver/TypeVariable.java +++ b/weaver/src/org/aspectj/weaver/TypeVariable.java @@ -219,23 +219,24 @@ public class TypeVariable { if (tvrt.hasLowerBound() != (getLowerBound() != null)) return false; if (tvrt.hasLowerBound() && tvrt.getLowerBound() != getLowerBound()) return false; // either we both have bounds, or neither of us have bounds - if ((tvrt.additionalInterfaceBounds != null) != (additionalInterfaceBounds != null)) return false; + ReferenceType[] tvrtBounds = tvrt.getAdditionalBounds(); + if ((tvrtBounds != null) != (additionalInterfaceBounds != null)) return false; if (additionalInterfaceBounds != null) { // we both have bounds, compare - if (tvrt.additionalInterfaceBounds.length != additionalInterfaceBounds.length) return false; + if (tvrtBounds.length != additionalInterfaceBounds.length) return false; Set aAndNotB = new HashSet(); Set bAndNotA = new HashSet(); for (int i = 0; i < additionalInterfaceBounds.length; i++) { aAndNotB.add(additionalInterfaceBounds[i]); } - for (int i = 0; i < tvrt.additionalInterfaceBounds.length; i++) { - bAndNotA.add(tvrt.additionalInterfaceBounds[i]); + for (int i = 0; i < tvrtBounds.length; i++) { + bAndNotA.add(tvrtBounds[i]); } for (int i = 0; i < additionalInterfaceBounds.length; i++) { bAndNotA.remove(additionalInterfaceBounds[i]); } - for (int i = 0; i < tvrt.additionalInterfaceBounds.length; i++) { - aAndNotB.remove(tvrt.additionalInterfaceBounds[i]); + for (int i = 0; i < tvrtBounds.length; i++) { + aAndNotB.remove(tvrtBounds[i]); } if (! (aAndNotB.isEmpty() && bAndNotA.isEmpty()) ) return false; } -- 2.39.5