]> source.dussan.org Git - aspectj.git/commitdiff
275032: test and fix: itd of no-arg constructor should overwrite a generated default...
authoraclement <aclement>
Tue, 5 May 2009 23:41:12 +0000 (23:41 +0000)
committeraclement <aclement>
Tue, 5 May 2009 23:41:12 +0000 (23:41 +0000)
org.aspectj.matcher/src/org/aspectj/weaver/JoinPointSignature.java
org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMember.java
org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMemberImpl.java
org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java

index 8c52005a12a95ecc15b700bde50a4d368d3cafa7..8cc690e77889aacbd9471750771fb6060ce7e33d 100644 (file)
@@ -397,4 +397,8 @@ public class JoinPointSignature implements ResolvedMember {
        public String getSignatureErased() {
                return realMember.getSignatureErased();
        }
+
+       public boolean isDefaultConstructor() {
+               return realMember.isDefaultConstructor();
+       }
 }
index 68ff1878e8119ed9a04f92694fadddcb710d4b64..84679cce022d56eab1e5c106d27d3e80459ed9c0 100644 (file)
@@ -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
index 71b562d31c715b375a1ca905330710848ae1520b..66e8e8fb1c33c43404512839a7343c6f240378fe 100644 (file)
@@ -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;
+       }
 }
index af7523a11183b423f47788c64adc8f84a606603e..503476ff3aa0236617dba7feb7566f6c9c7a0863 100644 (file)
@@ -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()));
+                                                               }
                                                        }
                                                }
                                        }