summaryrefslogtreecommitdiffstats
path: root/org.aspectj.matcher
diff options
context:
space:
mode:
authoraclement <aclement>2009-05-05 23:41:12 +0000
committeraclement <aclement>2009-05-05 23:41:12 +0000
commitb187712e592887ab56f1a1712de72ebce44ee475 (patch)
tree64b174a6cdd555803d1ca12c7b82d28ff05bf7bf /org.aspectj.matcher
parent262cb6dd7fa047f97b9c76e7425964ae542b147c (diff)
downloadaspectj-b187712e592887ab56f1a1712de72ebce44ee475.tar.gz
aspectj-b187712e592887ab56f1a1712de72ebce44ee475.zip
275032: test and fix: itd of no-arg constructor should overwrite a generated default constructor
Diffstat (limited to 'org.aspectj.matcher')
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/JoinPointSignature.java4
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMember.java2
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMemberImpl.java63
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java10
4 files changed, 43 insertions, 36 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/JoinPointSignature.java b/org.aspectj.matcher/src/org/aspectj/weaver/JoinPointSignature.java
index 8c52005a1..8cc690e77 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/JoinPointSignature.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/JoinPointSignature.java
@@ -397,4 +397,8 @@ public class JoinPointSignature implements ResolvedMember {
public String getSignatureErased() {
return realMember.getSignatureErased();
}
+
+ public boolean isDefaultConstructor() {
+ return realMember.isDefaultConstructor();
+ }
}
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMember.java b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMember.java
index 68ff1878e..84679cce0 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMember.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMember.java
@@ -182,4 +182,6 @@ public interface ResolvedMember extends Member, AnnotatedElement, TypeVariableDe
public ResolvedMember parameterizedWith(Map m, World w);
+ public boolean isDefaultConstructor();
+
} \ No newline at end of file
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMemberImpl.java b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMemberImpl.java
index 71b562d31..66e8e8fb1 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMemberImpl.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMemberImpl.java
@@ -927,40 +927,33 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno
return false;
}
boolean b = false;
- /* if (ignoreGenerics) {
- String myParameterSignature = getParameterSigWithBoundsRemoved();
- String candidateParameterSignature = candidateMatchImpl.getParameterSigWithBoundsRemoved();
- if (myParameterSignature.equals(candidateParameterSignature)) {
- b = true;
- } else {
- myParameterSignature = (hasBackingGenericMember() ? backingGenericMember.getParameterSignatureErased()
- : getParameterSignatureErased());
- candidateParameterSignature = (candidateMatchImpl.hasBackingGenericMember() ? candidateMatchImpl.backingGenericMember
- .getParameterSignatureErased()
- : candidateMatchImpl.getParameterSignatureErased());
- // System.out.println("my psig = " + myParameterSignature);
- // System.out.println("can psig = " + candidateParameterSignature);
- b = myParameterSignature.equals(candidateParameterSignature);
- }
+ /*
+ * if (ignoreGenerics) { String myParameterSignature = getParameterSigWithBoundsRemoved(); String
+ * candidateParameterSignature = candidateMatchImpl.getParameterSigWithBoundsRemoved(); if
+ * (myParameterSignature.equals(candidateParameterSignature)) { b = true; } else { myParameterSignature =
+ * (hasBackingGenericMember() ? backingGenericMember.getParameterSignatureErased() : getParameterSignatureErased());
+ * candidateParameterSignature = (candidateMatchImpl.hasBackingGenericMember() ? candidateMatchImpl.backingGenericMember
+ * .getParameterSignatureErased() : candidateMatchImpl.getParameterSignatureErased()); // System.out.println("my psig = " +
+ * myParameterSignature); // System.out.println("can psig = " + candidateParameterSignature); b =
+ * myParameterSignature.equals(candidateParameterSignature); } } else {
+ */
+ String myParameterSignature = getParameterSigWithBoundsRemoved();
+ String candidateParameterSignature = candidateMatchImpl.getParameterSigWithBoundsRemoved();
+ if (myParameterSignature.equals(candidateParameterSignature)) {
+ b = true;
} else {
-*/
- String myParameterSignature = getParameterSigWithBoundsRemoved();
- String candidateParameterSignature = candidateMatchImpl.getParameterSigWithBoundsRemoved();
- if (myParameterSignature.equals(candidateParameterSignature)) {
- b = true;
- } else {
- // try erasure
- myParameterSignature = getParameterSignatureErased();
- candidateParameterSignature = candidateMatchImpl.getParameterSignatureErased();
- // myParameterSignature = (hasBackingGenericMember() ? backingGenericMember.getParameterSignatureErased()
- // : getParameterSignatureErased());
- // candidateParameterSignature = (candidateMatchImpl.hasBackingGenericMember() ?
- // candidateMatchImpl.backingGenericMember
- // .getParameterSignatureErased() : candidateMatchImpl.getParameterSignatureErased());
- // System.out.println("my psig = " + myParameterSignature);
- // System.out.println("can psig = " + candidateParameterSignature);
- b = myParameterSignature.equals(candidateParameterSignature);
-// }
+ // try erasure
+ myParameterSignature = getParameterSignatureErased();
+ candidateParameterSignature = candidateMatchImpl.getParameterSignatureErased();
+ // myParameterSignature = (hasBackingGenericMember() ? backingGenericMember.getParameterSignatureErased()
+ // : getParameterSignatureErased());
+ // candidateParameterSignature = (candidateMatchImpl.hasBackingGenericMember() ?
+ // candidateMatchImpl.backingGenericMember
+ // .getParameterSignatureErased() : candidateMatchImpl.getParameterSignatureErased());
+ // System.out.println("my psig = " + myParameterSignature);
+ // System.out.println("can psig = " + candidateParameterSignature);
+ b = myParameterSignature.equals(candidateParameterSignature);
+ // }
}
// System.out.println("Checking param signatures: " + b);
return b;
@@ -1182,4 +1175,8 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno
public boolean isEquivalentTo(Object other) {
return this.equals(other);
}
+
+ public boolean isDefaultConstructor() {
+ return false;
+ }
}
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java
index af7523a11..503476ff3 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java
@@ -1609,9 +1609,13 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
}
}
if (!isDuplicateOfPreviousITD) {
- getWorld().getMessageHandler().handleMessage(
- MessageUtil.error(WeaverMessages.format(WeaverMessages.ITD_MEMBER_CONFLICT, munger
- .getAspectType().getName(), existingMember), munger.getSourceLocation()));
+ // b275032 - this is OK if it is the default ctor and that default ctor was generated
+ // at compile time, otherwise we cannot overwrite it
+ if (!(munger.getSignature().getName().equals("<init>") && existingMember.isDefaultConstructor())) {
+ getWorld().getMessageHandler().handleMessage(
+ MessageUtil.error(WeaverMessages.format(WeaverMessages.ITD_MEMBER_CONFLICT, munger
+ .getAspectType().getName(), existingMember), munger.getSourceLocation()));
+ }
}
}
}