summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/bugs150/pr108050.aj30
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java4
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ajc150.xml10
-rw-r--r--weaver/src/org/aspectj/weaver/JoinPointSignature.java11
-rw-r--r--weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java6
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);
}