]> source.dussan.org Git - aspectj.git/commitdiff
tests for pr108050, signature matching in multiple override scenario V1_5_0M3a
authoracolyer <acolyer>
Fri, 26 Aug 2005 11:43:32 +0000 (11:43 +0000)
committeracolyer <acolyer>
Fri, 26 Aug 2005 11:43:32 +0000 (11:43 +0000)
tests/bugs150/pr108050.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
weaver/src/org/aspectj/weaver/JoinPointSignature.java
weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java

diff --git a/tests/bugs150/pr108050.aj b/tests/bugs150/pr108050.aj
new file mode 100644 (file)
index 0000000..5ad5d25
--- /dev/null
@@ -0,0 +1,30 @@
+class HttpServlet {
+    protected void doPost() {
+    }    
+}
+
+abstract class MockServlet extends HttpServlet {
+    protected void doPost() {
+    }
+    
+    private static aspect FindMatches {
+         declare warning: execution(* HttpServlet.do*(..)): "servlet request";
+    }
+}
+
+class MockDelayingServlet extends MockServlet {
+    private static final long serialVersionUID = 1; 
+}
+
+class MockServlet4 extends MockDelayingServlet 
+{
+    protected void doPost()
+    {
+    } 
+}
+
+
+
+
+
+
index d82a6b9ce991dea171214e2dc8cc8835259a0f1f..c442b9724926e5c438ffb7d14bcff91abc973298 100644 (file)
@@ -286,6 +286,10 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
          runTest("multiple anonymous inner classes 2");
   }
   
+  public void testSignatureMatchingInMultipleOverrideScenario() {
+         runTest("signature matching in override scenario");
+  }
+  
   // helper methods.....
   
   public SyntheticRepository createRepos(File cpentry) {
index 99182a7e16b24da080d7f580347d49f34c0d7e4f..3cebcd13d0602a74b9e1c0323064f98d7d815d3c 100644 (file)
         <compile files="pr108104.aj" options="-1.5">
         </compile>
     </ajc-test>
-       
+
+    <ajc-test dir="bugs150" pr="108050" title="signature matching in override scenario">
+        <compile files="pr108050.aj" options="-1.5">
+            <message kind="warning" line = "2" text="servlet request"></message>
+            <message kind="warning" line = "7" text="servlet request"></message>
+            <message kind="warning" line = "21" text="servlet request"></message>
+        </compile>
+    </ajc-test>
+           
     <ajc-test dir="bugs150/pr106130" pr="106130" title="test weaving with > 256 locals">
         <compile files="AroundLotsOfVars.java LotsOfVars.java" options="-preserveAllLocals"/>
         <run class="LotsOfVars">
index d4276f9a6631783ed4c6118c21209ac2607fda8d..97384c45ff4479b0176c68dae8744119d073e891 100644 (file)
@@ -371,4 +371,15 @@ public class JoinPointSignature implements ResolvedMember {
                realMember.resetReturnTypeToObjectArray();
        }
 
+       public boolean equals(Object obj) {
+               if (! (obj instanceof JoinPointSignature)) return false;
+               JoinPointSignature other = (JoinPointSignature) obj;
+               if (!realMember.equals(other.realMember)) return false;
+               if (!substituteDeclaringType.equals(other.substituteDeclaringType)) return false;
+               return true;
+       }
+       
+       public int hashCode() {
+               return 17 + (37 * realMember.hashCode()) + (37 * substituteDeclaringType.hashCode());
+       }
 }
index e9dfa18ad86a65ea0e869a0b05aeac50b21d4a08..d94d3db1268e4092819e119ab08430aeefa2af43 100644 (file)
@@ -151,7 +151,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno
        accumulateTypesInBetween(originalDeclaringType, 
                                                         firstDefiningType,
                                                         declaringTypes);
-       List memberSignatures = new ArrayList();
+       Set memberSignatures = new HashSet();
        for (Iterator iter = declaringTypes.iterator(); iter.hasNext();) {
                        ResolvedType declaringType = (ResolvedType) iter.next();
                        ResolvedMember member = firstDefiningMember.withSubstituteDeclaringType(declaringType);
@@ -204,7 +204,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno
                ResolvedMemberImpl memberToMatch,
                Iterator typesToLookIn,
                List typesAlreadyVisited,
-               List foundMembers) {
+               Set foundMembers) {
        while(typesToLookIn.hasNext()) {
                ResolvedType toLookIn = (ResolvedType) typesToLookIn.next();
                        if (!typesAlreadyVisited.contains(toLookIn)) {
@@ -217,7 +217,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno
                                        accumulateTypesInBetween(toLookIn, resolvedDeclaringType, declaringTypes);
                                        for (Iterator iter = declaringTypes.iterator(); iter.hasNext();) {
                                                ResolvedType declaringType = (ResolvedType) iter.next();
-                                               typesAlreadyVisited.add(declaringType);
+//                                             typesAlreadyVisited.add(declaringType);
                                                ResolvedMember member = foundMember.withSubstituteDeclaringType(declaringType);
                                                foundMembers.add(member);
                                        }