]> source.dussan.org Git - aspectj.git/commitdiff
tests and fix for pr147845, generic abstract aspect 3+ deep hierarchies
authoracolyer <acolyer>
Tue, 20 Jun 2006 11:12:49 +0000 (11:12 +0000)
committeracolyer <acolyer>
Tue, 20 Jun 2006 11:12:49 +0000 (11:12 +0000)
tests/bugs152/pr147845/GenericAspectHierarchy.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
weaver/src/org/aspectj/weaver/TypeVariable.java

diff --git a/tests/bugs152/pr147845/GenericAspectHierarchy.aj b/tests/bugs152/pr147845/GenericAspectHierarchy.aj
new file mode 100644 (file)
index 0000000..b9c4831
--- /dev/null
@@ -0,0 +1,30 @@
+interface MyBase { void foo(); };
+interface MyMarker extends MyBase { void bar(); }
+
+abstract aspect Base<A extends MyBase> {
+
+ pointcut somePC() : execution(* A.*(..));
+
+ declare warning : somePC() : "a match";
+
+}
+
+abstract aspect Middle<B extends MyBase> extends Base<B> {}
+
+aspect Sub extends Middle<MyMarker> {}
+         
+         
+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
index 6871867d83082d8cbd8ef5900518583d3dea3be1..f0be4c6eefe6dba46c7e956c401e5bee8b2385e4 100644 (file)
@@ -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);
index 1525089a0a428350198230c12cef56305057fede..d6a132ee5cd31143c1210a3c8757f4160a99647a 100644 (file)
         </stderr>
       </run>
     </ajc-test>
+
+       <ajc-test dir="bugs152/pr147845" title="Generic abstract aspect hierarchy with bounds">
+      <compile files="GenericAspectHierarchy.aj" options="-1.5">
+        <message kind="warning" line="25" text="a match"/>
+        <message kind="warning" line="27" text="a match"/>     
+      </compile>
+    </ajc-test>
     
 </suite>
\ No newline at end of file
index f66b9566112a3d8c5610a0a08bec09d815dd1c6c..13026970a838c7a3e767acfa6b07dd2f551aa2c0 100644 (file)
@@ -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;
                }