]> source.dussan.org Git - aspectj.git/commitdiff
Java5 upgrades
authoraclement <aclement>
Wed, 9 Sep 2009 19:10:55 +0000 (19:10 +0000)
committeraclement <aclement>
Wed, 9 Sep 2009 19:10:55 +0000 (19:10 +0000)
14 files changed:
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java
weaver/src/org/aspectj/weaver/bcel/BcelAnnotation.java
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
weaver/src/org/aspectj/weaver/bcel/BcelField.java
weaver/src/org/aspectj/weaver/bcel/BcelMethod.java
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
weaver/src/org/aspectj/weaver/bcel/UnwovenClassFile.java
weaver/src/org/aspectj/weaver/bcel/Utility.java

index 12ee8ef3b9a044f8a39be4506e05dd20800a48bc..d2d3d459d4ae2d806ebd9f7828e1a3e55a467081 100644 (file)
@@ -85,7 +85,7 @@ import org.aspectj.weaver.patterns.TypePattern;
  */
 public class AtAjAttributes {
 
-       private final static List EMPTY_LIST = new ArrayList();
+       private final static List<AjAttribute> NO_ATTRIBUTES = Collections.emptyList();
        private final static String[] EMPTY_STRINGS = new String[0];
        private final static String VALUE = "value";
        private final static String ARGNAMES = "argNames";
@@ -102,7 +102,7 @@ public class AtAjAttributes {
                /**
                 * The list of AjAttribute.XXX that we are populating from the @AJ read
                 */
-               List ajAttributes = new ArrayList();
+               List<AjAttribute> ajAttributes = new ArrayList<AjAttribute>();
 
                /**
                 * The resolved type (class) for which we are reading @AJ for (be it class, method, field annotations)
@@ -189,8 +189,9 @@ public class AtAjAttributes {
                        IMessageHandler msgHandler, boolean isCodeStyleAspect) {
                boolean ignoreThisClass = javaClass.getClassName().charAt(0) == 'o'
                                && javaClass.getClassName().startsWith("org.aspectj.lang.annotation");
-               if (ignoreThisClass)
-                       return EMPTY_LIST;
+               if (ignoreThisClass) {
+                       return NO_ATTRIBUTES;
+               }
                boolean containsPointcut = false;
                boolean containsAnnotationClassReference = false;
                Constant[] cpool = javaClass.getConstantPool().getConstantPool();
@@ -215,7 +216,7 @@ public class AtAjAttributes {
                        }
                }
                if (!containsAnnotationClassReference)
-                       return EMPTY_LIST;
+                       return NO_ATTRIBUTES;
 
                AjAttributeStruct struct = new AjAttributeStruct(type, context, msgHandler);
                Attribute[] attributes = javaClass.getAttributes();
@@ -244,13 +245,13 @@ public class AtAjAttributes {
                        msgHandler.handleMessage(new Message("Found @DeclarePrecedence on a non @Aspect type '" + type.getName() + "'",
                                        IMessage.WARNING, null, type.getSourceLocation()));
                        // bypass what we have read
-                       return EMPTY_LIST;
+                       return NO_ATTRIBUTES;
                }
 
                // the following block will not detect @Pointcut in non @Aspect types
                // for optimization purpose
                if (!(hasAtAspectAnnotation || isCodeStyleAspect) && !containsPointcut) {
-                       return EMPTY_LIST;
+                       return NO_ATTRIBUTES;
                }
 
                // FIXME AV - turn on when ajcMightHaveAspect
@@ -898,8 +899,8 @@ public class AtAjAttributes {
                // supplied as just the class return value of the annotated method
                ElementNameValuePairGen interfaceListSpecified = getAnnotationElement(declareMixinAnnotation, "interfaces");
 
-               List newParents = new ArrayList(1);
-               List newInterfaceTypes = new ArrayList(1);
+               List<TypePattern> newParents = new ArrayList<TypePattern>(1);
+               List<ResolvedType> newInterfaceTypes = new ArrayList<ResolvedType>(1);
                if (interfaceListSpecified != null) {
                        ArrayElementValueGen arrayOfInterfaceTypes = (ArrayElementValueGen) interfaceListSpecified.getValue();
                        int numberOfTypes = arrayOfInterfaceTypes.getElementValuesArraySize();
@@ -1524,7 +1525,7 @@ public class AtAjAttributes {
                        throw new UnreadableDebugInfoException();
                }
 
-               List bindings = new ArrayList();
+               List<FormalBinding> bindings = new ArrayList<FormalBinding>();
                for (int i = 0; i < argumentNames.length; i++) {
                        String argumentName = argumentNames[i];
                        UnresolvedType argumentType = UnresolvedType.forSignature(method.getArgumentTypes()[i].getSignature());
@@ -1546,7 +1547,7 @@ public class AtAjAttributes {
                        }
                }
 
-               return (FormalBinding[]) bindings.toArray(new FormalBinding[] {});
+               return bindings.toArray(new FormalBinding[] {});
        }
 
        // FIXME alex deal with exclude index
@@ -1659,8 +1660,8 @@ public class AtAjAttributes {
         * Return the argNames set for an annotation or null if it is not specified.
         */
        private static String getArgNamesValue(AnnotationGen anno) {
-               for (Iterator iterator1 = anno.getValues().iterator(); iterator1.hasNext();) {
-                       ElementNameValuePairGen element = (ElementNameValuePairGen) iterator1.next();
+               List<ElementNameValuePairGen> elements = anno.getValues();
+               for (ElementNameValuePairGen element : elements) {
                        if (ARGNAMES.equals(element.getNameString())) {
                                return element.getValue().stringifyValue();
                        }
@@ -1693,7 +1694,7 @@ public class AtAjAttributes {
                }
 
                final int startAtStackIndex = method.isStatic() ? 0 : 1;
-               final List arguments = new ArrayList();
+               final List<MethodArgument> arguments = new ArrayList<MethodArgument>();
                LocalVariableTable lt = method.getLocalVariableTable();
                if (lt != null) {
                        for (int j = 0; j < lt.getLocalVariableTable().length; j++) {
@@ -1708,7 +1709,7 @@ public class AtAjAttributes {
                        // No debug info, do we have an annotation value we can rely on?
                        if (argNamesFromAnnotation != null) {
                                StringTokenizer st = new StringTokenizer(argNamesFromAnnotation, " ,");
-                               List args = new ArrayList();
+                               List<String> args = new ArrayList<String>();
                                while (st.hasMoreTokens()) {
                                        args.add(st.nextToken());
                                }
@@ -1729,7 +1730,7 @@ public class AtAjAttributes {
                                                        + shortString.toString() + "'", methodStruct);
                                        return EMPTY_STRINGS;
                                }
-                               return (String[]) args.toArray(new String[] {});
+                               return args.toArray(new String[] {});
                        }
                }
 
@@ -1753,9 +1754,8 @@ public class AtAjAttributes {
                });
                String[] argumentNames = new String[arguments.size()];
                int i = 0;
-               for (Iterator iterator = arguments.iterator(); iterator.hasNext(); i++) {
-                       MethodArgument methodArgument = (MethodArgument) iterator.next();
-                       argumentNames[i] = methodArgument.name;
+               for (MethodArgument methodArgument : arguments) {
+                       argumentNames[i++] = methodArgument.name;
                }
                return argumentNames;
        }
@@ -1795,6 +1795,7 @@ public class AtAjAttributes {
                        m_binding = binding;
                }
 
+               @Override
                public Pointcut getPointcut() {
                        if (m_lazyPointcut == null && m_pointcutUnresolved != null) {
                                m_lazyPointcut = m_pointcutUnresolved.resolve(m_binding);
@@ -1851,11 +1852,11 @@ public class AtAjAttributes {
                }
        }
 
-       private static void reportError(String message, IMessageHandler handler, ISourceLocation sourceLocation) {
-               if (!handler.isIgnoring(IMessage.ERROR)) {
-                       handler.handleMessage(new Message(message, sourceLocation, true));
-               }
-       }
+       // private static void reportError(String message, IMessageHandler handler, ISourceLocation sourceLocation) {
+       // if (!handler.isIgnoring(IMessage.ERROR)) {
+       // handler.handleMessage(new Message(message, sourceLocation, true));
+       // }
+       // }
 
        /**
         * Report a warning
index e1b7f8f192d0f00d2aa1b0d3353ce41b506a3f11..22cedb3e8763647e68c9ce6d275c0918f10e883a 100644 (file)
@@ -35,6 +35,7 @@ import org.aspectj.weaver.AjAttribute;
 import org.aspectj.weaver.BCException;
 import org.aspectj.weaver.IEclipseSourceContext;
 import org.aspectj.weaver.ISourceContext;
+import org.aspectj.weaver.Lint;
 import org.aspectj.weaver.Member;
 import org.aspectj.weaver.ReferenceType;
 import org.aspectj.weaver.ReferenceTypeDelegate;
@@ -101,6 +102,7 @@ class BcelAdvice extends Advice {
                return adviceSignature;
        }
 
+       @Override
        public ShadowMunger concretize(ResolvedType fromType, World world, PerClause clause) {
                suppressLintWarnings(world);
                ShadowMunger ret = super.concretize(fromType, world, clause);
@@ -119,6 +121,7 @@ class BcelAdvice extends Advice {
                return ret;
        }
 
+       @Override
        public ShadowMunger parameterizeWith(ResolvedType declaringType, Map typeVariableMap) {
                Pointcut pc = getPointcut().parameterizeWith(typeVariableMap, declaringType.getWorld());
 
@@ -133,6 +136,7 @@ class BcelAdvice extends Advice {
                return ret;
        }
 
+       @Override
        public boolean match(Shadow shadow, World world) {
                suppressLintWarnings(world);
                boolean ret = super.match(shadow, world);
@@ -140,6 +144,7 @@ class BcelAdvice extends Advice {
                return ret;
        }
 
+       @Override
        public void specializeOn(Shadow shadow) {
                if (getKind() == AdviceKind.Around) {
                        ((BcelShadow) shadow).initializeForAroundClosure();
@@ -218,6 +223,7 @@ class BcelAdvice extends Advice {
                return boType.getLazyClassGen().isWoven();
        }
 
+       @Override
        public boolean implementOn(Shadow s) {
                hasMatchedAtLeastOnce = true;
                BcelShadow shadow = (BcelShadow) s;
@@ -375,6 +381,7 @@ class BcelAdvice extends Advice {
 
        private Collection thrownExceptions = null;
 
+       @Override
        public Collection getThrownExceptions() {
                if (thrownExceptions == null) {
                        // ??? can we really lump in Around here, how does this interact with Throwable
@@ -400,6 +407,7 @@ class BcelAdvice extends Advice {
         * 
         * @return
         */
+       @Override
        public boolean mustCheckExceptions() {
                if (getConcreteAspect() == null) {
                        return true;
@@ -408,6 +416,7 @@ class BcelAdvice extends Advice {
        }
 
        // only call me after prepare has been called
+       @Override
        public boolean hasDynamicTests() {
                // if (hasExtraParameter() && getKind() == AdviceKind.AfterReturning) {
                // UnresolvedType extraParameterType = getExtraParameterType();
@@ -602,6 +611,7 @@ class BcelAdvice extends Advice {
                return new InstructionList(Utility.createInvoke(shadow.getFactory(), shadow.getWorld(), getOriginalSignature()));
        }
 
+       @Override
        public Member getOriginalSignature() {
                Member sig = getSignature();
                if (sig instanceof ResolvedMember) {
@@ -703,13 +713,13 @@ class BcelAdvice extends Advice {
                        if (signature instanceof BcelMethod) {
                                this.suppressedLintKinds = Utility.getSuppressedWarnings(signature.getAnnotations(), inWorld.getLint());
                        } else {
-                               this.suppressedLintKinds = Collections.EMPTY_LIST;
+                               this.suppressedLintKinds = Collections.emptyList();
                        }
                }
                inWorld.getLint().suppressKinds(suppressedLintKinds);
        }
 
-       protected void clearLintSuppressions(World inWorld, Collection toClear) {
+       protected void clearLintSuppressions(World inWorld, Collection<Lint.Kind> toClear) {
                inWorld.getLint().clearSuppressions(toClear);
        }
 
index a7da4be1e1e40a2295c16aba67d3496c718c8bec..ac865286fce9076a2862b52424e6d11de4172e50 100644 (file)
@@ -11,7 +11,6 @@ package org.aspectj.weaver.bcel;
 
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
@@ -42,15 +41,16 @@ public class BcelAnnotation extends AbstractAnnotationAJ {
        /**
         * {@inheritDoc}
         */
+       @Override
        public Set<String> getTargets() {
                if (!type.equals(UnresolvedType.AT_TARGET)) {
                        return Collections.emptySet();
                }
-               List values = bcelAnnotation.getValues();
-               ElementNameValuePairGen envp = (ElementNameValuePairGen) values.get(0);
+               List<ElementNameValuePairGen> values = bcelAnnotation.getValues();
+               ElementNameValuePairGen envp = values.get(0);
                ArrayElementValueGen aev = (ArrayElementValueGen) envp.getValue();
                ElementValueGen[] evs = aev.getElementValuesArray();
-               Set targets = new HashSet();
+               Set<String> targets = new HashSet<String>();
                for (int i = 0; i < evs.length; i++) {
                        EnumElementValueGen ev = (EnumElementValueGen) evs[i];
                        targets.add(ev.getEnumValueString());
@@ -61,6 +61,7 @@ public class BcelAnnotation extends AbstractAnnotationAJ {
        /**
         * {@inheritDoc}
         */
+       @Override
        public boolean hasNameValuePair(String name, String value) {
                return bcelAnnotation.hasNameValuePair(name, value);
        }
@@ -68,6 +69,7 @@ public class BcelAnnotation extends AbstractAnnotationAJ {
        /**
         * {@inheritDoc}
         */
+       @Override
        public boolean hasNamedValue(String name) {
                return bcelAnnotation.hasNamedValue(name);
        }
@@ -75,14 +77,14 @@ public class BcelAnnotation extends AbstractAnnotationAJ {
        /**
         * {@inheritDoc}
         */
+       @Override
        public String stringify() {
                StringBuffer sb = new StringBuffer();
                sb.append("@").append(type.getClassName());
-               List values = bcelAnnotation.getValues();
+               List<ElementNameValuePairGen> values = bcelAnnotation.getValues();
                if (values != null && values.size() != 0) {
                        sb.append("(");
-                       for (Iterator iterator = values.iterator(); iterator.hasNext();) {
-                               ElementNameValuePairGen nvPair = (ElementNameValuePairGen) iterator.next();
+                       for (ElementNameValuePairGen nvPair : values) {
                                sb.append(nvPair.getNameString()).append("=").append(nvPair.getValue().stringifyValue());
                        }
                        sb.append(")");
@@ -93,6 +95,7 @@ public class BcelAnnotation extends AbstractAnnotationAJ {
        /**
         * {@inheritDoc}
         */
+       @Override
        public boolean isRuntimeVisible() {
                return this.bcelAnnotation.isRuntimeVisible();
        }
@@ -108,12 +111,11 @@ public class BcelAnnotation extends AbstractAnnotationAJ {
         * {@inheritDoc}
         */
        public String getStringFormOfValue(String name) {
-               List annotationValues = this.bcelAnnotation.getValues();
+               List<ElementNameValuePairGen> annotationValues = this.bcelAnnotation.getValues();
                if (annotationValues == null || annotationValues.size() == 0) {
                        return null;
                } else {
-                       for (Iterator iterator = annotationValues.iterator(); iterator.hasNext();) {
-                               ElementNameValuePairGen nvPair = (ElementNameValuePairGen) iterator.next();
+                       for (ElementNameValuePairGen nvPair : annotationValues) {
                                if (nvPair.getNameString().equals(name)) {
                                        return nvPair.getValue().stringifyValue();
                                }
index 56158a3579a59f07bf84fc84a7ef5e4033c51ab9..73e1754409d47edd14d086d08b441d307960025a 100644 (file)
@@ -915,10 +915,10 @@ class BcelClassWeaver implements IClassWeaver {
 
                                                        if (annotationsToAdd == null)
                                                                annotationsToAdd = new ArrayList();
-                                                       AnnotationGen a = ((BcelAnnotation) decaM.getAnnotationX()).getBcelAnnotation();
+                                                       AnnotationGen a = ((BcelAnnotation) decaM.getAnnotation()).getBcelAnnotation();
                                                        AnnotationGen ag = new AnnotationGen(a, clazz.getConstantPool(), true);
                                                        annotationsToAdd.add(ag);
-                                                       mg.addAnnotation(decaM.getAnnotationX());
+                                                       mg.addAnnotation(decaM.getAnnotation());
 
                                                        AsmRelationshipProvider.addDeclareAnnotationMethodRelationship(decaM.getSourceLocation(), clazz
                                                                        .getName(), mg.getMemberView(), world.getModelAsAsmManager());// getMethod());
@@ -957,11 +957,11 @@ class BcelClassWeaver implements IClassWeaver {
                                                                if (annotationsToAdd == null) {
                                                                        annotationsToAdd = new ArrayList();
                                                                }
-                                                               AnnotationGen a = ((BcelAnnotation) decaM.getAnnotationX()).getBcelAnnotation();
+                                                               AnnotationGen a = ((BcelAnnotation) decaM.getAnnotation()).getBcelAnnotation();
                                                                // create copy to get the annotation type into the right constant pool
                                                                AnnotationGen ag = new AnnotationGen(a, clazz.getConstantPool(), true);
                                                                annotationsToAdd.add(ag);
-                                                               mg.addAnnotation(decaM.getAnnotationX());
+                                                               mg.addAnnotation(decaM.getAnnotation());
                                                                AsmRelationshipProvider.addDeclareAnnotationMethodRelationship(decaM.getSourceLocation(), clazz
                                                                                .getName(), mg.getMemberView(), world.getModelAsAsmManager());// getMethod());
                                                                isChanged = true;
@@ -1124,7 +1124,7 @@ class BcelClassWeaver implements IClassWeaver {
                                        LazyMethodGen annotationHolder = locateAnnotationHolderForFieldMunger(clazz, fieldMunger);
                                        if (doesAlreadyHaveAnnotation(annotationHolder, itdIsActually, decaF, reportedErrors))
                                                continue; // skip this one...
-                                       annotationHolder.addAnnotation(decaF.getAnnotationX());
+                                       annotationHolder.addAnnotation(decaF.getAnnotation());
                                        AsmRelationshipProvider.addDeclareAnnotationRelationship(world.getModelAsAsmManager(), decaF
                                                        .getSourceLocation(), itdIsActually.getSourceLocation());
                                        isChanged = true;
@@ -1147,7 +1147,7 @@ class BcelClassWeaver implements IClassWeaver {
                                                LazyMethodGen annotationHolder = locateAnnotationHolderForFieldMunger(clazz, fieldMunger);
                                                if (doesAlreadyHaveAnnotation(annotationHolder, itdIsActually, decaF, reportedErrors))
                                                        continue; // skip this one...
-                                               annotationHolder.addAnnotation(decaF.getAnnotationX());
+                                               annotationHolder.addAnnotation(decaF.getAnnotation());
                                                AsmRelationshipProvider.addDeclareAnnotationRelationship(world.getModelAsAsmManager(), decaF
                                                                .getSourceLocation(), itdIsActually.getSourceLocation());
                                                isChanged = true;
@@ -1182,7 +1182,7 @@ class BcelClassWeaver implements IClassWeaver {
                                                        || doesAlreadyHaveAnnotation(annotationHolder, unMangledInterMethod, decaMC, reportedErrors)) {
                                                continue; // skip this one...
                                        }
-                                       annotationHolder.addAnnotation(decaMC.getAnnotationX());
+                                       annotationHolder.addAnnotation(decaMC.getAnnotation());
                                        isChanged = true;
                                        AsmRelationshipProvider.addDeclareAnnotationRelationship(asmManager, decaMC.getSourceLocation(),
                                                        unMangledInterMethod.getSourceLocation());
@@ -1205,8 +1205,8 @@ class BcelClassWeaver implements IClassWeaver {
                                                LazyMethodGen annotationHolder = locateAnnotationHolderForFieldMunger(clazz, methodctorMunger);
                                                if (doesAlreadyHaveAnnotation(annotationHolder, unMangledInterMethod, decaMC, reportedErrors))
                                                        continue; // skip this one...
-                                               annotationHolder.addAnnotation(decaMC.getAnnotationX());
-                                               unMangledInterMethod.addAnnotation(decaMC.getAnnotationX());
+                                               annotationHolder.addAnnotation(decaMC.getAnnotation());
+                                               unMangledInterMethod.addAnnotation(decaMC.getAnnotation());
                                                AsmRelationshipProvider.addDeclareAnnotationRelationship(asmManager, decaMC.getSourceLocation(),
                                                                unMangledInterMethod.getSourceLocation());
                                                isChanged = true;
@@ -1223,7 +1223,7 @@ class BcelClassWeaver implements IClassWeaver {
        private boolean dontAddTwice(DeclareAnnotation decaF, AnnotationAJ[] dontAddMeTwice) {
                for (int i = 0; i < dontAddMeTwice.length; i++) {
                        AnnotationAJ ann = dontAddMeTwice[i];
-                       if (ann != null && decaF.getAnnotationX().getTypeName().equals(ann.getTypeName())) {
+                       if (ann != null && decaF.getAnnotation().getTypeName().equals(ann.getTypeName())) {
                                // dontAddMeTwice[i] = null; // incase it really has been added
                                // twice!
                                return true;
@@ -1284,7 +1284,7 @@ class BcelClassWeaver implements IClassWeaver {
                                        // go through all the declare @field statements
                                        for (Iterator iter = decaFs.iterator(); iter.hasNext();) {
                                                DeclareAnnotation decaF = (DeclareAnnotation) iter.next();
-                                               if (decaF.getAnnotationX() == null) {
+                                               if (decaF.getAnnotation() == null) {
                                                        return false;
                                                }
                                                if (decaF.matches(aBcelField, world)) {
@@ -1298,7 +1298,7 @@ class BcelClassWeaver implements IClassWeaver {
                                                                        continue;
                                                                }
 
-                                                               if (decaF.getAnnotationX().isRuntimeVisible()) { // isAnnotationWithRuntimeRetention
+                                                               if (decaF.getAnnotation().isRuntimeVisible()) { // isAnnotationWithRuntimeRetention
                                                                        // (
                                                                        // clazz
                                                                        // .
@@ -1319,13 +1319,13 @@ class BcelClassWeaver implements IClassWeaver {
                                                                        // myGen.addAnnotation(ag);
                                                                        // Field newField = myGen.getField();
 
-                                                                       aBcelField.addAnnotation(decaF.getAnnotationX());
+                                                                       aBcelField.addAnnotation(decaF.getAnnotation());
                                                                        // clazz.replaceField(fields[fieldCounter],
                                                                        // newField);
                                                                        // fields[fieldCounter]=newField;
 
                                                                } else {
-                                                                       aBcelField.addAnnotation(decaF.getAnnotationX());
+                                                                       aBcelField.addAnnotation(decaF.getAnnotation());
                                                                }
                                                        }
 
@@ -1363,7 +1363,7 @@ class BcelClassWeaver implements IClassWeaver {
                                                                        unusedDecafs.remove(decaF);
                                                                        continue; // skip this one...
                                                                }
-                                                               aBcelField.addAnnotation(decaF.getAnnotationX());
+                                                               aBcelField.addAnnotation(decaF.getAnnotation());
                                                                AsmRelationshipProvider.addDeclareAnnotationFieldRelationship(world.getModelAsAsmManager(), decaF
                                                                                .getSourceLocation(), clazz.getName(), aBcelField);
                                                                isChanged = true;
index de914f7640aec20926462b9b0c872f9080dffc6f..73756ac31ac9fb60b3d716594070f6d7d360128e 100644 (file)
@@ -76,13 +76,12 @@ final class BcelField extends ResolvedMemberImpl {
        private void unpackAttributes(World world) {
                Attribute[] attrs = field.getAttributes();
                if (attrs != null && attrs.length > 0) {
-                       List as = Utility.readAjAttributes(getDeclaringType().getClassName(), attrs, getSourceContext(world), world,
-                                       (bcelObjectType != null ? bcelObjectType.getWeaverVersionAttribute() : WeaverVersionInfo.CURRENT));
+                       List<AjAttribute> as = Utility.readAjAttributes(getDeclaringType().getClassName(), attrs, getSourceContext(world),
+                                       world, (bcelObjectType != null ? bcelObjectType.getWeaverVersionAttribute() : WeaverVersionInfo.CURRENT));
                        as.addAll(AtAjAttributes.readAj5FieldAttributes(field, this, world.resolve(getDeclaringType()),
                                        getSourceContext(world), world.getMessageHandler()));
 
-                       for (Iterator iter = as.iterator(); iter.hasNext();) {
-                               AjAttribute a = (AjAttribute) iter.next();
+                       for (AjAttribute a : as) {
                                if (a instanceof AjAttribute.AjSynthetic) {
                                        isAjSynthetic = true;
                                } else {
index ae6df8f0b0eeb0c43191e6acbd0ee3ef9d5e1de3..5e66b63ea26fd4d3cced8b55dec036ece5b0e6c3 100644 (file)
@@ -104,6 +104,7 @@ class BcelMethod extends ResolvedMemberImpl {
 
        }
 
+       @Override
        public String[] getParameterNames() {
                determineParameterNames();
                return super.getParameterNames();
@@ -140,13 +141,12 @@ class BcelMethod extends ResolvedMemberImpl {
                                                                || typename.startsWith("org.aspectj.lang.annotation.After")) {
                                                        AnnotationGen a = ((BcelAnnotation) annotationX).getBcelAnnotation();
                                                        if (a != null) {
-                                                               List values = a.getValues();
-                                                               for (Iterator iterator = values.iterator(); iterator.hasNext();) {
-                                                                       ElementNameValuePairGen nvPair = (ElementNameValuePairGen) iterator.next();
+                                                               List<ElementNameValuePairGen> values = a.getValues();
+                                                               for (ElementNameValuePairGen nvPair : values) {
                                                                        if (nvPair.getNameString().equals("argNames")) {
                                                                                String argNames = nvPair.getValue().stringifyValue();
                                                                                StringTokenizer argNameTokenizer = new StringTokenizer(argNames, " ,");
-                                                                               List argsList = new ArrayList();
+                                                                               List<String> argsList = new ArrayList<String>();
                                                                                while (argNameTokenizer.hasMoreTokens()) {
                                                                                        argsList.add(argNameTokenizer.nextToken());
                                                                                }
@@ -154,7 +154,7 @@ class BcelMethod extends ResolvedMemberImpl {
                                                                                while (argsList.size() < requiredCount) {
                                                                                        argsList.add("arg" + argsList.size());
                                                                                }
-                                                                               setParameterNames((String[]) argsList.toArray(new String[] {}));
+                                                                               setParameterNames(argsList.toArray(new String[] {}));
                                                                                return;
                                                                        }
                                                                }
@@ -236,6 +236,7 @@ class BcelMethod extends ResolvedMemberImpl {
        // return null;
        // }
 
+       @Override
        public String getAnnotationDefaultValue() {
                Attribute[] attrs = method.getAttributes();
                for (int i = 0; i < attrs.length; i++) {
@@ -251,25 +252,29 @@ class BcelMethod extends ResolvedMemberImpl {
        // for testing - use with the method above
        public String[] getAttributeNames(boolean onlyIncludeAjOnes) {
                Attribute[] as = method.getAttributes();
-               List names = new ArrayList();
+               List<String> names = new ArrayList<String>();
                // String[] strs = new String[as.length];
                for (int j = 0; j < as.length; j++) {
-                       if (!onlyIncludeAjOnes || as[j].getName().startsWith(AjAttribute.AttributePrefix))
+                       if (!onlyIncludeAjOnes || as[j].getName().startsWith(AjAttribute.AttributePrefix)) {
                                names.add(as[j].getName());
+                       }
                }
-               return (String[]) names.toArray(new String[] {});
+               return names.toArray(new String[] {});
        }
 
+       @Override
        public boolean isAjSynthetic() {
                return (bitflags & IS_AJ_SYNTHETIC) != 0;
        }
 
        // FIXME ??? needs an isSynthetic method
 
+       @Override
        public ShadowMunger getAssociatedShadowMunger() {
                return associatedShadowMunger;
        }
 
+       @Override
        public AjAttribute.EffectiveSignatureAttribute getEffectiveSignature() {
                return effectiveSignature;
        }
@@ -294,6 +299,7 @@ class BcelMethod extends ResolvedMemberImpl {
                }
        }
 
+       @Override
        public ISourceLocation getSourceLocation() {
                ISourceLocation ret = super.getSourceLocation();
                if ((ret == null || ret.getLine() == 0) && hasDeclarationLineNumberInfo()) {
@@ -307,6 +313,7 @@ class BcelMethod extends ResolvedMemberImpl {
                return ret;
        }
 
+       @Override
        public MemberKind getKind() {
                if (associatedShadowMunger != null) {
                        return ADVICE;
@@ -315,6 +322,7 @@ class BcelMethod extends ResolvedMemberImpl {
                }
        }
 
+       @Override
        public boolean hasAnnotation(UnresolvedType ofType) {
                ensureAnnotationsRetrieved();
                for (Iterator iter = annotationTypes.iterator(); iter.hasNext();) {
@@ -325,6 +333,7 @@ class BcelMethod extends ResolvedMemberImpl {
                return false;
        }
 
+       @Override
        public AnnotationAJ[] getAnnotations() {
                ensureAnnotationsRetrieved();
                if ((bitflags & HAS_ANNOTATIONS) != 0) {
@@ -334,6 +343,7 @@ class BcelMethod extends ResolvedMemberImpl {
                }
        }
 
+       @Override
        public ResolvedType[] getAnnotationTypes() {
                ensureAnnotationsRetrieved();
                ResolvedType[] ret = new ResolvedType[annotationTypes.size()];
@@ -341,6 +351,7 @@ class BcelMethod extends ResolvedMemberImpl {
                return ret;
        }
 
+       @Override
        public AnnotationAJ getAnnotationOfType(UnresolvedType ofType) {
                ensureAnnotationsRetrieved();
                if ((bitflags & HAS_ANNOTATIONS) == 0)
@@ -352,6 +363,7 @@ class BcelMethod extends ResolvedMemberImpl {
                return null;
        }
 
+       @Override
        public void addAnnotation(AnnotationAJ annotation) {
                ensureAnnotationsRetrieved();
                if ((bitflags & HAS_ANNOTATIONS) == 0) {
@@ -448,11 +460,13 @@ class BcelMethod extends ResolvedMemberImpl {
                }
        }
 
+       @Override
        public AnnotationAJ[][] getParameterAnnotations() {
                ensureParameterAnnotationsRetrieved();
                return parameterAnnotations;
        }
 
+       @Override
        public ResolvedType[][] getParameterAnnotationTypes() {
                ensureParameterAnnotationsRetrieved();
                return parameterAnnotationTypes;
@@ -462,11 +476,13 @@ class BcelMethod extends ResolvedMemberImpl {
         * A method can be parameterized if it has one or more generic parameters. A generic parameter (type variable parameter) is
         * identified by the prefix "T"
         */
+       @Override
        public boolean canBeParameterized() {
                unpackGenericSignature();
                return (bitflags & CAN_BE_PARAMETERIZED) != 0;
        }
 
+       @Override
        public UnresolvedType[] getGenericParameterTypes() {
                unpackGenericSignature();
                return genericParameterTypes;
@@ -475,6 +491,7 @@ class BcelMethod extends ResolvedMemberImpl {
        /**
         * Return the parameterized/generic return type or the normal return type if the method is not generic.
         */
+       @Override
        public UnresolvedType getGenericReturnType() {
                unpackGenericSignature();
                return genericReturnType;
@@ -556,6 +573,7 @@ class BcelMethod extends ResolvedMemberImpl {
                }
        }
 
+       @Override
        public void evictWeavingState() {
                if (method != null) {
                        unpackGenericSignature();
@@ -568,6 +586,7 @@ class BcelMethod extends ResolvedMemberImpl {
                }
        }
 
+       @Override
        public boolean isSynthetic() {
                if ((bitflags & KNOW_IF_SYNTHETIC) == 0) {
                        workOutIfSynthetic();
@@ -613,6 +632,7 @@ class BcelMethod extends ResolvedMemberImpl {
        // which proved expensive. Currently used within
        // CrosscuttingMembers.replaceWith() to decide if we need
        // to do a full build
+       @Override
        public boolean isEquivalentTo(Object other) {
                if (!(other instanceof BcelMethod))
                        return false;
@@ -626,6 +646,7 @@ class BcelMethod extends ResolvedMemberImpl {
         * 
         * @return true if this BcelMethod represents the default constructor
         */
+       @Override
        public boolean isDefaultConstructor() {
                boolean mightBe = !hasDeclarationLineNumberInfo() && name.equals("<init>") && parameterTypes.length == 0;
                if (mightBe) {
index f6e46ad97f192350ff10c5ae200afd1896455887..09032998094d39a261c4eb5bc46dd5123586a276 100644 (file)
@@ -41,6 +41,7 @@ import org.aspectj.weaver.AnnotationAJ;
 import org.aspectj.weaver.AnnotationTargetKind;
 import org.aspectj.weaver.BCException;
 import org.aspectj.weaver.BindingScope;
+import org.aspectj.weaver.ConcreteTypeMunger;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.ReferenceType;
 import org.aspectj.weaver.ResolvedMember;
@@ -84,8 +85,8 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate {
        private ResolvedMember[] privilegedAccess = null;
        private WeaverStateInfo weaverState = null;
        private PerClause perClause = null;
-       private List typeMungers = Collections.EMPTY_LIST;
-       private List declares = Collections.EMPTY_LIST;
+       private List<ConcreteTypeMunger> typeMungers = Collections.emptyList();
+       private List<Declare> declares = Collections.emptyList();
 
        private GenericSignature.FormalTypeParameter[] formalsForResolution = null;
        private String declaredSignature = null;
@@ -354,7 +355,7 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate {
                bitflag |= UNPACKED_AJATTRIBUTES;
                IMessageHandler msgHandler = getResolvedTypeX().getWorld().getMessageHandler();
                // Pass in empty list that can store things for readAj5 to process
-               List l = Utility.readAjAttributes(className, javaClass.getAttributes(), getResolvedTypeX().getSourceContext(),
+               List<AjAttribute> l = Utility.readAjAttributes(className, javaClass.getAttributes(), getResolvedTypeX().getSourceContext(),
                                getResolvedTypeX().getWorld(), AjAttribute.WeaverVersionInfo.UNKNOWN);
                List pointcuts = new ArrayList();
                typeMungers = new ArrayList();
@@ -383,11 +384,10 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate {
 
        }
 
-       private AjAttribute.Aspect processAttributes(List attributeList, List pointcuts, boolean fromAnnotations) {
+       private AjAttribute.Aspect processAttributes(List<AjAttribute> attributeList, List<ResolvedPointcutDefinition> pointcuts,
+                       boolean fromAnnotations) {
                AjAttribute.Aspect deferredAspectAttribute = null;
-               for (Iterator iter = attributeList.iterator(); iter.hasNext();) {
-                       AjAttribute a = (AjAttribute) iter.next();
-                       // System.err.println("unpacking: " + this + " and " + a);
+               for (AjAttribute a : attributeList) {
                        if (a instanceof AjAttribute.Aspect) {
                                if (fromAnnotations) {
                                        deferredAspectAttribute = (AjAttribute.Aspect) a;
@@ -629,16 +629,15 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate {
                bitflag |= DISCOVERED_ANNOTATION_TARGET_KINDS;
                annotationTargetKinds = null; // null means we have no idea or the
                // @Target annotation hasn't been used
-               List targetKinds = new ArrayList();
+               List<AnnotationTargetKind> targetKinds = new ArrayList<AnnotationTargetKind>();
                if (isAnnotation()) {
                        AnnotationAJ[] annotationsOnThisType = getAnnotations();
                        for (int i = 0; i < annotationsOnThisType.length; i++) {
                                AnnotationAJ a = annotationsOnThisType[i];
                                if (a.getTypeName().equals(UnresolvedType.AT_TARGET.getName())) {
-                                       Set targets = a.getTargets();
+                                       Set<String> targets = a.getTargets();
                                        if (targets != null) {
-                                               for (Iterator iterator = targets.iterator(); iterator.hasNext();) {
-                                                       String targetKind = (String) iterator.next();
+                                               for (String targetKind : targets) {
                                                        if (targetKind.equals("ANNOTATION_TYPE")) {
                                                                targetKinds.add(AnnotationTargetKind.ANNOTATION_TYPE);
                                                        } else if (targetKind.equals("CONSTRUCTOR")) {
@@ -662,7 +661,7 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate {
                        }
                        if (!targetKinds.isEmpty()) {
                                annotationTargetKinds = new AnnotationTargetKind[targetKinds.size()];
-                               return (AnnotationTargetKind[]) targetKinds.toArray(annotationTargetKinds);
+                               return targetKinds.toArray(annotationTargetKinds);
                        }
                }
                return annotationTargetKinds;
index 92b394ea879f3cd78ad0a300606b9813f4c8c79d..3697a40084ccf056a771c5cc0bc11c233b70aebc 100644 (file)
@@ -150,12 +150,12 @@ public class BcelShadow extends Shadow {
        public BcelShadow copyInto(LazyMethodGen recipient, BcelShadow enclosing) {
                BcelShadow s = new BcelShadow(world, getKind(), getSignature(), recipient, enclosing);
                if (mungers.size() > 0) {
-                       List src = mungers;
-                       if (s.mungers == Collections.EMPTY_LIST)
-                               s.mungers = new ArrayList();
-                       List dest = s.mungers;
-
-                       for (Iterator i = src.iterator(); i.hasNext();) {
+                       List<ShadowMunger> src = mungers;
+                       if (s.mungers == Collections.EMPTY_LIST) {
+                               s.mungers = new ArrayList<ShadowMunger>();
+                       }
+                       List<ShadowMunger> dest = s.mungers;
+                       for (Iterator<ShadowMunger> i = src.iterator(); i.hasNext();) {
                                dest.add(i.next());
                        }
                }
@@ -278,11 +278,11 @@ public class BcelShadow extends Shadow {
        }
 
        // records advice that is stopping us doing the lazyTjp optimization
-       private List badAdvice = null;
+       private List<BcelAdvice> badAdvice = null;
 
        public void addAdvicePreventingLazyTjp(BcelAdvice advice) {
                if (badAdvice == null)
-                       badAdvice = new ArrayList();
+                       badAdvice = new ArrayList<BcelAdvice>();
                badAdvice.add(advice);
        }
 
@@ -348,8 +348,8 @@ public class BcelShadow extends Shadow {
                        // something stopped us making it a lazy tjp
                        // can't build tjp lazily, no suitable test...
                        int valid = 0;
-                       for (Iterator iter = badAdvice.iterator(); iter.hasNext();) {
-                               BcelAdvice element = (BcelAdvice) iter.next();
+                       for (Iterator<BcelAdvice> iter = badAdvice.iterator(); iter.hasNext();) {
+                               BcelAdvice element = iter.next();
                                ISourceLocation sLoc = element.getSourceLocation();
                                if (sLoc != null && sLoc.getLine() > 0)
                                        valid++;
@@ -357,8 +357,8 @@ public class BcelShadow extends Shadow {
                        if (valid != 0) {
                                ISourceLocation[] badLocs = new ISourceLocation[valid];
                                int i = 0;
-                               for (Iterator iter = badAdvice.iterator(); iter.hasNext();) {
-                                       BcelAdvice element = (BcelAdvice) iter.next();
+                               for (Iterator<BcelAdvice> iter = badAdvice.iterator(); iter.hasNext();) {
+                                       BcelAdvice element = iter.next();
                                        ISourceLocation sLoc = element.getSourceLocation();
                                        if (sLoc != null)
                                                badLocs[i++] = sLoc;
@@ -854,12 +854,12 @@ public class BcelShadow extends Shadow {
        private BcelVar thisVar = null;
        private BcelVar targetVar = null;
        private BcelVar[] argVars = null;
-       private Map/* <UnresolvedType,BcelVar> */kindedAnnotationVars = null;
-       private Map/* <UnresolvedType,BcelVar> */thisAnnotationVars = null;
-       private Map/* <UnresolvedType,BcelVar> */targetAnnotationVars = null;
+       private Map/* <UnresolvedType,BcelVar> */<ResolvedType, AnnotationAccessVar> kindedAnnotationVars = null;
+       private Map/* <UnresolvedType,BcelVar> */<ResolvedType, TypeAnnotationAccessVar> thisAnnotationVars = null;
+       private Map/* <UnresolvedType,BcelVar> */<ResolvedType, TypeAnnotationAccessVar> targetAnnotationVars = null;
        private Map/* <UnresolvedType,BcelVar> */[] argAnnotationVars = null;
-       private Map/* <UnresolvedType,BcelVar> */withinAnnotationVars = null;
-       private Map/* <UnresolvedType,BcelVar> */withincodeAnnotationVars = null;
+       private Map/* <UnresolvedType,BcelVar> */<ResolvedType, AnnotationAccessVar> withinAnnotationVars = null;
+       private Map/* <UnresolvedType,BcelVar> */<ResolvedType, AnnotationAccessVar> withincodeAnnotationVars = null;
        private boolean allArgVarsInitialized = false;
 
        public Var getThisVar() {
@@ -876,7 +876,7 @@ public class BcelShadow extends Shadow {
                }
                initializeThisAnnotationVars(); // FIXME asc Why bother with this if we always return one?
                // Even if we can't find one, we have to return one as we might have this annotation at runtime
-               Var v = (Var) thisAnnotationVars.get(forAnnotationType);
+               Var v = thisAnnotationVars.get(forAnnotationType);
                if (v == null)
                        v = new TypeAnnotationAccessVar(forAnnotationType.resolve(world), (BcelVar) getThisVar());
                return v;
@@ -895,7 +895,7 @@ public class BcelShadow extends Shadow {
                        throw new IllegalStateException("no target");
                }
                initializeTargetAnnotationVars(); // FIXME asc why bother with this if we always return one?
-               Var v = (Var) targetAnnotationVars.get(forAnnotationType);
+               Var v = targetAnnotationVars.get(forAnnotationType);
                // Even if we can't find one, we have to return one as we might have this annotation at runtime
                if (v == null)
                        v = new TypeAnnotationAccessVar(forAnnotationType.resolve(world), (BcelVar) getTargetVar());
@@ -918,17 +918,17 @@ public class BcelShadow extends Shadow {
 
        public Var getKindedAnnotationVar(UnresolvedType forAnnotationType) {
                initializeKindedAnnotationVars();
-               return (Var) kindedAnnotationVars.get(forAnnotationType);
+               return kindedAnnotationVars.get(forAnnotationType);
        }
 
        public Var getWithinAnnotationVar(UnresolvedType forAnnotationType) {
                initializeWithinAnnotationVars();
-               return (Var) withinAnnotationVars.get(forAnnotationType);
+               return withinAnnotationVars.get(forAnnotationType);
        }
 
        public Var getWithinCodeAnnotationVar(UnresolvedType forAnnotationType) {
                initializeWithinCodeAnnotationVars();
-               return (Var) withincodeAnnotationVars.get(forAnnotationType);
+               return withincodeAnnotationVars.get(forAnnotationType);
        }
 
        // reflective thisJoinPoint support
@@ -1382,7 +1382,7 @@ public class BcelShadow extends Shadow {
        public void initializeThisAnnotationVars() {
                if (thisAnnotationVars != null)
                        return;
-               thisAnnotationVars = new HashMap();
+               thisAnnotationVars = new HashMap<ResolvedType, TypeAnnotationAccessVar>();
                // populate..
        }
 
@@ -1394,7 +1394,7 @@ public class BcelShadow extends Shadow {
                                initializeThisAnnotationVars();
                        targetAnnotationVars = thisAnnotationVars;
                } else {
-                       targetAnnotationVars = new HashMap();
+                       targetAnnotationVars = new HashMap<ResolvedType, TypeAnnotationAccessVar>();
                        ResolvedType[] rtx = this.getTargetType().resolve(world).getAnnotationTypes(); // what about annotations we havent
                        // gotten yet but we will get in
                        // subclasses?
@@ -1429,9 +1429,8 @@ public class BcelShadow extends Shadow {
                }
 
                // check the ITD'd dooberries
-               List mungers = relevantType.resolve(world).getInterTypeMungers();
-               for (Iterator iter = mungers.iterator(); iter.hasNext();) {
-                       ConcreteTypeMunger typeMunger = (ConcreteTypeMunger) iter.next();
+               List<ConcreteTypeMunger> mungers = relevantType.resolve(world).getInterTypeMungers();
+               for (ConcreteTypeMunger typeMunger : mungers) {
                        if (typeMunger.getMunger() instanceof NewMethodTypeMunger || typeMunger.getMunger() instanceof NewConstructorTypeMunger) {
                                ResolvedMember fakerm = typeMunger.getSignature();
                                if (fakerm.getName().equals(getSignature().getName())
@@ -1440,6 +1439,13 @@ public class BcelShadow extends Shadow {
                                                foundMember = AjcMemberMaker.interConstructor(relevantType, foundMember, typeMunger.getAspectType());
                                        } else {
                                                foundMember = AjcMemberMaker.interMethod(foundMember, typeMunger.getAspectType(), false);
+                               //              ResolvedMember o = AjcMemberMaker.interMethodBody(fakerm, typeMunger.getAspectType());
+                               //              // Object os = o.getAnnotations();
+                               //              ResolvedMember foundMember2 = findMethod(typeMunger.getAspectType(), o);
+                               //              Object os2 = foundMember2.getAnnotations();
+                               //              int stop = 1;
+                               //              foundMember = foundMember2;
+                                               // foundMember = AjcMemberMaker.interMethod(foundMember, typeMunger.getAspectType());
                                        }
                                        // in the above.. what about if it's on an Interface? Can that happen?
                                        // then the last arg of the above should be true
@@ -1453,8 +1459,8 @@ public class BcelShadow extends Shadow {
        protected ResolvedType[] getAnnotations(ResolvedMember foundMember, Member relevantMember, ResolvedType relevantType) {
                if (foundMember == null) {
                        // check the ITD'd dooberries
-                       List mungers = relevantType.resolve(world).getInterTypeMungers();
-                       for (Iterator iter = mungers.iterator(); iter.hasNext();) {
+                       List<ConcreteTypeMunger> mungers = relevantType.resolve(world).getInterTypeMungers();
+                       for (Iterator<ConcreteTypeMunger> iter = mungers.iterator(); iter.hasNext();) {
                                Object munger = iter.next();
                                ConcreteTypeMunger typeMunger = (ConcreteTypeMunger) munger;
                                if (typeMunger.getMunger() instanceof NewMethodTypeMunger
@@ -1493,7 +1499,7 @@ public class BcelShadow extends Shadow {
                if (kindedAnnotationVars != null) {
                        return;
                }
-               kindedAnnotationVars = new HashMap();
+               kindedAnnotationVars = new HashMap<ResolvedType, AnnotationAccessVar>();
 
                ResolvedType[] annotations = null;
                Member shadowSignature = getSignature();
@@ -1517,9 +1523,10 @@ public class BcelShadow extends Shadow {
 
                        if (annotationHolder == null) {
                                // check the ITD'd dooberries
-                               List mungers = relevantType.resolve(world).getInterTypeMungers();
-                               for (Iterator iter = mungers.iterator(); iter.hasNext();) {
-                                       BcelTypeMunger typeMunger = (BcelTypeMunger) iter.next();
+                               List<BcelTypeMunger> mungers = relevantType.resolve(world).getInterTypeMungers();
+                               for (BcelTypeMunger typeMunger : mungers) {
+                                       // for (Iterator<ConcreteTypeMunger> iter = mungers.iterator(); iter.hasNext();) {
+                                       // BcelTypeMunger typeMunger = (BcelTypeMunger) iter.next();
                                        if (typeMunger.getMunger() instanceof NewFieldTypeMunger) {
                                                ResolvedMember fakerm = typeMunger.getSignature();
                                                // if (fakerm.hasAnnotations())
@@ -1536,12 +1543,12 @@ public class BcelShadow extends Shadow {
 
                } else if (getKind() == Shadow.MethodExecution || getKind() == Shadow.ConstructorExecution
                                || getKind() == Shadow.AdviceExecution) {
-                       // ResolvedMember rm[] = relevantType.getDeclaredMethods();
-                       ResolvedMember foundMember = findMethod2(relevantType.getDeclaredMethods(), getSignature());
 
+                       ResolvedMember foundMember = findMethod2(relevantType.getDeclaredMethods(), getSignature());
                        annotations = getAnnotations(foundMember, shadowSignature, relevantType);
-                       annotationHolder = foundMember;
                        annotationHolder = getRelevantMember(foundMember, annotationHolder, relevantType);
+                       UnresolvedType ut = annotationHolder.getDeclaringType();
+                       relevantType = ut.resolve(world);
 
                } else if (getKind() == Shadow.ExceptionHandler) {
                        relevantType = getSignature().getParameterTypes()[0].resolve(world);
@@ -1557,24 +1564,22 @@ public class BcelShadow extends Shadow {
                        throw new BCException("Could not discover annotations for shadow: " + getKind());
                }
 
-               for (int i = 0; i < annotations.length; i++) {
-                       ResolvedType annotationType = annotations[i];
+               for (ResolvedType annotationType : annotations) {
                        AnnotationAccessVar accessVar = new AnnotationAccessVar(getKind(), annotationType.resolve(world), relevantType,
                                        annotationHolder);
                        kindedAnnotationVars.put(annotationType, accessVar);
                }
        }
 
-       // FIXME asc whats the real diff between this one and the version in findMethod()?
-       ResolvedMember findMethod2(ResolvedMember rm[], Member sig) {
-               ResolvedMember found = null;
-               // String searchString = getSignature().getName()+getSignature().getParameterSignature();
-               for (int i = 0; i < rm.length && found == null; i++) {
-                       ResolvedMember member = rm[i];
-                       if (member.getName().equals(sig.getName()) && member.getParameterSignature().equals(sig.getParameterSignature()))
-                               found = member;
+       private ResolvedMember findMethod2(ResolvedMember members[], Member sig) {
+               String signatureName = sig.getName();
+               String parameterSignature = sig.getParameterSignature();
+               for (ResolvedMember member : members) {
+                       if (member.getName().equals(signatureName) && member.getParameterSignature().equals(parameterSignature)) {
+                               return member;
+                       }
                }
-               return found;
+               return null;
        }
 
        private ResolvedMember findMethod(ResolvedType aspectType, ResolvedMember ajcMethod) {
@@ -1600,7 +1605,7 @@ public class BcelShadow extends Shadow {
        public void initializeWithinAnnotationVars() {
                if (withinAnnotationVars != null)
                        return;
-               withinAnnotationVars = new HashMap();
+               withinAnnotationVars = new HashMap<ResolvedType, AnnotationAccessVar>();
 
                ResolvedType[] annotations = getEnclosingType().resolve(world).getAnnotationTypes();
                for (int i = 0; i < annotations.length; i++) {
@@ -1613,7 +1618,7 @@ public class BcelShadow extends Shadow {
        public void initializeWithinCodeAnnotationVars() {
                if (withincodeAnnotationVars != null)
                        return;
-               withincodeAnnotationVars = new HashMap();
+               withincodeAnnotationVars = new HashMap<ResolvedType, AnnotationAccessVar>();
 
                // For some shadow we are interested in annotations on the method containing that shadow.
                ResolvedType[] annotations = getEnclosingMethod().getMemberView().getAnnotationTypes();
@@ -1647,7 +1652,7 @@ public class BcelShadow extends Shadow {
         * We also need to bind the return value into a returning parameter, if the advice specified one.
         */
        public void weaveAfterReturning(BcelAdvice munger) {
-               List returns = findReturnInstructions();
+               List<InstructionHandle> returns = findReturnInstructions();
                boolean hasReturnInstructions = !returns.isEmpty();
 
                // list of instructions that handle the actual return from the join point
@@ -1668,8 +1673,8 @@ public class BcelShadow extends Shadow {
 
                if (hasReturnInstructions) {
                        InstructionHandle gotoTarget = advice.getStart();
-                       for (Iterator i = returns.iterator(); i.hasNext();) {
-                               InstructionHandle ih = (InstructionHandle) i.next();
+                       for (Iterator<InstructionHandle> i = returns.iterator(); i.hasNext();) {
+                               InstructionHandle ih = i.next();
                                retargetReturnInstruction(munger.hasExtraParameter(), returnValueVar, gotoTarget, ih);
                        }
                }
@@ -1681,8 +1686,8 @@ public class BcelShadow extends Shadow {
        /**
         * @return a list of all the return instructions in the range of this shadow
         */
-       private List findReturnInstructions() {
-               List returns = new ArrayList();
+       private List<InstructionHandle> findReturnInstructions() {
+               List<InstructionHandle> returns = new ArrayList<InstructionHandle>();
                for (InstructionHandle ih = range.getStart(); ih != range.getEnd(); ih = ih.getNext()) {
                        if (ih.getInstruction().isReturnInstruction()) {
                                returns.add(ih);
@@ -1705,7 +1710,7 @@ public class BcelShadow extends Shadow {
         * @param returnInstructions instruction list into which the return instructions should be generated
         * @return the variable holding the return value, if needed
         */
-       private BcelVar generateReturnInstructions(List returns, InstructionList returnInstructions) {
+       private BcelVar generateReturnInstructions(List<InstructionHandle> returns, InstructionList returnInstructions) {
                BcelVar returnValueVar = null;
                if (this.hasANonVoidReturnType()) {
                        // Find the last *correct* return - this is a method with a non-void return type
@@ -1713,7 +1718,7 @@ public class BcelShadow extends Shadow {
                        Instruction newReturnInstruction = null;
                        int i = returns.size() - 1;
                        while (newReturnInstruction == null && i >= 0) {
-                               InstructionHandle ih = (InstructionHandle) returns.get(i);
+                               InstructionHandle ih = returns.get(i);
                                if (ih.getInstruction().opcode != Constants.RETURN) {
                                        newReturnInstruction = Utility.copyInstruction(ih.getInstruction());
                                }
@@ -1723,7 +1728,7 @@ public class BcelShadow extends Shadow {
                        returnValueVar.appendLoad(returnInstructions, getFactory());
                        returnInstructions.append(newReturnInstruction);
                } else {
-                       InstructionHandle lastReturnHandle = (InstructionHandle) returns.get(returns.size() - 1);
+                       InstructionHandle lastReturnHandle = returns.get(returns.size() - 1);
                        Instruction newReturnInstruction = Utility.copyInstruction(lastReturnHandle.getInstruction());
                        returnInstructions.append(newReturnInstruction);
                }
@@ -2137,12 +2142,12 @@ public class BcelShadow extends Shadow {
                // Parameters are: this if there is one, target if there is one and its different to this, then original arguments
                // at the shadow, then tjp
                String extractedShadowMethodName = NameMangler.aroundShadowMethodName(getSignature(), shadowClass.getNewGeneratedNameTag());
-               List parameterNames = new ArrayList();
+               List<String> parameterNames = new ArrayList<String>();
                LazyMethodGen extractedShadowMethod = extractShadowInstructionsIntoNewMethod(extractedShadowMethodName, Modifier.PRIVATE,
                                munger.getSourceLocation(), parameterNames);
 
-               List argsToCallLocalAdviceMethodWith = new ArrayList();
-               List proceedVarList = new ArrayList();
+               List<BcelVar> argsToCallLocalAdviceMethodWith = new ArrayList<BcelVar>();
+               List<BcelVar> proceedVarList = new ArrayList<BcelVar>();
                int extraParamOffset = 0;
 
                // Create the extra parameters that are needed for passing to proceed
@@ -2235,8 +2240,8 @@ public class BcelShadow extends Shadow {
                InstructionList advice = new InstructionList();
                // InstructionHandle adviceMethodInvocation;
                {
-                       for (Iterator i = argsToCallLocalAdviceMethodWith.iterator(); i.hasNext();) {
-                               BcelVar var = (BcelVar) i.next();
+                       for (Iterator<BcelVar> i = argsToCallLocalAdviceMethodWith.iterator(); i.hasNext();) {
+                               BcelVar var = i.next();
                                var.appendLoad(advice, fact);
                        }
                        // ??? we don't actually need to push NULL for the closure if we take care
@@ -2355,7 +2360,7 @@ public class BcelShadow extends Shadow {
                                // no parameter names specified
                                argumentName = new StringBuffer("unknown").append(argNumber).toString();
                        } else {
-                               argumentName = (String) parameterNames.get(argNumber);
+                               argumentName = parameterNames.get(argNumber);
                        }
                        String argumentSignature = args[argNumber].getSignature();
                        LocalVariableTag lvt = new LocalVariableTag(argumentSignature, argumentName, slot, 0);
@@ -2366,7 +2371,7 @@ public class BcelShadow extends Shadow {
        }
 
        private InstructionList getRedoneProceedCall(InstructionFactory fact, LazyMethodGen callbackMethod, BcelAdvice munger,
-                       LazyMethodGen localAdviceMethod, List argVarList) {
+                       LazyMethodGen localAdviceMethod, List<BcelVar> argVarList) {
                InstructionList ret = new InstructionList();
                // we have on stack all the arguments for the ADVICE call.
                // we have in frame somewhere all the arguments for the non-advice call.
@@ -2399,7 +2404,7 @@ public class BcelShadow extends Shadow {
                                // throw new RuntimeException("unimplemented");
                                proceedVars[proceedMap.get(i)].appendLoadAndConvert(ret, fact, stateTypeX);
                        } else {
-                               ((BcelVar) argVarList.get(i)).appendLoad(ret, fact);
+                               argVarList.get(i).appendLoad(ret, fact);
                        }
                }
 
@@ -2454,7 +2459,7 @@ public class BcelShadow extends Shadow {
         * 
         */
        private InstructionList getRedoneProceedCallForAnnotationStyle(InstructionFactory fact, LazyMethodGen callbackMethod,
-                       BcelAdvice munger, LazyMethodGen localAdviceMethod, List argVarList, boolean isProceedWithArgs) {
+                       BcelAdvice munger, LazyMethodGen localAdviceMethod, List<BcelVar> argVarList, boolean isProceedWithArgs) {
                InstructionList ret = new InstructionList();
 
                // store the Object[] array on stack if proceed with args
@@ -2733,7 +2738,7 @@ public class BcelShadow extends Shadow {
                int linenumber = getSourceLine();
                // MOVE OUT ALL THE INSTRUCTIONS IN MY SHADOW INTO ANOTHER METHOD!
                LazyMethodGen callbackMethod = extractShadowInstructionsIntoNewMethod(NameMangler.aroundShadowMethodName(getSignature(),
-                               getEnclosingClass().getNewGeneratedNameTag()), 0, munger.getSourceLocation(), new ArrayList());
+                               getEnclosingClass().getNewGeneratedNameTag()), 0, munger.getSourceLocation(), new ArrayList<String>());
 
                BcelVar[] adviceVars = munger.getExposedStateAsBcelVars(true);
 
@@ -3016,7 +3021,7 @@ public class BcelShadow extends Shadow {
         * @param adviceSourceLocation source location of the advice affecting the shadow
         */
        LazyMethodGen extractShadowInstructionsIntoNewMethod(String extractedMethodName, int extractedMethodVisibilityModifier,
-                       ISourceLocation adviceSourceLocation, List parameterNames) {
+                       ISourceLocation adviceSourceLocation, List<String> parameterNames) {
                // LazyMethodGen.assertGoodBody(range.getBody(), extractedMethodName);
                if (!getKind().allowsExtraction()) {
                        throw new BCException("Attempt to extract method from a shadow kind (" + getKind()
@@ -3121,7 +3126,7 @@ public class BcelShadow extends Shadow {
         * The new method always static. It may take some extra arguments: this, target. If it's argsOnStack, then it must take both
         * this/target If it's argsOnFrame, it shares this and target. ??? rewrite this to do less array munging, please
         */
-       private LazyMethodGen createShadowMethodGen(String newMethodName, int visibilityModifier, List parameterNames) {
+       private LazyMethodGen createShadowMethodGen(String newMethodName, int visibilityModifier, List<String> parameterNames) {
                Type[] shadowParameterTypes = BcelWorld.makeBcelTypes(getArgTypes());
                int modifiers = Modifier.FINAL | Modifier.STATIC | visibilityModifier;
                if (targetVar != null && targetVar != thisVar) {
index a19e2a9f59832b08881a2841e7187ec1d3cd1b4d..a8ae808e2fe1e0c86a4abe11ed91e5e1556f0c9b 100644 (file)
@@ -109,8 +109,8 @@ public class BcelWeaver {
 
        // private Map /*String,UnwovenClassFile*/sourceJavaClasses = new HashMap();
        // private Map /*String,UnwovenClassFile*/resources = new HashMap();
-       private transient List /* UnwovenClassFile */addedClasses = new ArrayList();
-       private transient List /* String */deletedTypenames = new ArrayList();
+       private transient List<UnwovenClassFile> addedClasses = new ArrayList<UnwovenClassFile>();
+       private transient List<String> deletedTypenames = new ArrayList<String>();
        private transient List shadowMungerList = null; // setup by prepareForWeave
        private transient List typeMungerList = null; // setup by prepareForWeave
        private transient List lateTypeMungerList = null; // setup by prepareForWeave
@@ -233,22 +233,22 @@ public class BcelWeaver {
         * @throws IOException
         */
        public void addLibraryJarFile(File inFile) throws IOException {
-               List addedAspects = null;
+               List<ResolvedType> addedAspects = null;
                if (inFile.isDirectory()) {
                        addedAspects = addAspectsFromDirectory(inFile);
                } else {
                        addedAspects = addAspectsFromJarFile(inFile);
                }
 
-               for (Iterator i = addedAspects.iterator(); i.hasNext();) {
-                       ResolvedType aspectX = (ResolvedType) i.next();
+               for (Iterator<ResolvedType> i = addedAspects.iterator(); i.hasNext();) {
+                       ResolvedType aspectX = i.next();
                        xcutSet.addOrReplaceAspect(aspectX);
                }
        }
 
-       private List addAspectsFromJarFile(File inFile) throws FileNotFoundException, IOException {
+       private List<ResolvedType> addAspectsFromJarFile(File inFile) throws FileNotFoundException, IOException {
                ZipInputStream inStream = new ZipInputStream(new FileInputStream(inFile)); // ??? buffered
-               List addedAspects = new ArrayList();
+               List<ResolvedType> addedAspects = new ArrayList<ResolvedType>();
                try {
                        while (true) {
                                ZipEntry entry = inStream.getNextEntry();
@@ -278,8 +278,8 @@ public class BcelWeaver {
                return addedAspects;
        }
 
-       private List addAspectsFromDirectory(File dir) throws FileNotFoundException, IOException {
-               List addedAspects = new ArrayList();
+       private List<ResolvedType> addAspectsFromDirectory(File dir) throws FileNotFoundException, IOException {
+               List<ResolvedType> addedAspects = new ArrayList<ResolvedType>();
                File[] classFiles = FileUtil.listFiles(dir, new FileFilter() {
 
                        public boolean accept(File pathname) {
@@ -296,7 +296,7 @@ public class BcelWeaver {
                return addedAspects;
        }
 
-       private void addIfAspect(byte[] bytes, String name, List toList, File dir) throws IOException {
+       private void addIfAspect(byte[] bytes, String name, List<ResolvedType> toList, File dir) throws IOException {
                ClassParser parser = new ClassParser(new ByteArrayInputStream(bytes), name);
                JavaClass jc = parser.parse();
                ResolvedType type = world.addSourceObjectType(jc).getResolvedTypeX();
@@ -326,8 +326,8 @@ public class BcelWeaver {
         * subdirectories) are considered resources and are also copied.
         * 
         */
-       public List addDirectoryContents(File inFile, File outDir) throws IOException {
-               List addedClassFiles = new ArrayList();
+       public List<UnwovenClassFile> addDirectoryContents(File inFile, File outDir) throws IOException {
+               List<UnwovenClassFile> addedClassFiles = new ArrayList<UnwovenClassFile>();
 
                // Get a list of all files (i.e. everything that isnt a directory)
                File[] files = FileUtil.listFiles(inFile, new FileFilter() {
@@ -348,9 +348,9 @@ public class BcelWeaver {
        /**
         * Adds all class files in the jar
         */
-       public List addJarFile(File inFile, File outDir, boolean canBeDirectory) {
+       public List<UnwovenClassFile> addJarFile(File inFile, File outDir, boolean canBeDirectory) {
                // System.err.println("? addJarFile(" + inFile + ", " + outDir + ")");
-               List addedClassFiles = new ArrayList();
+               List<UnwovenClassFile> addedClassFiles = new ArrayList<UnwovenClassFile>();
                needToReweaveWorld = true;
                JarFile inJar = null;
 
@@ -513,8 +513,8 @@ public class BcelWeaver {
                needToReweaveWorld = xcutSet.hasChangedSinceLastReset();
 
                // update mungers
-               for (Iterator i = addedClasses.iterator(); i.hasNext();) {
-                       UnwovenClassFile jc = (UnwovenClassFile) i.next();
+               for (Iterator<UnwovenClassFile> i = addedClasses.iterator(); i.hasNext();) {
+                       UnwovenClassFile jc = i.next();
                        String name = jc.getClassName();
                        ResolvedType type = world.resolve(name);
                        // System.err.println("added: " + type + " aspect? " +
@@ -524,8 +524,8 @@ public class BcelWeaver {
                        }
                }
 
-               for (Iterator i = deletedTypenames.iterator(); i.hasNext();) {
-                       String name = (String) i.next();
+               for (Iterator<String> i = deletedTypenames.iterator(); i.hasNext();) {
+                       String name = i.next();
                        if (xcutSet.deleteAspect(UnresolvedType.forName(name))) {
                                needToReweaveWorld = true;
                        }
@@ -586,8 +586,8 @@ public class BcelWeaver {
 
        private void addCustomMungers() {
                if (customMungerFactory != null) {
-                       for (Iterator i = addedClasses.iterator(); i.hasNext();) {
-                               UnwovenClassFile jc = (UnwovenClassFile) i.next();
+                       for (Iterator<UnwovenClassFile> i = addedClasses.iterator(); i.hasNext();) {
+                               UnwovenClassFile jc = i.next();
                                String name = jc.getClassName();
                                ResolvedType type = world.resolve(name);
                                if (type.isAspect()) {
@@ -657,7 +657,7 @@ public class BcelWeaver {
                // across the set of pointcuts....
                // Use a map from key based on pc equality, to value based on
                // pc identity.
-               Map/* <Pointcut,Pointcut> */pcMap = new HashMap();
+               Map/* <Pointcut,Pointcut> */<Pointcut, Pointcut> pcMap = new HashMap<Pointcut, Pointcut>();
                for (Iterator iter = shadowMungers.iterator(); iter.hasNext();) {
                        ShadowMunger munger = (ShadowMunger) iter.next();
                        Pointcut p = munger.getPointcut();
@@ -667,7 +667,7 @@ public class BcelWeaver {
                }
        }
 
-       private Pointcut shareEntriesFromMap(Pointcut p, Map pcMap) {
+       private Pointcut shareEntriesFromMap(Pointcut p, Map<Pointcut, Pointcut> pcMap) {
                // some things cant be shared...
                if (p instanceof NameBindingPointcut) {
                        return p;
@@ -695,7 +695,7 @@ public class BcelWeaver {
                } else {
                        // primitive pcd
                        if (pcMap.containsKey(p)) { // based on equality
-                               return (Pointcut) pcMap.get(p); // same instance (identity)
+                               return pcMap.get(p); // same instance (identity)
                        } else {
                                pcMap.put(p, p);
                                return p;
@@ -754,7 +754,7 @@ public class BcelWeaver {
                        // we know that every branch binds every formal, so there is no
                        // ambiguity
                        // if each branch binds it in exactly the same way...
-                       List ambiguousNames = new ArrayList();
+                       List<String> ambiguousNames = new ArrayList<String>();
                        for (int i = 0; i < numFormals; i++) {
                                if (leftBindings[i] == null) {
                                        if (rightBindings[i] != null) {
@@ -936,7 +936,7 @@ public class BcelWeaver {
        /**
         * @param userPointcut
         */
-       private void raiseAmbiguityInDisjunctionError(Pointcut userPointcut, List names) {
+       private void raiseAmbiguityInDisjunctionError(Pointcut userPointcut, List<String> names) {
                StringBuffer formalNames = new StringBuffer(names.get(0).toString());
                for (int i = 1; i < names.size(); i++) {
                        formalNames.append(", ");
@@ -1032,17 +1032,17 @@ public class BcelWeaver {
        // ---- weaving
 
        // Used by some test cases only...
-       public Collection weave(File file) throws IOException {
+       public Collection<String> weave(File file) throws IOException {
                OutputStream os = FileUtil.makeOutputStream(file);
                this.zipOutputStream = new ZipOutputStream(os);
                prepareForWeave();
-               Collection c = weave(new IClassFileProvider() {
+               Collection<String> c = weave(new IClassFileProvider() {
 
                        public boolean isApplyAtAspectJMungersOnly() {
                                return false;
                        }
 
-                       public Iterator getClassFileIterator() {
+                       public Iterator<UnwovenClassFile> getClassFileIterator() {
                                return addedClasses.iterator();
                        }
 
@@ -1153,16 +1153,16 @@ public class BcelWeaver {
        // }
 
        // variation of "weave" that sources class files from an external source.
-       public Collection weave(IClassFileProvider input) throws IOException {
+       public Collection<String> weave(IClassFileProvider input) throws IOException {
                if (trace.isTraceEnabled()) {
                        trace.enter("weave", this, input);
                }
                ContextToken weaveToken = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.WEAVING, "");
-               Collection wovenClassNames = new ArrayList();
+               Collection<String> wovenClassNames = new ArrayList<String>();
                IWeaveRequestor requestor = input.getRequestor();
 
-               for (Iterator i = input.getClassFileIterator(); i.hasNext();) {
-                       UnwovenClassFile classFile = (UnwovenClassFile) i.next();
+               for (Iterator<UnwovenClassFile> i = input.getClassFileIterator(); i.hasNext();) {
+                       UnwovenClassFile classFile = i.next();
                        if (world.getModel() != null /* AsmManager.isCreatingModel() */&& !isBatchWeave) {
                                // remove all relationships where this file being woven is the
                                // target of the relationship
@@ -1172,8 +1172,8 @@ public class BcelWeaver {
 
                // Go through the types and ensure any 'damaged' during compile time are
                // repaired prior to weaving
-               for (Iterator i = input.getClassFileIterator(); i.hasNext();) {
-                       UnwovenClassFile classFile = (UnwovenClassFile) i.next();
+               for (Iterator<UnwovenClassFile> i = input.getClassFileIterator(); i.hasNext();) {
+                       UnwovenClassFile classFile = i.next();
                        String className = classFile.getClassName();
                        ResolvedType theType = world.resolve(className);
                        if (theType != null) {
@@ -1188,8 +1188,8 @@ public class BcelWeaver {
                        requestor.weavingAspects();
                        // ContextToken aspectToken =
                        CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.WEAVING_ASPECTS, "");
-                       for (Iterator i = input.getClassFileIterator(); i.hasNext();) {
-                               UnwovenClassFile classFile = (UnwovenClassFile) i.next();
+                       for (Iterator<UnwovenClassFile> i = input.getClassFileIterator(); i.hasNext();) {
+                               UnwovenClassFile classFile = i.next();
                                String className = classFile.getClassName();
                                ResolvedType theType = world.resolve(className);
                                if (theType.isAnnotationStyleAspect()) {
@@ -1218,8 +1218,8 @@ public class BcelWeaver {
                                CompilationAndWeavingContext.PROCESSING_REWEAVABLE_STATE, "");
                prepareToProcessReweavableState();
                // clear all state from files we'll be reweaving
-               for (Iterator i = input.getClassFileIterator(); i.hasNext();) {
-                       UnwovenClassFile classFile = (UnwovenClassFile) i.next();
+               for (Iterator<UnwovenClassFile> i = input.getClassFileIterator(); i.hasNext();) {
+                       UnwovenClassFile classFile = i.next();
                        String className = classFile.getClassName();
                        BcelObjectType classType = getClassType(className);
 
@@ -1248,17 +1248,17 @@ public class BcelWeaver {
                // encountered).
                // For class A, the order is superclasses of A then superinterfaces of A
                // (and this mechanism is applied recursively)
-               List typesToProcess = new ArrayList();
-               for (Iterator iter = input.getClassFileIterator(); iter.hasNext();) {
-                       UnwovenClassFile clf = (UnwovenClassFile) iter.next();
+               List<String> typesToProcess = new ArrayList<String>();
+               for (Iterator<UnwovenClassFile> iter = input.getClassFileIterator(); iter.hasNext();) {
+                       UnwovenClassFile clf = iter.next();
                        typesToProcess.add(clf.getClassName());
                }
                while (typesToProcess.size() > 0) {
-                       weaveParentsFor(typesToProcess, (String) typesToProcess.get(0));
+                       weaveParentsFor(typesToProcess, typesToProcess.get(0));
                }
 
-               for (Iterator i = input.getClassFileIterator(); i.hasNext();) {
-                       UnwovenClassFile classFile = (UnwovenClassFile) i.next();
+               for (Iterator<UnwovenClassFile> i = input.getClassFileIterator(); i.hasNext();) {
+                       UnwovenClassFile classFile = i.next();
                        String className = classFile.getClassName();
                        addNormalTypeMungers(className);
                }
@@ -1268,8 +1268,8 @@ public class BcelWeaver {
                requestor.weavingAspects();
                ContextToken aspectToken = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.WEAVING_ASPECTS, "");
                // first weave into aspects
-               for (Iterator i = input.getClassFileIterator(); i.hasNext();) {
-                       UnwovenClassFile classFile = (UnwovenClassFile) i.next();
+               for (Iterator<UnwovenClassFile> i = input.getClassFileIterator(); i.hasNext();) {
+                       UnwovenClassFile classFile = i.next();
                        String className = classFile.getClassName();
                        ResolvedType theType = world.resolve(className);
                        if (theType.isAspect()) {
@@ -1300,8 +1300,8 @@ public class BcelWeaver {
                requestor.weavingClasses();
                ContextToken classToken = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.WEAVING_CLASSES, "");
                // then weave into non-aspects
-               for (Iterator i = input.getClassFileIterator(); i.hasNext();) {
-                       UnwovenClassFile classFile = (UnwovenClassFile) i.next();
+               for (Iterator<UnwovenClassFile> i = input.getClassFileIterator(); i.hasNext();) {
+                       UnwovenClassFile classFile = i.next();
                        String className = classFile.getClassName();
                        ResolvedType theType = world.resolve(className);
                        if (!theType.isAspect()) {
@@ -1379,7 +1379,7 @@ public class BcelWeaver {
                // put out a warning
                if (world.isInJava5Mode() && world.getLint().adviceDidNotMatch.isEnabled()) {
                        List l = world.getCrosscuttingMembersSet().getShadowMungers();
-                       Set alreadyWarnedLocations = new HashSet();
+                       Set<AdviceLocation> alreadyWarnedLocations = new HashSet<AdviceLocation>();
 
                        for (Iterator iter = l.iterator(); iter.hasNext();) {
                                ShadowMunger element = (ShadowMunger) iter.next();
@@ -1425,7 +1425,7 @@ public class BcelWeaver {
         * A>B>C and only give A and C to the weaver, it may choose to weave them in either order - but you'll probably have other
         * problems if you are supplying partial hierarchies like that !
         */
-       private void weaveParentsFor(List typesForWeaving, String typeToWeave) {
+       private void weaveParentsFor(List<String> typesForWeaving, String typeToWeave) {
                // Look at the supertype first
                ResolvedType rtx = world.resolve(typeToWeave);
                ResolvedType superType = rtx.getSuperclass();
@@ -1465,7 +1465,7 @@ public class BcelWeaver {
                        if (aspectsPreviouslyInWorld != null) {
                                // keep track of them just to ensure unique missing aspect error
                                // reporting
-                               Set alreadyConfirmedReweavableState = new HashSet();
+                               Set<String> alreadyConfirmedReweavableState = new HashSet<String>();
                                for (Iterator iter = aspectsPreviouslyInWorld.iterator(); iter.hasNext();) {
                                        String requiredTypeName = (String) iter.next();
                                        if (!alreadyConfirmedReweavableState.contains(requiredTypeName)) {
@@ -1576,7 +1576,7 @@ public class BcelWeaver {
                }
                onType.clearInterTypeMungers();
 
-               List decpToRepeat = new ArrayList();
+               List<DeclareParents> decpToRepeat = new ArrayList<DeclareParents>();
 
                boolean aParentChangeOccurred = false;
                boolean anAnnotationChangeOccurred = false;
@@ -1602,9 +1602,9 @@ public class BcelWeaver {
 
                while ((aParentChangeOccurred || anAnnotationChangeOccurred) && !decpToRepeat.isEmpty()) {
                        anAnnotationChangeOccurred = aParentChangeOccurred = false;
-                       List decpToRepeatNextTime = new ArrayList();
-                       for (Iterator iter = decpToRepeat.iterator(); iter.hasNext();) {
-                               DeclareParents decp = (DeclareParents) iter.next();
+                       List<DeclareParents> decpToRepeatNextTime = new ArrayList<DeclareParents>();
+                       for (Iterator<DeclareParents> iter = decpToRepeat.iterator(); iter.hasNext();) {
+                               DeclareParents decp = iter.next();
                                boolean typeChanged = applyDeclareParents(decp, onType);
                                if (typeChanged) {
                                        aParentChangeOccurred = true;
@@ -1630,7 +1630,7 @@ public class BcelWeaver {
        private boolean applyDeclareAtType(DeclareAnnotation decA, ResolvedType onType, boolean reportProblems) {
                boolean didSomething = false;
                if (decA.matches(onType)) {
-                       AnnotationAJ theAnnotation = decA.getAnnotationX();
+                       AnnotationAJ theAnnotation = decA.getAnnotation();
                        // can be null for broken code!
                        if (theAnnotation == null) {
                                return false;
@@ -1648,7 +1648,7 @@ public class BcelWeaver {
                                return false;
                        }
 
-                       AnnotationAJ annoX = decA.getAnnotationX();
+                       AnnotationAJ annoX = decA.getAnnotation();
 
                        // check the annotation is suitable for the target
                        boolean problemReported = verifyTargetIsOK(decA, onType, annoX, reportProblems);
@@ -1767,7 +1767,7 @@ public class BcelWeaver {
                        return null;
                }
 
-               List shadowMungers = fastMatch(shadowMungerList, classType.getResolvedTypeX());
+               List<ShadowMunger> shadowMungers = fastMatch(shadowMungerList, classType.getResolvedTypeX());
                List typeMungers = classType.getResolvedTypeX().getInterTypeMungers();
 
                classType.getResolvedTypeX().checkInterTypeMungers();
@@ -1897,7 +1897,7 @@ public class BcelWeaver {
                zipOutputStream.closeEntry();
        }
 
-       private List fastMatch(List list, ResolvedType type) {
+       private List<ShadowMunger> fastMatch(List list, ResolvedType type) {
                if (list == null) {
                        return Collections.EMPTY_LIST;
                }
@@ -1907,7 +1907,7 @@ public class BcelWeaver {
                // weaving
                FastMatchInfo info = new FastMatchInfo(type, null);
 
-               List result = new ArrayList();
+               List<ShadowMunger> result = new ArrayList<ShadowMunger>();
                Iterator iter = list.iterator();
                while (iter.hasNext()) {
                        ShadowMunger munger = (ShadowMunger) iter.next();
index 95d6ecb732bb09ee79502d11efc736c91d980044..1e48e20aeaf01d9710eda7ea8cc47f60bd2616ee 100644 (file)
@@ -123,6 +123,7 @@ public class BcelWorld extends World implements Repository {
                throw new RuntimeException("Shadow.determineRelKind: What the hell is it? " + ak);
        }
 
+       @Override
        public void reportMatch(ShadowMunger munger, Shadow shadow) {
                if (getCrossReferenceHandler() != null) {
                        getCrossReferenceHandler().addCrossReference(munger.getSourceLocation(), // What is being applied
@@ -249,21 +250,20 @@ public class BcelWorld extends World implements Repository {
                return nice.toString();
        }
 
-       private static List makeDefaultClasspath(String cp) {
-               List classPath = new ArrayList();
+       private static List<String> makeDefaultClasspath(String cp) {
+               List<String> classPath = new ArrayList<String>();
                classPath.addAll(getPathEntries(cp));
                classPath.addAll(getPathEntries(ClassPath.getClassPath()));
                return classPath;
 
        }
 
-       private static List getPathEntries(String s) {
-               List ret = new ArrayList();
+       private static List<String> getPathEntries(String s) {
+               List<String> ret = new ArrayList<String>();
                StringTokenizer tok = new StringTokenizer(s, File.pathSeparator);
-
-               while (tok.hasMoreTokens())
+               while (tok.hasMoreTokens()) {
                        ret.add(tok.nextToken());
-
+               }
                return ret;
        }
 
@@ -356,6 +356,7 @@ public class BcelWorld extends World implements Repository {
                return resolve(fromBcel(t));
        }
 
+       @Override
        protected ReferenceTypeDelegate resolveDelegate(ReferenceType ty) {
                String name = ty.getName();
                ensureAdvancedConfigurationProcessed();
@@ -554,6 +555,7 @@ public class BcelWorld extends World implements Repository {
                return MemberImpl.method(declaringType, modifier, name, signature);
        }
 
+       @Override
        public String toString() {
                StringBuffer buf = new StringBuffer();
                buf.append("BcelWorld(");
@@ -620,6 +622,7 @@ public class BcelWorld extends World implements Repository {
         * The aim of this method is to make sure a particular type is 'ok'. Some operations on the delegate for a type modify it and
         * this method is intended to undo that... see pr85132
         */
+       @Override
        public void validateType(UnresolvedType type) {
                ResolvedType result = typeMap.get(type.getSignature());
                if (result == null)
@@ -676,12 +679,12 @@ public class BcelWorld extends World implements Repository {
                boolean didSomething = false;
                if (decA.matches(onType)) {
 
-                       if (onType.hasAnnotation(decA.getAnnotationX().getType())) {
+                       if (onType.hasAnnotation(decA.getAnnotation().getType())) {
                                // already has it
                                return false;
                        }
 
-                       AnnotationAJ annoX = decA.getAnnotationX();
+                       AnnotationAJ annoX = decA.getAnnotation();
 
                        // check the annotation is suitable for the target
                        boolean isOK = checkTargetOK(decA, onType, annoX);
@@ -717,8 +720,9 @@ public class BcelWorld extends World implements Repository {
        protected void weaveInterTypeDeclarations(ResolvedType onType) {
 
                List declareParentsList = getCrosscuttingMembersSet().getDeclareParents();
-               if (onType.isRawType())
+               if (onType.isRawType()) {
                        onType = onType.getGenericType();
+               }
                onType.clearInterTypeMungers();
 
                List decpToRepeat = new ArrayList();
@@ -771,10 +775,12 @@ public class BcelWorld extends World implements Repository {
                }
        }
 
+       @Override
        public IWeavingSupport getWeavingSupport() {
                return bcelWeavingSupport;
        }
 
+       @Override
        public void reportCheckerMatch(Checker checker, Shadow shadow) {
                IMessage iMessage = new Message(checker.getMessage(), shadow.toString(), checker.isError() ? IMessage.ERROR
                                : IMessage.WARNING, shadow.getSourceLocation(), null, new ISourceLocation[] { checker.getSourceLocation() }, true,
@@ -839,10 +845,12 @@ public class BcelWorld extends World implements Repository {
                this.isXmlConfiguredWorld = b;
        }
 
+       @Override
        public boolean isXmlConfigured() {
                return isXmlConfiguredWorld && xmlConfiguration != null;
        }
 
+       @Override
        public boolean isAspectIncluded(ResolvedType aspectType) {
                if (!isXmlConfigured()) {
                        return true;
@@ -850,6 +858,7 @@ public class BcelWorld extends World implements Repository {
                return xmlConfiguration.specifiesInclusionOfAspect(aspectType.getName());
        }
 
+       @Override
        public TypePattern getAspectScope(ResolvedType declaringType) {
                return xmlConfiguration.getScopeFor(declaringType.getName());
        }
index d25090a16514862cd1d90bb0f1123a847cfd849e..8e733af32c3328f371d1943d98195e4fcbac0b90 100644 (file)
@@ -81,7 +81,7 @@ public final class LazyClassGen {
 
        int highestLineNumber = 0; // ---- JSR 45 info
 
-       private final SortedMap /* <String, InlinedSourceFileInfo> */inlinedFiles = new TreeMap();
+       private final SortedMap<String, InlinedSourceFileInfo> inlinedFiles = new TreeMap<String, InlinedSourceFileInfo>();
 
        private boolean regenerateGenericSignatureAttribute = false;
 
@@ -91,10 +91,10 @@ public final class LazyClassGen {
        private final World world;
        private final String packageName = null;
 
-       private final List /* BcelField */fields = new ArrayList();
-       private final List /* LazyMethodGen */methodGens = new ArrayList();
-       private final List /* LazyClassGen */classGens = new ArrayList();
-       private final List /* AnnotationGen */annotations = new ArrayList();
+       private final List fields = new ArrayList();
+       private final List<LazyMethodGen> methodGens = new ArrayList<LazyMethodGen>();
+       private final List<LazyClassGen> classGens = new ArrayList<LazyClassGen>();
+       private final List<AnnotationGen> annotations = new ArrayList<AnnotationGen>();
        private int childCounter = 0;
 
        private final InstructionFactory fact;
@@ -133,8 +133,7 @@ public final class LazyClassGen {
 
        void calculateSourceDebugExtensionOffsets() {
                int i = roundUpToHundreds(highestLineNumber);
-               for (Iterator iter = inlinedFiles.values().iterator(); iter.hasNext();) {
-                       InlinedSourceFileInfo element = (InlinedSourceFileInfo) iter.next();
+               for (InlinedSourceFileInfo element : inlinedFiles.values()) {
                        element.offset = i;
                        i = roundUpToHundreds(i + element.highestLineNumber);
                }
@@ -145,7 +144,7 @@ public final class LazyClassGen {
        }
 
        int getSourceDebugExtensionOffset(String fullpath) {
-               return ((InlinedSourceFileInfo) inlinedFiles.get(fullpath)).offset;
+               return inlinedFiles.get(fullpath).offset;
        }
 
        // private Unknown getSourceDebugExtensionAttribute() {
@@ -417,25 +416,14 @@ public final class LazyClassGen {
                return world;
        }
 
-       public List getMethodGens() {
+       public List<LazyMethodGen> getMethodGens() {
                return methodGens; // ???Collections.unmodifiableList(methodGens);
        }
 
-       public List/* BcelField */getFieldGens() {
+       public List<BcelField> getFieldGens() {
                return fields;
-               // return myGen.getFields();
        }
 
-       // public Field getField(String name) {
-       // Field[] allFields = myGen.getFields();
-       // if (allFields==null) return null;
-       // for (int i = 0; i < allFields.length; i++) {
-       // Field field = allFields[i];
-       // if (field.getName().equals(name)) return field;
-       // }
-       // return null;
-       // }
-
        private void writeBack(BcelWorld world) {
                if (getConstantPool().getSize() > Short.MAX_VALUE) {
                        reportClassTooBigProblem();
@@ -443,8 +431,7 @@ public final class LazyClassGen {
                }
 
                if (annotations.size() > 0) {
-                       for (Iterator iter = annotations.iterator(); iter.hasNext();) {
-                               AnnotationGen element = (AnnotationGen) iter.next();
+                       for (AnnotationGen element : annotations) {
                                myGen.addAnnotation(element);
                        }
                        // Attribute[] annAttributes =
@@ -487,11 +474,11 @@ public final class LazyClassGen {
 
                int len = methodGens.size();
                myGen.setMethods(Method.NoMethods);
-               for (int i = 0; i < len; i++) {
-                       LazyMethodGen gen = (LazyMethodGen) methodGens.get(i);
+               for (LazyMethodGen gen : methodGens) {
                        // we skip empty clinits
-                       if (isEmptyClinit(gen))
+                       if (isEmptyClinit(gen)) {
                                continue;
+                       }
                        myGen.addMethod(gen.getMethod());
                }
 
@@ -735,8 +722,8 @@ public final class LazyClassGen {
        }
 
        // non-recursive, may be a bug, ha ha.
-       private List getClassGens() {
-               List ret = new ArrayList();
+       private List<LazyClassGen> getClassGens() {
+               List<LazyClassGen> ret = new ArrayList<LazyClassGen>();
                ret.add(this);
                ret.addAll(classGens);
                return ret;
@@ -745,9 +732,8 @@ public final class LazyClassGen {
        public List getChildClasses(BcelWorld world) {
                if (classGens.isEmpty())
                        return Collections.EMPTY_LIST;
-               List ret = new ArrayList();
-               for (Iterator i = classGens.iterator(); i.hasNext();) {
-                       LazyClassGen clazz = (LazyClassGen) i.next();
+               List<UnwovenClassFile.ChildClass> ret = new ArrayList<UnwovenClassFile.ChildClass>();
+               for (LazyClassGen clazz : classGens) {
                        byte[] bytes = clazz.getJavaClass(world).getBytes();
                        String name = clazz.getName();
                        int index = name.lastIndexOf('$');
@@ -758,6 +744,7 @@ public final class LazyClassGen {
                return ret;
        }
 
+       @Override
        public String toString() {
                return toShortString();
        }
@@ -888,8 +875,7 @@ public final class LazyClassGen {
        }
 
        public LazyMethodGen getStaticInitializer() {
-               for (Iterator i = methodGens.iterator(); i.hasNext();) {
-                       LazyMethodGen gen = (LazyMethodGen) i.next();
+               for (LazyMethodGen gen : methodGens) {
                        // OPTIMIZE persist kind of member into the gen object? for clinit
                        if (gen.getName().equals("<clinit>"))
                                return gen;
index 7397ddb0aaf4e9216047f79cbe80643f458324ad..e304f386204022987e446a4092a75f09df070e79 100644 (file)
@@ -88,7 +88,7 @@ public final class LazyMethodGen implements Traceable {
        private String[] declaredExceptions;
        private InstructionList body; // leaving null for abstracts
        private List attributes;
-       private List newAnnotations;
+       private List<AnnotationAJ> newAnnotations;
        private AnnotationAJ[][] newParameterAnnotations;
        private final LazyClassGen enclosingClass;
        private BcelMethod memberView;
@@ -269,8 +269,9 @@ public final class LazyMethodGen implements Traceable {
                initialize();
                if (memberView == null) {
                        // If member view is null, we manage them in newAnnotations
-                       if (newAnnotations == null)
-                               newAnnotations = new ArrayList();
+                       if (newAnnotations == null) {
+                               newAnnotations = new ArrayList<AnnotationAJ>();
+                       }
                        newAnnotations.add(ax);
                } else {
                        memberView.addAnnotation(ax);
@@ -306,22 +307,21 @@ public final class LazyMethodGen implements Traceable {
                }
        }
 
-       public boolean hasAnnotation(UnresolvedType annotationTypeX) {
+       public boolean hasAnnotation(UnresolvedType annotationType) {
                initialize();
                if (memberView == null) {
                        // Check local annotations first
                        if (newAnnotations != null) {
-                               for (Iterator iter = newAnnotations.iterator(); iter.hasNext();) {
-                                       AnnotationAJ element = (AnnotationAJ) iter.next();
-                                       if (element.getTypeSignature().equals(annotationTypeX.getSignature())) {
+                               for (AnnotationAJ annotation : newAnnotations) {
+                                       if (annotation.getTypeSignature().equals(annotationType.getSignature())) {
                                                return true;
                                        }
                                }
                        }
                        memberView = new BcelMethod(getEnclosingClass().getBcelObjectType(), getMethod());
-                       return memberView.hasAnnotation(annotationTypeX);
+                       return memberView.hasAnnotation(annotationType);
                }
-               return memberView.hasAnnotation(annotationTypeX);
+               return memberView.hasAnnotation(annotationType);
        }
 
        private void initialize() {
@@ -491,6 +491,7 @@ public final class LazyMethodGen implements Traceable {
 
        // =============================
 
+       @Override
        public String toString() {
                BcelObjectType bot = enclosingClass.getBcelObjectType();
                WeaverVersionInfo weaverVersion = (bot == null ? WeaverVersionInfo.CURRENT : bot.getWeaverVersionAttribute());
index 22dfeb9bab95454e0a408ea6c4792ce87ae0953b..79a96c7755b482956ef89ced3d121415aff6bfef 100644 (file)
@@ -16,7 +16,6 @@ import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.IOException;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
 
 import org.aspectj.apache.bcel.classfile.JavaClass;
@@ -29,7 +28,7 @@ public class UnwovenClassFile implements IUnwovenClassFile {
        protected byte[] bytes;
        // protected JavaClass javaClass = null;
        // protected byte[] writtenBytes = null;
-       protected List /* ChildClass */writtenChildClasses = Collections.EMPTY_LIST;
+       protected List<ChildClass> writtenChildClasses = Collections.emptyList();
        protected String className = null;
 
        public UnwovenClassFile(String filename, byte[] bytes) {
@@ -94,7 +93,7 @@ public class UnwovenClassFile implements IUnwovenClassFile {
                // writtenBytes = bytes;
        }
 
-       private void writeChildClasses(List childClasses) throws IOException {
+       private void writeChildClasses(List<ChildClass> childClasses) throws IOException {
                // ??? we only really need to delete writtenChildClasses whose
                // ??? names aren't in childClasses; however, it's unclear
                // ??? how much that will affect performance
@@ -102,10 +101,8 @@ public class UnwovenClassFile implements IUnwovenClassFile {
 
                childClasses.removeAll(writtenChildClasses); // XXX is this right
 
-               for (Iterator iter = childClasses.iterator(); iter.hasNext();) {
-                       ChildClass childClass = (ChildClass) iter.next();
+               for (ChildClass childClass : childClasses) {
                        writeChildClassFile(childClass.name, childClass.bytes);
-
                }
 
                writtenChildClasses = childClasses;
@@ -119,8 +116,7 @@ public class UnwovenClassFile implements IUnwovenClassFile {
        }
 
        protected void deleteAllChildClasses() {
-               for (Iterator iter = writtenChildClasses.iterator(); iter.hasNext();) {
-                       ChildClass childClass = (ChildClass) iter.next();
+               for (ChildClass childClass : writtenChildClasses) {
                        deleteChildClassFile(childClass.name);
                }
        }
@@ -154,6 +150,7 @@ public class UnwovenClassFile implements IUnwovenClassFile {
                return className;
        }
 
+       @Override
        public String toString() {
                return "UnwovenClassFile(" + filename + ", " + getClassName() + ")";
        }
@@ -170,6 +167,7 @@ public class UnwovenClassFile implements IUnwovenClassFile {
                        this.bytes = bytes;
                }
 
+               @Override
                public boolean equals(Object other) {
                        if (!(other instanceof ChildClass))
                                return false;
@@ -177,10 +175,12 @@ public class UnwovenClassFile implements IUnwovenClassFile {
                        return o.name.equals(name) && unchanged(o.bytes, bytes);
                }
 
+               @Override
                public int hashCode() {
                        return name.hashCode();
                }
 
+               @Override
                public String toString() {
                        return "(ChildClass " + name + ")";
                }
index 7f97262e9064dcbd070c25a89e2a1abe9109ab1f..64720d497666e05d6613da0eedbd336a6e370967 100644 (file)
@@ -64,12 +64,12 @@ import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;
 
 public class Utility {
 
-       public static List readAjAttributes(String classname, Attribute[] as, ISourceContext context, World w,
+       public static List<AjAttribute> readAjAttributes(String classname, Attribute[] as, ISourceContext context, World w,
                        AjAttribute.WeaverVersionInfo version) {
-               List l = new ArrayList();
+               List<AjAttribute> l = new ArrayList<AjAttribute>();
 
                // first pass, look for version
-               List forSecondPass = new ArrayList();
+               List<Unknown> forSecondPass = new ArrayList<Unknown>();
                for (int i = as.length - 1; i >= 0; i--) {
                        Attribute a = as[i];
                        if (a instanceof Unknown) {
@@ -86,25 +86,26 @@ public class Utility {
                                                                                                + " is version " + version.toString());
                                                        }
                                                }
-                                               forSecondPass.add(a);
+                                               forSecondPass.add(u);
                                        }
                                }
                        }
                }
 
+               // FIXASC why going backwards? is it important
                for (int i = forSecondPass.size() - 1; i >= 0; i--) {
-                       Unknown a = (Unknown) forSecondPass.get(i);
+                       Unknown a = forSecondPass.get(i);
                        String name = a.getName();
                        AjAttribute attr = AjAttribute.read(version, name, a.getBytes(), context, w);
-                       if (attr != null)
+                       if (attr != null) {
                                l.add(attr);
+                       }
                }
                return l;
        }
 
        /*
-        * Ensure we report a nice source location - particular in the case where
-        * the source info is missing (binary weave).
+        * Ensure we report a nice source location - particular in the case where the source info is missing (binary weave).
         */
        public static String beautifyLocation(ISourceLocation isl) {
                StringBuffer nice = new StringBuffer();
@@ -237,7 +238,7 @@ public class Utility {
 
        // Lookup table, for converting between pairs of types, it gives
        // us the method name in the Conversions class
-       private static Hashtable validBoxing = new Hashtable();
+       private static Hashtable<String, String> validBoxing = new Hashtable<String, String>();
 
        static {
                validBoxing.put("Ljava/lang/Byte;B", "byteObject");
@@ -298,7 +299,7 @@ public class Utility {
                        // before the call...
                        Type from = BcelWorld.makeBcelType(fromType);
                        Type to = BcelWorld.makeBcelType(toType);
-                       String name = (String) validBoxing.get(toType.getSignature() + fromType.getSignature());
+                       String name = validBoxing.get(toType.getSignature() + fromType.getSignature());
                        if (toType.isPrimitiveType()) {
                                il.append(fact.createInvoke("org.aspectj.runtime.internal.Conversions", name, to, new Type[] { Type.OBJECT },
                                                Constants.INVOKESTATIC));
@@ -459,8 +460,7 @@ public class Utility {
        }
 
        /**
-        * replace an instruction handle with another instruction, in this case, a
-        * branch instruction.
+        * replace an instruction handle with another instruction, in this case, a branch instruction.
         * 
         * @param ih the instruction handle to replace.
         * @param branchInstruction the branch instruction to replace ih with
@@ -474,10 +474,8 @@ public class Utility {
        }
 
        /**
-        * delete an instruction handle and retarget all targeters of the deleted
-        * instruction to the next instruction. Obviously, this should not be used
-        * to delete a control transfer instruction unless you know what you're
-        * doing.
+        * delete an instruction handle and retarget all targeters of the deleted instruction to the next instruction. Obviously, this
+        * should not be used to delete a control transfer instruction unless you know what you're doing.
         * 
         * @param ih the instruction handle to delete.
         * @param enclosingMethod where to find ih's instruction list.
@@ -487,8 +485,7 @@ public class Utility {
        }
 
        /**
-        * delete an instruction handle and retarget all targeters of the deleted
-        * instruction to the provided target.
+        * delete an instruction handle and retarget all targeters of the deleted instruction to the provided target.
         * 
         * @param ih the instruction handle to delete
         * @param retargetTo the instruction handle to retarget targeters of ih to.
@@ -514,11 +511,9 @@ public class Utility {
        /**
         * Fix for Bugzilla #39479, #40109 patch contributed by Andy Clement
         * 
-        * Need to manually copy Select instructions - if we rely on the the 'fresh'
-        * object created by copy(), the InstructionHandle array 'targets' inside
-        * the Select object will not have been deep copied, so modifying targets in
-        * fresh will modify the original Select - not what we want ! (It is a bug
-        * in BCEL to do with cloning Select objects).
+        * Need to manually copy Select instructions - if we rely on the the 'fresh' object created by copy(), the InstructionHandle
+        * array 'targets' inside the Select object will not have been deep copied, so modifying targets in fresh will modify the
+        * original Select - not what we want ! (It is a bug in BCEL to do with cloning Select objects).
         * 
         * <pre>
         * declare error:
@@ -622,8 +617,7 @@ public class Utility {
        }
 
        /**
-        * Checks for suppression specified on the member or on the declaring type
-        * of that member
+        * Checks for suppression specified on the member or on the declaring type of that member
         */
        public static boolean isSuppressing(Member member, String lintkey) {
                boolean isSuppressing = Utils.isSuppressing(member.getAnnotations(), lintkey);
@@ -636,11 +630,12 @@ public class Utility {
                return false;
        }
 
-       public static List/* Lint.Kind */getSuppressedWarnings(AnnotationAJ[] anns, Lint lint) {
-               if (anns == null)
+       public static List<Lint.Kind> getSuppressedWarnings(AnnotationAJ[] anns, Lint lint) {
+               if (anns == null) {
                        return Collections.EMPTY_LIST;
+               }
                // Go through the annotation types
-               List suppressedWarnings = new ArrayList();
+               List<Lint.Kind> suppressedWarnings = new ArrayList<Lint.Kind>();
                boolean found = false;
                for (int i = 0; !found && i < anns.length; i++) {
                        // Check for the SuppressAjWarnings annotation
@@ -651,7 +646,7 @@ public class Utility {
                                // 1. there are no values specified (i.e. @SuppressAjWarnings)
                                // 2. there are values specified (i.e. @SuppressAjWarnings("A")
                                // or @SuppressAjWarnings({"A","B"})
-                               List vals = ((BcelAnnotation) anns[i]).getBcelAnnotation().getValues();
+                               List<ElementNameValuePairGen> vals = ((BcelAnnotation) anns[i]).getBcelAnnotation().getValues();
                                if (vals == null || vals.isEmpty()) { // (1)
                                        suppressedWarnings.addAll(lint.allKinds());
                                } else { // (2)