From: aclement Date: Mon, 4 Jul 2005 14:55:34 +0000 (+0000) Subject: nasty clone method fix for 83311 X-Git-Tag: PRE_ANDY~98 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d76026cf7973dfc92751a65e7b08a8d29a074e1f;p=aspectj.git nasty clone method fix for 83311 --- diff --git a/weaver/src/org/aspectj/weaver/ResolvedTypeX.java b/weaver/src/org/aspectj/weaver/ResolvedTypeX.java index 45f1cfd51..803597d5e 100644 --- a/weaver/src/org/aspectj/weaver/ResolvedTypeX.java +++ b/weaver/src/org/aspectj/weaver/ResolvedTypeX.java @@ -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;