diff options
author | acolyer <acolyer> | 2005-08-26 11:43:32 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-08-26 11:43:32 +0000 |
commit | 27e68f3b3ae82408e8e046a40ab69d9e4996ff5a (patch) | |
tree | 483b14300087f4fd886561dd8d6a9329d098ae8f | |
parent | d9132dc6a4ca244a4404d7a7f4e19d9983309962 (diff) | |
download | aspectj-1_5_0M3a.tar.gz aspectj-1_5_0M3a.zip |
tests for pr108050, signature matching in multiple override scenarioV1_5_0M3a
-rw-r--r-- | tests/bugs150/pr108050.aj | 30 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java | 4 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc150/ajc150.xml | 10 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/JoinPointSignature.java | 11 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java | 6 |
5 files changed, 57 insertions, 4 deletions
diff --git a/tests/bugs150/pr108050.aj b/tests/bugs150/pr108050.aj new file mode 100644 index 000000000..5ad5d25cb --- /dev/null +++ b/tests/bugs150/pr108050.aj @@ -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() + { + } +} + + + + + + diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java index d82a6b9ce..c442b9724 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java @@ -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) { diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index 99182a7e1..3cebcd13d 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -137,7 +137,15 @@ <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"> diff --git a/weaver/src/org/aspectj/weaver/JoinPointSignature.java b/weaver/src/org/aspectj/weaver/JoinPointSignature.java index d4276f9a6..97384c45f 100644 --- a/weaver/src/org/aspectj/weaver/JoinPointSignature.java +++ b/weaver/src/org/aspectj/weaver/JoinPointSignature.java @@ -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()); + } } diff --git a/weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java b/weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java index e9dfa18ad..d94d3db12 100644 --- a/weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java +++ b/weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java @@ -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); } |