]> source.dussan.org Git - aspectj.git/commitdiff
nasty clone method fix for 83311
authoraclement <aclement>
Mon, 4 Jul 2005 14:55:34 +0000 (14:55 +0000)
committeraclement <aclement>
Mon, 4 Jul 2005 14:55:34 +0000 (14:55 +0000)
weaver/src/org/aspectj/weaver/ResolvedTypeX.java

index 45f1cfd51597164e85f71d077dec544ed27d2b47..803597d5ef54e9c3fb1c5def282e129b5e4f12c7 100644 (file)
@@ -1183,6 +1183,9 @@ public abstract class ResolvedTypeX extends TypeX implements AnnotatedElement {
            return true;
        }
        
+       /**
+        * @return true if the override is legal
+        */
        public boolean checkLegalOverride(ResolvedMember parent, ResolvedMember child) {
                //System.err.println("check: " + child.getDeclaringType() + " overrides " + parent.getDeclaringType());
                if (!parent.getReturnType().equals(child.getReturnType())) {
@@ -1246,6 +1249,12 @@ public abstract class ResolvedTypeX extends TypeX implements AnnotatedElement {
        private int compareMemberPrecedence(ResolvedMember m1, ResolvedMember m2) {
                //if (!m1.getReturnType().equals(m2.getReturnType())) return 0;
                
+               // need to allow for the special case of 'clone' - which is like abstract but is
+               // not marked abstract.  The code below this next line seems to make assumptions
+               // about what will have gotten through the compiler based on the normal
+               // java rules.  clone goes against these...
+               if (m2.isProtected() && m2.isNative() && m2.getName().equals("clone")) return +1;
+               
                if (Modifier.isAbstract(m1.getModifiers())) return -1;
                if (Modifier.isAbstract(m2.getModifiers())) return +1;