From: aclement Date: Mon, 14 Sep 2009 17:58:55 +0000 (+0000) Subject: refactoring X-Git-Tag: V1_6_6~52 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4da4379d79ef1dc70a4b5ba7595a07ce187b8f33;p=aspectj.git refactoring --- diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/Iterators.java b/org.aspectj.matcher/src/org/aspectj/weaver/Iterators.java index 1e5e6e6f5..1afc4a564 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/Iterators.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/Iterators.java @@ -28,36 +28,38 @@ public final class Iterators { /** * A getter represents a mapping function from Object to Iterator */ - public interface Getter { - Iterator get(Object target); + public interface Getter { + Iterator get(A target); } /** * A filter represents a mapping function from Iterator to Iterator */ - public interface Filter { - Iterator filter(Iterator in); + public interface Filter { + Iterator filter(Iterator in); } /** * Create a new filter F that, when wrapped around another iterator I, creates a new iterator I' that will return only those * values of I that have not yet been returned by I', discarding duplicates. */ - public static Filter dupFilter() { - return new Filter() { - final Set seen = new HashSet(); // should have weak ptrs? + public static Filter dupFilter() { + return new Filter() { + final Set seen = new HashSet(); // should have weak ptrs? - public Iterator filter(final Iterator in) { - return new Iterator() { + public Iterator filter(final Iterator in) { + return new Iterator() { boolean fresh = false; - Object peek; + T peek; public boolean hasNext() { - if (fresh) + if (fresh) { return true; + } while (true) { - if (!in.hasNext()) + if (!in.hasNext()) { return false; + } peek = in.next(); if (!seen.contains(peek)) { return fresh = true; @@ -67,10 +69,11 @@ public final class Iterators { } } - public Object next() { + public T next() { if (!hasNext()) throw new NoSuchElementException(); - Object ret = peek; + T ret = peek; + seen.add(peek); peek = null; fresh = false; return ret; @@ -89,8 +92,8 @@ public final class Iterators { * all that pesky safety. */ - public static Iterator array(final Object[] o) { - return new Iterator() { + public static Iterator array(final T[] o) { + return new Iterator() { int i = 0; int len = (o == null) ? 0 : o.length; @@ -98,7 +101,7 @@ public final class Iterators { return i < len; } - public Object next() { + public T next() { if (i < len) { return o[i++]; } else { @@ -115,18 +118,18 @@ public final class Iterators { /** * creates an iterator I based on a base iterator A and a getter G. I returns, in order, forall (i in I), G(i). */ - public static Iterator mapOver(final Iterator a, final Getter g) { - return new Iterator() { - Iterator delegate = new Iterator() { + public static Iterator mapOver(final Iterator a, final Getter g) { + return new Iterator() { + Iterator delegate = new Iterator() { public boolean hasNext() { if (!a.hasNext()) return false; - Object o = a.next(); + A o = a.next(); delegate = append1(g.get(o), this); return delegate.hasNext(); } - public Object next() { + public B next() { if (!hasNext()) throw new UnsupportedOperationException(); return delegate.next(); @@ -141,7 +144,7 @@ public final class Iterators { return delegate.hasNext(); } - public Object next() { + public B next() { return delegate.next(); } @@ -155,16 +158,16 @@ public final class Iterators { * creates an iterator I based on a base iterator A and a getter G. I returns, in order, forall (i in I) i :: forall (i' in * g(i)) recur(i', g) */ - public static Iterator recur(final Object a, final Getter g) { - return new Iterator() { - Iterator delegate = one(a); + public static Iterator recur(final A a, final Getter g) { + return new Iterator() { + Iterator delegate = one(a); public boolean hasNext() { return delegate.hasNext(); } - public Object next() { - Object next = delegate.next(); + public A next() { + A next = delegate.next(); delegate = append(g.get(next), delegate); return next; } @@ -179,7 +182,7 @@ public final class Iterators { * creates an iterator I based on base iterators A and B. Returns the elements returned by A followed by those returned by B. If * B is empty, simply returns A, and if A is empty, simply returns B. Do NOT USE if b.hasNext() is not idempotent. */ - public static Iterator append(final Iterator a, final Iterator b) { + public static Iterator append(final Iterator a, final Iterator b) { if (!b.hasNext()) return a; return append1(a, b); @@ -189,15 +192,15 @@ public final class Iterators { * creates an iterator I based on base iterators A and B. Returns the elements returned by A followed by those returned by B. If * A is empty, simply returns B. Guaranteed not to call B.hasNext() until A is empty. */ - public static Iterator append1(final Iterator a, final Iterator b) { + public static Iterator append1(final Iterator a, final Iterator b) { if (!a.hasNext()) return b; - return new Iterator() { + return new Iterator() { public boolean hasNext() { return a.hasNext() || b.hasNext(); } - public Object next() { + public T next() { if (a.hasNext()) return a.next(); if (b.hasNext()) @@ -214,20 +217,20 @@ public final class Iterators { /** * creates an iterator I based on a base iterator A and an object O. Returns the elements returned by A, followed by O. */ - public static Iterator snoc(final Iterator first, final Object last) { - return new Iterator() { - Object last1 = last; + public static Iterator snoc(final Iterator first, final T last) { + return new Iterator() { + T last1 = last; public boolean hasNext() { return first.hasNext() || last1 != null; } - public Object next() { + public T next() { if (first.hasNext()) return first.next(); else if (last1 == null) throw new NoSuchElementException(); - Object ret = last1; + T ret = last1; last1 = null; return ret; } @@ -241,17 +244,18 @@ public final class Iterators { /** * creates an iterator I based on an object O. Returns O, once. */ - public static Iterator one(final Object it) { - return new Iterator() { + public static Iterator one(final T it) { + return new Iterator() { boolean avail = true; public boolean hasNext() { return avail; } - public Object next() { - if (!avail) + public T next() { + if (!avail) { throw new NoSuchElementException(); + } avail = false; return it; } diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/JoinPointSignature.java b/org.aspectj.matcher/src/org/aspectj/weaver/JoinPointSignature.java index 8cc690e77..19cc2d5cd 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/JoinPointSignature.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/JoinPointSignature.java @@ -91,7 +91,7 @@ public class JoinPointSignature implements ResolvedMember { return realMember.getAnnotationOfType(ofType); } - public void setAnnotationTypes(UnresolvedType[] annotationtypes) { + public void setAnnotationTypes(ResolvedType[] annotationtypes) { realMember.setAnnotationTypes(annotationtypes); } @@ -309,6 +309,7 @@ public class JoinPointSignature implements ResolvedMember { return realMember.getJoinPointSignatures(world); } + @Override public String toString() { StringBuffer buf = new StringBuffer(); buf.append(getReturnType().getName()); @@ -355,6 +356,7 @@ public class JoinPointSignature implements ResolvedMember { realMember.resetReturnTypeToObjectArray(); } + @Override public boolean equals(Object obj) { if (!(obj instanceof JoinPointSignature)) return false; @@ -366,6 +368,7 @@ public class JoinPointSignature implements ResolvedMember { return true; } + @Override public int hashCode() { return 17 + (37 * realMember.hashCode()) + (37 * substituteDeclaringType.hashCode()); } diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java b/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java index 4da37be9e..5f72c1154 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java @@ -113,6 +113,7 @@ public class ReferenceType extends ResolvedType { this.derivativeTypes.add(dependent); } + @Override public String getSignatureForAttribute() { if (genericType == null || typeParameters == null) return getSignature(); @@ -127,10 +128,12 @@ public class ReferenceType extends ResolvedType { typeKind = TypeKind.GENERIC; } + @Override public boolean isClass() { return delegate.isClass(); } + @Override public boolean isGenericType() { return !isParameterizedType() && !isRawType() && delegate.isGeneric(); } @@ -140,10 +143,12 @@ public class ReferenceType extends ResolvedType { return (sig == null) ? "" : sig; } + @Override public AnnotationAJ[] getAnnotations() { return delegate.getAnnotations(); } + @Override public void addAnnotation(AnnotationAJ annotationX) { if (annotations == null) { annotations = new AnnotationAJ[1]; @@ -184,6 +189,7 @@ public class ReferenceType extends ResolvedType { } } + @Override public ResolvedType[] getAnnotationTypes() { if (delegate == null) { throw new BCException("Unexpected null delegate for type " + this.getName()); @@ -200,6 +206,7 @@ public class ReferenceType extends ResolvedType { } } + @Override public AnnotationAJ getAnnotationOfType(UnresolvedType ofType) { AnnotationAJ[] axs = delegate.getAnnotations(); if (axs == null) { @@ -221,26 +228,32 @@ public class ReferenceType extends ResolvedType { return null; } + @Override public boolean isAspect() { return delegate.isAspect(); } + @Override public boolean isAnnotationStyleAspect() { return delegate.isAnnotationStyleAspect(); } + @Override public boolean isEnum() { return delegate.isEnum(); } + @Override public boolean isAnnotation() { return delegate.isAnnotation(); } + @Override public boolean isAnonymous() { return delegate.isAnonymous(); } + @Override public boolean isNested() { return delegate.isNested(); } @@ -253,19 +266,23 @@ public class ReferenceType extends ResolvedType { return delegate.getRetentionPolicy(); } + @Override public boolean isAnnotationWithRuntimeRetention() { return delegate.isAnnotationWithRuntimeRetention(); } + @Override public boolean canAnnotationTargetType() { return delegate.canAnnotationTargetType(); } + @Override public AnnotationTargetKind[] getAnnotationTargetKinds() { return delegate.getAnnotationTargetKinds(); } // true iff the statement "this = (ThisType) other" would compile + @Override public boolean isCoerceableFrom(ResolvedType o) { ResolvedType other = o.resolve(world); @@ -359,6 +376,7 @@ public class ReferenceType extends ResolvedType { return false; } + @Override public boolean isAssignableFrom(ResolvedType other) { return isAssignableFrom(other, false); } @@ -366,6 +384,7 @@ public class ReferenceType extends ResolvedType { // TODO rewrite this method - it is a terrible mess // true iff the statement "this = other" would compile. + @Override public boolean isAssignableFrom(ResolvedType other, boolean allowMissing) { if (other.isPrimitiveType()) { if (!world.isInJava5Mode()) @@ -524,25 +543,30 @@ public class ReferenceType extends ResolvedType { return false; } + @Override public ISourceContext getSourceContext() { return delegate.getSourceContext(); } + @Override public ISourceLocation getSourceLocation() { ISourceContext isc = delegate.getSourceContext(); return isc.makeSourceLocation(new Position(startPos, endPos)); } + @Override public boolean isExposedToWeaver() { return (delegate == null) || delegate.isExposedToWeaver(); // ??? where // does this // belong } + @Override public WeaverStateInfo getWeaverState() { return delegate.getWeaverState(); } + @Override public ResolvedMember[] getDeclaredFields() { if (parameterizedFields != null) return parameterizedFields; @@ -563,6 +587,7 @@ public class ReferenceType extends ResolvedType { * Find out from the generic signature the true signature of any interfaces I implement. If I am parameterized, these may then * need to be parameterized before returning. */ + @Override public ResolvedType[] getDeclaredInterfaces() { if (parameterizedInterfaces != null) return parameterizedInterfaces; @@ -682,6 +707,7 @@ public class ReferenceType extends ResolvedType { return -1; } + @Override public ResolvedMember[] getDeclaredMethods() { if (parameterizedMethods != null) return parameterizedMethods; @@ -698,6 +724,7 @@ public class ReferenceType extends ResolvedType { } } + @Override public ResolvedMember[] getDeclaredPointcuts() { if (parameterizedPointcuts != null) return parameterizedPointcuts; @@ -729,10 +756,12 @@ public class ReferenceType extends ResolvedType { return parameters; } + @Override public UnresolvedType getRawType() { return super.getRawType().resolve(world); } + @Override public TypeVariable[] getTypeVariables() { if (this.typeVariables == null) { this.typeVariables = delegate.getTypeVariables(); @@ -743,6 +772,7 @@ public class ReferenceType extends ResolvedType { return this.typeVariables; } + @Override public PerClause getPerClause() { PerClause pclause = delegate.getPerClause(); if (isParameterizedType()) { // could cache the result here... @@ -752,10 +782,11 @@ public class ReferenceType extends ResolvedType { return pclause; } - public Collection getDeclares() { + @Override + public Collection getDeclares() { if (parameterizedDeclares != null) return parameterizedDeclares; - Collection declares = null; + Collection declares = null; if (ajMembersNeedParameterization()) { Collection genericDeclares = delegate.getDeclares(); parameterizedDeclares = new ArrayList(); @@ -768,13 +799,13 @@ public class ReferenceType extends ResolvedType { } else { declares = delegate.getDeclares(); } - for (Iterator iter = declares.iterator(); iter.hasNext();) { - Declare d = (Declare) iter.next(); + for (Declare d : declares) { d.setDeclaringType(this); } return declares; } + @Override public Collection getTypeMungers() { return delegate.getTypeMungers(); } @@ -800,14 +831,17 @@ public class ReferenceType extends ResolvedType { // return ret; // } + @Override public Collection getPrivilegedAccesses() { return delegate.getPrivilegedAccesses(); } + @Override public int getModifiers() { return delegate.getModifiers(); } + @Override public ResolvedType getSuperclass() { if (newSuperclass != null) { if (this.isParameterizedType() && newSuperclass.isParameterizedType()) { @@ -879,6 +913,7 @@ public class ReferenceType extends ResolvedType { this.startPos = startPos; } + @Override public boolean doesNotExposeShadowMungers() { return delegate.doesNotExposeShadowMungers(); } @@ -903,6 +938,7 @@ public class ReferenceType extends ResolvedType { signatureErasure = null; } + @Override public ResolvedType getGenericType() { if (isGenericType()) return this; @@ -941,6 +977,7 @@ public class ReferenceType extends ResolvedType { return ret.toString(); } + @Override public void ensureConsistent() { annotations = null; annotationTypes = null; @@ -948,6 +985,7 @@ public class ReferenceType extends ResolvedType { newInterfaces = null; } + @Override public void addParent(ResolvedType newParent) { if (newParent.isClass()) { newSuperclass = newParent; diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceTypeDelegate.java b/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceTypeDelegate.java index 014e40b83..850a79d8d 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceTypeDelegate.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceTypeDelegate.java @@ -14,6 +14,7 @@ package org.aspectj.weaver; import java.util.Collection; +import org.aspectj.weaver.patterns.Declare; import org.aspectj.weaver.patterns.PerClause; /** @@ -24,7 +25,7 @@ import org.aspectj.weaver.patterns.PerClause; public interface ReferenceTypeDelegate { public boolean isAspect(); - + /** * @return true if the type is an annotation style aspect (a type marked @Aspect) */ @@ -85,7 +86,7 @@ public interface ReferenceTypeDelegate { */ public PerClause getPerClause(); - public Collection getDeclares(); + public Collection getDeclares(); public Collection getTypeMungers(); diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMember.java b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMember.java index 84679cce0..93d698415 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMember.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMember.java @@ -46,7 +46,7 @@ public interface ResolvedMember extends Member, AnnotatedElement, TypeVariableDe public ResolvedType[] getAnnotationTypes(); - public void setAnnotationTypes(UnresolvedType[] annotationtypes); + public void setAnnotationTypes(ResolvedType[] annotationtypes); public void addAnnotation(AnnotationAJ annotation); diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMemberImpl.java b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMemberImpl.java index 9a3c2bf5e..44522858f 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMemberImpl.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMemberImpl.java @@ -39,7 +39,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno */ protected ResolvedMember backingGenericMember = null; - protected Set annotationTypes = null; + protected Set annotationTypes = null; protected ResolvedType[][] parameterAnnotationTypes = null; // Some members are 'created' to represent other things (for example ITDs). @@ -123,11 +123,10 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno // } } - List declaringTypes = new ArrayList(); + List declaringTypes = new ArrayList(); accumulateTypesInBetween(originalDeclaringType, firstDefiningType, declaringTypes); - Set memberSignatures = new HashSet(); - for (Iterator iter = declaringTypes.iterator(); iter.hasNext();) { - ResolvedType declaringType = (ResolvedType) iter.next(); + Set memberSignatures = new HashSet(); + for (ResolvedType declaringType : declaringTypes) { ResolvedMember member = firstDefiningMember.withSubstituteDeclaringType(declaringType); memberSignatures.add(member); } @@ -137,7 +136,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno // include the signature for // every type between the firstDefiningMember and the root defining // member. - Iterator superTypeIterator = firstDefiningType.getDirectSupertypes(); + Iterator superTypeIterator = firstDefiningType.getDirectSupertypes(); List typesAlreadyVisited = new ArrayList(); accumulateMembersMatching(firstDefiningMember, superTypeIterator, typesAlreadyVisited, memberSignatures, false); } @@ -160,13 +159,13 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno /** * Build a list containing every type between subtype and supertype, inclusively. */ - private static void accumulateTypesInBetween(ResolvedType subType, ResolvedType superType, List types) { + private static void accumulateTypesInBetween(ResolvedType subType, ResolvedType superType, List types) { types.add(subType); if (subType == superType) { return; } else { - for (Iterator iter = subType.getDirectSupertypes(); iter.hasNext();) { - ResolvedType parent = (ResolvedType) iter.next(); + for (Iterator iter = subType.getDirectSupertypes(); iter.hasNext();) { + ResolvedType parent = iter.next(); if (superType.isAssignableFrom(parent)) { accumulateTypesInBetween(parent, superType, types); } @@ -178,22 +177,21 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno * We have a resolved member, possibly with type parameter references as parameters or return type. We need to find all its * ancestor members. When doing this, a type parameter matches regardless of bounds (bounds can be narrowed down the hierarchy). */ - private static void accumulateMembersMatching(ResolvedMemberImpl memberToMatch, Iterator typesToLookIn, - List typesAlreadyVisited, Set foundMembers, boolean ignoreGenerics) { + private static void accumulateMembersMatching(ResolvedMemberImpl memberToMatch, Iterator typesToLookIn, + List typesAlreadyVisited, Set foundMembers, boolean ignoreGenerics) { while (typesToLookIn.hasNext()) { - ResolvedType toLookIn = (ResolvedType) typesToLookIn.next(); + ResolvedType toLookIn = typesToLookIn.next(); if (!typesAlreadyVisited.contains(toLookIn)) { typesAlreadyVisited.add(toLookIn); ResolvedMemberImpl foundMember = (ResolvedMemberImpl) toLookIn.lookupResolvedMember(memberToMatch, true, ignoreGenerics); if (foundMember != null && isVisibleTo(memberToMatch, foundMember)) { - List declaringTypes = new ArrayList(); + List declaringTypes = new ArrayList(); // declaring type can be unresolved if the member can from // an ITD... ResolvedType resolvedDeclaringType = foundMember.getDeclaringType().resolve(toLookIn.getWorld()); accumulateTypesInBetween(toLookIn, resolvedDeclaringType, declaringTypes); - for (Iterator iter = declaringTypes.iterator(); iter.hasNext();) { - ResolvedType declaringType = (ResolvedType) iter.next(); + for (ResolvedType declaringType : declaringTypes) { // typesAlreadyVisited.add(declaringType); ResolvedMember member = foundMember.withSubstituteDeclaringType(declaringType); foundMembers.add(member); @@ -323,12 +321,12 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno return super.getAnnotations(); } - public void setAnnotationTypes(UnresolvedType[] annotationtypes) { + public void setAnnotationTypes(ResolvedType[] annotationtypes) { if (annotationTypes == null) { - annotationTypes = new HashSet(); + annotationTypes = new HashSet(); } for (int i = 0; i < annotationtypes.length; i++) { - UnresolvedType typeX = annotationtypes[i]; + ResolvedType typeX = annotationtypes[i]; annotationTypes.add(typeX); } } @@ -350,7 +348,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno // FIXME asc only allows for annotation types, not instances - should // it? if (annotationTypes == null) { - annotationTypes = new HashSet(); + annotationTypes = new HashSet(); } annotationTypes.add(annotation.getType()); } @@ -526,15 +524,15 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno } } world.setTypeVariableLookupScope(this); - if (annotationTypes != null) { - Set r = new HashSet(); - for (UnresolvedType element : annotationTypes) { - // for (Iterator iter = annotationTypes.iterator(); iter.hasNext();) { - // UnresolvedType element = (UnresolvedType) iter.next(); - r.add(world.resolve(element)); - } - annotationTypes = r; - } + // if (annotationTypes != null) { + // Set r = new HashSet(); + // for (UnresolvedType element : annotationTypes) { + // // for (Iterator iter = annotationTypes.iterator(); iter.hasNext();) { + // // UnresolvedType element = (UnresolvedType) iter.next(); + // r.add(world.resolve(element)); + // } + // annotationTypes = r; + // } declaringType = declaringType.resolve(world); if (declaringType.isRawType()) declaringType = ((ReferenceType) declaringType).getGenericType(); @@ -682,7 +680,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno if (isParameterized && (typeVariables.length != typeParameters.length)) { throw new IllegalStateException("Wrong number of type parameters supplied"); } - Map typeMap = new HashMap(); + Map typeMap = new HashMap(); boolean typeParametersSupplied = typeParameters != null && typeParameters.length > 0; if (typeVariables != null) { // If no 'replacements' were supplied in the typeParameters array diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java index 2c0b52d2c..5095c0f0e 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java @@ -62,8 +62,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl * Returns an iterator through ResolvedType objects representing all the direct supertypes of this type. That is, through the * superclass, if any, and all declared interfaces. */ - public final Iterator getDirectSupertypes() { - Iterator ifacesIterator = Iterators.array(getDeclaredInterfaces()); + public final Iterator getDirectSupertypes() { + Iterator ifacesIterator = Iterators.array(getDeclaredInterfaces()); ResolvedType superclass = getSuperclass(); if (superclass == null) { return ifacesIterator; @@ -85,20 +85,10 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl } /** - * Returns a ResolvedType object representing the superclass of this type, or null. If this represents a java.lang.Object, a - * primitive type, or void, this method returns null. + * @return the superclass of this type, or null (if this represents a jlObject, primitive, or void) */ public abstract ResolvedType getSuperclass(); - /** - * Returns the modifiers for this type. - *

- * See {@link Class#getModifiers()} for a description of the weirdness of this methods on primitives and arrays. - * - * @param world the {@link World} in which the lookup is made. - * @return an int representing the modifiers for this type - * @see java.lang.reflect.Modifier - */ public abstract int getModifiers(); // return true if this resolved type couldn't be found (but we know it's @@ -133,7 +123,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl // This set contains pairs of types whose signatures are concatenated // together, this means with a fast lookup we can tell if two types // are equivalent. - protected static Set validBoxing = new HashSet(); + protected static Set validBoxing = new HashSet(); static { validBoxing.add("Ljava/lang/Byte;B"); @@ -188,16 +178,16 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl *

* We keep a hashSet of interfaces that we've visited so we don't spiral out into 2^n land. */ - public Iterator getFields() { - final Iterators.Filter dupFilter = Iterators.dupFilter(); - Iterators.Getter typeGetter = new Iterators.Getter() { - public Iterator get(Object o) { - return dupFilter.filter(((ResolvedType) o).getDirectSupertypes()); + public Iterator getFields() { + final Iterators.Filter dupFilter = Iterators.dupFilter(); + Iterators.Getter typeGetter = new Iterators.Getter() { + public Iterator get(ResolvedType o) { + return dupFilter.filter((o).getDirectSupertypes()); } }; - Iterators.Getter fieldGetter = new Iterators.Getter() { - public Iterator get(Object o) { - return Iterators.array(((ResolvedType) o).getDeclaredFields()); + Iterators.Getter fieldGetter = new Iterators.Getter() { + public Iterator get(ResolvedType o) { + return Iterators.array((o).getDeclaredFields()); } }; return Iterators.mapOver(Iterators.recur(this, typeGetter), fieldGetter); @@ -216,26 +206,26 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl * We keep a hashSet of interfaces that we've visited so we don't spiral out into 2^n land. NOTE: Take a look at the javadoc on * getMethodsWithoutIterator() to see if you are sensitive to a quirk in getMethods() */ - public Iterator getMethods() { - final Iterators.Filter dupFilter = Iterators.dupFilter(); - Iterators.Getter ifaceGetter = new Iterators.Getter() { - public Iterator get(Object o) { - return dupFilter.filter(Iterators.array(((ResolvedType) o).getDeclaredInterfaces())); + public Iterator getMethods() { + final Iterators.Filter dupFilter = Iterators.dupFilter(); + Iterators.Getter ifaceGetter = new Iterators.Getter() { + public Iterator get(ResolvedType o) { + return dupFilter.filter(Iterators.array(o.getDeclaredInterfaces())); } }; - Iterators.Getter methodGetter = new Iterators.Getter() { - public Iterator get(Object o) { - return Iterators.array(((ResolvedType) o).getDeclaredMethods()); + Iterators.Getter methodGetter = new Iterators.Getter() { + public Iterator get(ResolvedType o) { + return Iterators.array((o).getDeclaredMethods()); } }; - return Iterators.mapOver(Iterators.append(new Iterator() { + return Iterators.mapOver(Iterators.append(new Iterator() { ResolvedType curr = ResolvedType.this; public boolean hasNext() { return curr != null; } - public Object next() { + public ResolvedType next() { ResolvedType ret = curr; curr = curr.getSuperclass(); return ret; @@ -253,31 +243,30 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl * return methods declared on *this* class twice, once at the start and once at the end - I couldn't debug that problem, so * created this alternative. */ - public List getMethodsWithoutIterator(boolean includeITDs, boolean allowMissing) { - List methods = new ArrayList(); - Set knowninterfaces = new HashSet(); + public List getMethodsWithoutIterator(boolean includeITDs, boolean allowMissing) { + List methods = new ArrayList(); + Set knowninterfaces = new HashSet(); addAndRecurse(knowninterfaces, methods, this, includeITDs, allowMissing, false); return methods; } - public List getMethodsWithoutIterator(boolean includeITDs, boolean allowMissing, boolean genericsAware) { - List methods = new ArrayList(); - Set knowninterfaces = new HashSet(); + public List getMethodsWithoutIterator(boolean includeITDs, boolean allowMissing, boolean genericsAware) { + List methods = new ArrayList(); + Set knowninterfaces = new HashSet(); addAndRecurse(knowninterfaces, methods, this, includeITDs, allowMissing, genericsAware); return methods; } - private void addAndRecurse(Set knowninterfaces, List collector, ResolvedType resolvedType, boolean includeITDs, - boolean allowMissing, boolean genericsAware) { + private void addAndRecurse(Set knowninterfaces, List collector, ResolvedType resolvedType, + boolean includeITDs, boolean allowMissing, boolean genericsAware) { // Add the methods declared on this type collector.addAll(Arrays.asList(resolvedType.getDeclaredMethods())); // now add all the inter-typed members too if (includeITDs && resolvedType.interTypeMungers != null) { - for (Iterator i = interTypeMungers.iterator(); i.hasNext();) { - ConcreteTypeMunger tm = (ConcreteTypeMunger) i.next(); - ResolvedMember rm = tm.getSignature(); + for (ConcreteTypeMunger typeTransformer : interTypeMungers) { + ResolvedMember rm = typeTransformer.getSignature(); if (rm != null) { // new parent type munger can have null signature - collector.add(tm.getSignature()); + collector.add(typeTransformer.getSignature()); } } } @@ -335,8 +324,21 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl /** * described in JVM spec 2ed 5.4.3.2 */ - public ResolvedMember lookupField(Member m) { - return lookupMember(m, getFields()); + public ResolvedMember lookupField(Member field) { + Iterator i = getFields(); + while (i.hasNext()) { + ResolvedMember resolvedMember = i.next(); + if (matches(resolvedMember, field)) { + return resolvedMember; + } + if (resolvedMember.hasBackingGenericMember() && field.getName().equals(resolvedMember.getName())) { + // might be worth checking the member behind the parameterized member (see pr137496) + if (matches(resolvedMember.getBackingGenericMember(), field)) { + return resolvedMember; + } + } + } + return null; } /** @@ -399,31 +401,6 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl return null; } - /** - * return null if not found - */ - private ResolvedMember lookupMember(Member m, Iterator i) { - while (i.hasNext()) { - ResolvedMember f = (ResolvedMember) i.next(); - if (matches(f, m)) - return f; - if (f.hasBackingGenericMember() && m.getName().equals(f.getName())) { // might - // be - // worth - // checking - // the - // method - // behind - // the - // parameterized method (see pr137496) - if (matches(f.getBackingGenericMember(), m)) - return f; - } - } - return null; // ResolvedMember.Missing; - // throw new BCException("can't find " + m); - } - /** * return null if not found */ @@ -452,7 +429,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl toSearch = getFields(); } while (toSearch.hasNext()) { - ResolvedMember candidate = (ResolvedMemberImpl) toSearch.next(); + ResolvedMember candidate = (ResolvedMember) toSearch.next(); if (ignoreGenerics) { if (candidate.hasBackingGenericMember()) { candidate = candidate.getBackingGenericMember(); @@ -540,18 +517,18 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl *

* We keep a hashSet of interfaces that we've visited so we don't spiral out into 2^n land. */ - public Iterator getPointcuts() { - final Iterators.Filter dupFilter = Iterators.dupFilter(); + public Iterator getPointcuts() { + final Iterators.Filter dupFilter = Iterators.dupFilter(); // same order as fields - Iterators.Getter typeGetter = new Iterators.Getter() { - public Iterator get(Object o) { - return dupFilter.filter(((ResolvedType) o).getDirectSupertypes()); + Iterators.Getter typeGetter = new Iterators.Getter() { + public Iterator get(ResolvedType o) { + return dupFilter.filter(o.getDirectSupertypes()); } }; - Iterators.Getter pointcutGetter = new Iterators.Getter() { - public Iterator get(Object o) { + Iterators.Getter pointcutGetter = new Iterators.Getter() { + public Iterator get(ResolvedType o) { // System.err.println("getting for " + o); - return Iterators.array(((ResolvedType) o).getDeclaredPointcuts()); + return Iterators.array(o.getDeclaredPointcuts()); } }; return Iterators.mapOver(Iterators.recur(this, typeGetter), pointcutGetter); @@ -601,12 +578,12 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl return crosscuttingMembers; } - public final Collection collectDeclares(boolean includeAdviceLike) { + public final List collectDeclares(boolean includeAdviceLike) { if (!this.isAspect()) { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } - ArrayList ret = new ArrayList(); + List ret = new ArrayList(); // if (this.isAbstract()) { // for (Iterator i = getDeclares().iterator(); i.hasNext();) { // Declare dec = (Declare) i.next(); @@ -617,16 +594,16 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl if (!this.isAbstract()) { // ret.addAll(getDeclares()); - final Iterators.Filter dupFilter = Iterators.dupFilter(); - Iterators.Getter typeGetter = new Iterators.Getter() { - public Iterator get(Object o) { - return dupFilter.filter(((ResolvedType) o).getDirectSupertypes()); + final Iterators.Filter dupFilter = Iterators.dupFilter(); + Iterators.Getter typeGetter = new Iterators.Getter() { + public Iterator get(ResolvedType o) { + return dupFilter.filter((o).getDirectSupertypes()); } }; - Iterator typeIterator = Iterators.recur(this, typeGetter); + Iterator typeIterator = Iterators.recur(this, typeGetter); while (typeIterator.hasNext()) { - ResolvedType ty = (ResolvedType) typeIterator.next(); + ResolvedType ty = typeIterator.next(); // System.out.println("super: " + ty + ", " + ); for (Iterator i = ty.getDeclares().iterator(); i.hasNext();) { Declare dec = (Declare) i.next(); @@ -643,21 +620,22 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl return ret; } - private final Collection collectShadowMungers() { - if (!this.isAspect() || this.isAbstract() || this.doesNotExposeShadowMungers()) - return Collections.EMPTY_LIST; + private final List collectShadowMungers() { + if (!this.isAspect() || this.isAbstract() || this.doesNotExposeShadowMungers()) { + return Collections.emptyList(); + } - ArrayList acc = new ArrayList(); - final Iterators.Filter dupFilter = Iterators.dupFilter(); - Iterators.Getter typeGetter = new Iterators.Getter() { - public Iterator get(Object o) { - return dupFilter.filter(((ResolvedType) o).getDirectSupertypes()); + List acc = new ArrayList(); + final Iterators.Filter dupFilter = Iterators.dupFilter(); + Iterators.Getter typeGetter = new Iterators.Getter() { + public Iterator get(ResolvedType o) { + return dupFilter.filter((o).getDirectSupertypes()); } }; - Iterator typeIterator = Iterators.recur(this, typeGetter); + Iterator typeIterator = Iterators.recur(this, typeGetter); while (typeIterator.hasNext()) { - ResolvedType ty = (ResolvedType) typeIterator.next(); + ResolvedType ty = typeIterator.next(); acc.addAll(ty.getDeclaredShadowMungers()); } @@ -769,22 +747,24 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl return Modifier.isFinal(getModifiers()); } - protected Map /* Type variable name -> UnresolvedType */getMemberParameterizationMap() { - if (!isParameterizedType()) - return Collections.EMPTY_MAP; + protected Map getMemberParameterizationMap() { + if (!isParameterizedType()) { + return Collections.emptyMap(); + } TypeVariable[] tvs = getGenericType().getTypeVariables(); - Map parameterizationMap = new HashMap(); + Map parameterizationMap = new HashMap(); for (int i = 0; i < tvs.length; i++) { parameterizationMap.put(tvs[i].getName(), typeParameters[i]); } return parameterizationMap; } - public Collection getDeclaredAdvice() { - List l = new ArrayList(); + public List getDeclaredAdvice() { + List l = new ArrayList(); ResolvedMember[] methods = getDeclaredMethods(); - if (isParameterizedType()) + if (isParameterizedType()) { methods = getGenericType().getDeclaredMethods(); + } Map typeVariableMap = getAjMemberParameterizationMap(); for (int i = 0, len = methods.length; i < len; i++) { ShadowMunger munger = methods[i].getAssociatedShadowMunger(); @@ -820,9 +800,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl return l; } - public Collection getDeclaredShadowMungers() { - Collection c = getDeclaredAdvice(); - return c; + public List getDeclaredShadowMungers() { + return getDeclaredAdvice(); } // ---- only for testing! @@ -835,11 +814,6 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl return filterInJavaVisible(getDeclaredMethods()); } - public ShadowMunger[] getDeclaredShadowMungersArray() { - List l = (List) getDeclaredShadowMungers(); - return (ShadowMunger[]) l.toArray(new ShadowMunger[l.size()]); - } - private ResolvedMember[] filterInJavaVisible(ResolvedMember[] ms) { List l = new ArrayList(); for (int i = 0, len = ms.length; i < len; i++) { @@ -1187,12 +1161,12 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl return interTypeMungers; } - public List getInterTypeParentMungers() { - List l = new ArrayList(); - for (Iterator iter = interTypeMungers.iterator(); iter.hasNext();) { - ConcreteTypeMunger element = (ConcreteTypeMunger) iter.next(); - if (element.getMunger() instanceof NewParentTypeMunger) + public List getInterTypeParentMungers() { + List l = new ArrayList(); + for (ConcreteTypeMunger element : interTypeMungers) { + if (element.getMunger() instanceof NewParentTypeMunger) { l.add(element); + } } return l; } @@ -1200,37 +1174,37 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl /** * ??? This method is O(N*M) where N = number of methods and M is number of inter-type declarations in my super */ - public List getInterTypeMungersIncludingSupers() { - ArrayList ret = new ArrayList(); + public List getInterTypeMungersIncludingSupers() { + ArrayList ret = new ArrayList(); collectInterTypeMungers(ret); return ret; } - public List getInterTypeParentMungersIncludingSupers() { - ArrayList ret = new ArrayList(); + public List getInterTypeParentMungersIncludingSupers() { + ArrayList ret = new ArrayList(); collectInterTypeParentMungers(ret); return ret; } - private void collectInterTypeParentMungers(List collector) { - for (Iterator iter = getDirectSupertypes(); iter.hasNext();) { - ResolvedType superType = (ResolvedType) iter.next(); + private void collectInterTypeParentMungers(List collector) { + for (Iterator iter = getDirectSupertypes(); iter.hasNext();) { + ResolvedType superType = iter.next(); superType.collectInterTypeParentMungers(collector); } collector.addAll(getInterTypeParentMungers()); } - protected void collectInterTypeMungers(List collector) { - for (Iterator iter = getDirectSupertypes(); iter.hasNext();) { - ResolvedType superType = (ResolvedType) iter.next(); + protected void collectInterTypeMungers(List collector) { + for (Iterator iter = getDirectSupertypes(); iter.hasNext();) { + ResolvedType superType = iter.next(); if (superType == null) { throw new BCException("UnexpectedProblem: a supertype in the hierarchy for " + this.getName() + " is null"); } superType.collectInterTypeMungers(collector); } - outer: for (Iterator iter1 = collector.iterator(); iter1.hasNext();) { - ConcreteTypeMunger superMunger = (ConcreteTypeMunger) iter1.next(); + outer: for (Iterator iter1 = collector.iterator(); iter1.hasNext();) { + ConcreteTypeMunger superMunger = iter1.next(); if (superMunger.getSignature() == null) continue; @@ -1248,8 +1222,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl continue; } - for (Iterator iter = getMethods(); iter.hasNext();) { - ResolvedMember method = (ResolvedMember) iter.next(); + for (Iterator iter = getMethods(); iter.hasNext();) { + ResolvedMember method = iter.next(); if (conflictingSignature(method, superMunger.getSignature())) { iter1.remove(); continue outer; @@ -1878,8 +1852,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl // ??? horribly inefficient // for (Iterator i = // System.err.println("lookup " + member + " in " + interTypeMungers); - for (Iterator i = interTypeMungers.iterator(); i.hasNext();) { - ConcreteTypeMunger m = (ConcreteTypeMunger) i.next(); + for (ConcreteTypeMunger m : interTypeMungers) { ResolvedMember ret = m.getMatchingSyntheticMember(member); if (ret != null) { // System.err.println(" found: " + ret); diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedTypeMunger.java b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedTypeMunger.java index b53268e00..ce08ad23c 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedTypeMunger.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedTypeMunger.java @@ -23,7 +23,6 @@ import java.io.ObjectOutputStream; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -52,9 +51,9 @@ public abstract class ResolvedTypeMunger { // across the intertype declaration to the right type variables in the generic // type upon which the itd is being made. // might need serializing the class file for binary weaving. - protected List /* String */typeVariableAliases; + protected List typeVariableAliases; - private Set /* resolvedMembers */superMethodsCalled = Collections.EMPTY_SET; + private Set superMethodsCalled = Collections.emptySet(); private ISourceLocation location; // Lost during serialize/deserialize ! @@ -131,6 +130,7 @@ public abstract class ResolvedTypeMunger { // ---- + @Override public String toString() { return "ResolvedTypeMunger(" + getKind() + ", " + getSignature() + ")"; // .superMethodsCalled + ")"; @@ -157,9 +157,8 @@ public abstract class ResolvedTypeMunger { } } - protected static Set readSuperMethodsCalled(VersionedDataInputStream s) throws IOException { - - Set ret = new HashSet(); + protected static Set readSuperMethodsCalled(VersionedDataInputStream s) throws IOException { + Set ret = new HashSet(); int n = s.readInt(); if (n < 0) throw new BCException("Problem deserializing type munger"); @@ -176,12 +175,11 @@ public abstract class ResolvedTypeMunger { return; } - List ret = new ArrayList(superMethodsCalled); + List ret = new ArrayList(superMethodsCalled); Collections.sort(ret); int n = ret.size(); s.writeInt(n); - for (Iterator i = ret.iterator(); i.hasNext();) { - ResolvedMember m = (ResolvedMember) i.next(); + for (ResolvedMember m : ret) { m.write(s); } @@ -264,6 +262,7 @@ public abstract class ResolvedTypeMunger { throw new BCException("bad kind: " + key); } + @Override public String toString() { // we want MethodDelegate to appear as Method in WeaveInfo messages // TODO we may want something for fieldhost ? @@ -298,11 +297,11 @@ public abstract class ResolvedTypeMunger { public static final String SUPER_DISPATCH_NAME = "superDispatch"; - public void setSuperMethodsCalled(Set c) { + public void setSuperMethodsCalled(Set c) { this.superMethodsCalled = c; } - public Set getSuperMethodsCalled() { + public Set getSuperMethodsCalled() { return superMethodsCalled; } @@ -334,11 +333,11 @@ public abstract class ResolvedTypeMunger { } } - protected static List readInTypeAliases(VersionedDataInputStream s) throws IOException { + protected static List readInTypeAliases(VersionedDataInputStream s) throws IOException { if (s.getMajorVersion() >= AjAttribute.WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ150) { int count = s.readInt(); if (count != 0) { - List aliases = new ArrayList(); + List aliases = new ArrayList(); for (int i = 0; i < count; i++) { aliases.add(s.readUTF()); } @@ -354,14 +353,13 @@ public abstract class ResolvedTypeMunger { s.writeInt(0); } else { s.writeInt(typeVariableAliases.size()); - for (Iterator iter = typeVariableAliases.iterator(); iter.hasNext();) { - String element = (String) iter.next(); + for (String element : typeVariableAliases) { s.writeUTF(element); } } } - public List getTypeVariableAliases() { + public List getTypeVariableAliases() { return typeVariableAliases; } diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareParents.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareParents.java index ae373a87b..1bef37c60 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareParents.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareParents.java @@ -68,10 +68,12 @@ public class DeclareParents extends Declare { return true; } + @Override public Object accept(PatternNodeVisitor visitor, Object data) { return visitor.visit(this, data); } + @Override public Declare parameterizeWith(Map typeVariableBindingMap, World w) { DeclareParents ret = new DeclareParents(child.parameterizeWith(typeVariableBindingMap, w), parents.parameterizeWith( typeVariableBindingMap, w), isExtends); @@ -79,6 +81,7 @@ public class DeclareParents extends Declare { return ret; } + @Override public String toString() { StringBuffer buf = new StringBuffer(); buf.append("declare parents: "); @@ -89,6 +92,7 @@ public class DeclareParents extends Declare { return buf.toString(); } + @Override public boolean equals(Object other) { if (!(other instanceof DeclareParents)) return false; @@ -97,6 +101,7 @@ public class DeclareParents extends Declare { } // ??? cache this + @Override public int hashCode() { int result = 23; result = 37 * result + child.hashCode(); @@ -104,6 +109,7 @@ public class DeclareParents extends Declare { return result; } + @Override public void write(DataOutputStream s) throws IOException { s.writeByte(Declare.PARENTS); child.write(s); @@ -144,6 +150,7 @@ public class DeclareParents extends Declare { return false; } + @Override public void resolve(IScope scope) { // ScopeWithTypeVariables resolutionScope = new ScopeWithTypeVariables(typeVariablesInScope,scope); child = child.resolveBindings(scope, Bindings.NONE, false, false); @@ -169,6 +176,7 @@ public class DeclareParents extends Declare { return this.isExtends; } + @Override public boolean isAdviceLike() { return false; } @@ -333,13 +341,13 @@ public class DeclareParents extends Declare { return true; } - public List/* */findMatchingNewParents(ResolvedType onType, boolean reportErrors) { + public List findMatchingNewParents(ResolvedType onType, boolean reportErrors) { if (onType.isRawType()) onType = onType.getGenericType(); if (!match(onType)) - return Collections.EMPTY_LIST; + return Collections.emptyList(); - List ret = new ArrayList(); + List ret = new ArrayList(); for (int i = 0; i < parents.size(); i++) { ResolvedType t = maybeGetNewParent(onType, parents.get(i), onType.getWorld(), reportErrors); if (t != null) @@ -349,6 +357,7 @@ public class DeclareParents extends Declare { return ret; } + @Override public String getNameSuffix() { return "parents"; } diff --git a/org.aspectj.matcher/testsrc/org/aspectj/weaver/CommonWorldTests.java b/org.aspectj.matcher/testsrc/org/aspectj/weaver/CommonWorldTests.java index 5d8d35568..f6a44c87c 100644 --- a/org.aspectj.matcher/testsrc/org/aspectj/weaver/CommonWorldTests.java +++ b/org.aspectj.matcher/testsrc/org/aspectj/weaver/CommonWorldTests.java @@ -40,6 +40,7 @@ public abstract class CommonWorldTests extends TestCase { private World world; + @Override public void setUp() { world = getWorld(); } @@ -160,7 +161,9 @@ public abstract class CommonWorldTests extends TestCase { } protected void mungersTest(ResolvedType ty, ShadowMunger[] x) { - TestUtil.assertSetEquals(ty + " mungers:", x, ty.getDeclaredShadowMungersArray()); + List l = (List) ty.getDeclaredShadowMungers(); + ShadowMunger[] array = (ShadowMunger[]) l.toArray(new ShadowMunger[l.size()]); + TestUtil.assertSetEquals(ty + " mungers:", x, array); } protected void interfaceTest(ResolvedType type, ResolvedType[] expectedInterfaces) {