]> source.dussan.org Git - aspectj.git/commitdiff
generics
authoraclement <aclement>
Wed, 7 Jul 2010 18:24:57 +0000 (18:24 +0000)
committeraclement <aclement>
Wed, 7 Jul 2010 18:24:57 +0000 (18:24 +0000)
weaver/src/org/aspectj/weaver/bcel/AnnotationAccessFieldVar.java
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
weaver/src/org/aspectj/weaver/bcel/BcelAccessForInlineMunger.java
weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
weaver/src/org/aspectj/weaver/bcel/Range.java
weaver/src/org/aspectj/weaver/bcel/ShadowRange.java
weaver/src/org/aspectj/weaver/bcel/Utility.java

index c96987f537d09ec64dc887b2030bbf22aff40db1..041e92c5497ca71d68f6af2328f36a3a734ee3af 100644 (file)
@@ -60,10 +60,10 @@ class AnnotationAccessFieldVar extends BcelVar {
                for (int i = 0; i < annos.length; i++) {
                        AnnotationGen annotation = ((BcelAnnotation) annos[i]).getBcelAnnotation();
                        if (annotation.getTypeSignature().equals(annotationOfInterestSignature)) {
-                               List vals = annotation.getValues();
+                               List<NameValuePair> vals = annotation.getValues();
                                boolean doneAndDusted = false;
-                               for (Iterator iterator = vals.iterator(); iterator.hasNext();) {
-                                       NameValuePair object = (NameValuePair) iterator.next();
+                               for (Iterator<NameValuePair> iterator = vals.iterator(); iterator.hasNext();) {
+                                       NameValuePair object = iterator.next();
                                        Object o = object.getValue();
                                        if (o instanceof EnumElementValue) {
                                                EnumElementValue v = (EnumElementValue) object.getValue();
@@ -84,12 +84,11 @@ class AnnotationAccessFieldVar extends BcelVar {
                                                // il.append(fact.createGetStatic(rt.getName(), v.getEnumValueString(), Type.getType(rt.getSignature())));
                                                // doneAndDusted = true;
                                                // }
-                                               int stop = 1;
                                        }
                                }
                                if (!doneAndDusted) {
-                                       ResolvedMember[] annotationFields = toType.getWorld().resolve(
-                                                       UnresolvedType.forSignature(annotation.getTypeSignature())).getDeclaredMethods();
+                                       ResolvedMember[] annotationFields = toType.getWorld()
+                                                       .resolve(UnresolvedType.forSignature(annotation.getTypeSignature())).getDeclaredMethods();
 
                                        // ResolvedMember[] fs = rt.getDeclaredFields();
                                        for (int ii = 0; ii < annotationFields.length; ii++) {
index dd95873d0d09f31ca8e40abfb2e5540f017e5cf2..d8b694c0da4aae00ed608cd057bf2b4538eb8b58 100644 (file)
@@ -156,13 +156,14 @@ public class AtAjAttributes {
        private static class AjAttributeFieldStruct extends AjAttributeStruct {
 
                final Field field;
-               final BcelField bField;
+
+               // final BcelField bField;
 
                public AjAttributeFieldStruct(Field field, BcelField bField, ResolvedType type, ISourceContext sourceContext,
                                IMessageHandler messageHandler) {
                        super(type, sourceContext, messageHandler);
                        this.field = field;
-                       this.bField = bField;
+                       // this.bField = bField;
                }
        }
 
@@ -413,8 +414,8 @@ public class AtAjAttributes {
                                msgHandler.handleMessage(new Message(WeaverMessages.format(WeaverMessages.RETURNING_FORMAL_NOT_DECLARED_IN_ADVICE,
                                                e.getFormalName()), IMessage.ERROR, null, bMethod.getSourceLocation()));
                        } catch (ThrownFormalNotDeclaredInAdviceSignatureException e) {
-                               msgHandler.handleMessage(new Message(WeaverMessages.format(WeaverMessages.THROWN_FORMAL_NOT_DECLARED_IN_ADVICE, e
-                                               .getFormalName()), IMessage.ERROR, null, bMethod.getSourceLocation()));
+                               msgHandler.handleMessage(new Message(WeaverMessages.format(WeaverMessages.THROWN_FORMAL_NOT_DECLARED_IN_ADVICE,
+                                               e.getFormalName()), IMessage.ERROR, null, bMethod.getSourceLocation()));
                        }
                }
                hasAtAspectJAnnotation = hasAtAspectJAnnotation || hasAtAspectJAnnotationMustReturnVoid;
@@ -692,7 +693,7 @@ public class AtAjAttributes {
                                        FormalBinding[] bindings = new org.aspectj.weaver.patterns.FormalBinding[0];
                                        IScope binding = new BindingScope(struct.enclosingType, struct.context, bindings);
                                        // first add the declare implements like
-                                       List parents = new ArrayList(1);
+                                       List<TypePattern> parents = new ArrayList<TypePattern>(1);
                                        parents.add(parent);
                                        DeclareParents dp = new DeclareParents(typePattern, parents, false);
                                        dp.resolve(binding); // resolves the parent and child parts
@@ -967,12 +968,12 @@ public class AtAjAttributes {
 
                // The factory method for building the implementation is the
                // one attached to the annotation:
-               Method implementationFactory = struct.method;
+               // Method implementationFactory = struct.method;
 
                boolean hasAtLeastOneMethod = false;
 
-               for (Iterator iterator = newInterfaceTypes.iterator(); iterator.hasNext();) {
-                       ResolvedType typeForDelegation = (ResolvedType) iterator.next();
+               for (Iterator<ResolvedType> iterator = newInterfaceTypes.iterator(); iterator.hasNext();) {
+                       ResolvedType typeForDelegation = iterator.next();
                        // TODO check for overlapping interfaces. Eg. A implements I, I extends J - if they specify interfaces={I,J} we dont
                        // want to do any methods twice
                        ResolvedMember[] methods = typeForDelegation.getMethodsWithoutIterator(true, false, false).toArray(
@@ -1043,8 +1044,8 @@ public class AtAjAttributes {
                                }
                                setIgnoreUnboundBindingNames(pc, bindings);
 
-                               ISourceLocation sl = struct.context.makeSourceLocation(struct.bMethod.getDeclarationLineNumber(), struct.bMethod
-                                               .getDeclarationOffset());
+                               ISourceLocation sl = struct.context.makeSourceLocation(struct.bMethod.getDeclarationLineNumber(),
+                                               struct.bMethod.getDeclarationOffset());
                                struct.ajAttributes.add(new AjAttribute.AdviceAttribute(AdviceKind.Before, pc, extraArgument, sl.getOffset(), sl
                                                .getOffset() + 1,// FIXME AVASM
                                                struct.context));
@@ -1095,8 +1096,8 @@ public class AtAjAttributes {
                                }
                                setIgnoreUnboundBindingNames(pc, bindings);
 
-                               ISourceLocation sl = struct.context.makeSourceLocation(struct.bMethod.getDeclarationLineNumber(), struct.bMethod
-                                               .getDeclarationOffset());
+                               ISourceLocation sl = struct.context.makeSourceLocation(struct.bMethod.getDeclarationLineNumber(),
+                                               struct.bMethod.getDeclarationOffset());
                                struct.ajAttributes.add(new AjAttribute.AdviceAttribute(AdviceKind.After, pc, extraArgument, sl.getOffset(), sl
                                                .getOffset() + 1,// FIXME AVASM
                                                struct.context));
@@ -1186,8 +1187,8 @@ public class AtAjAttributes {
                        }
                        setIgnoreUnboundBindingNames(pc, bindings);
 
-                       ISourceLocation sl = struct.context.makeSourceLocation(struct.bMethod.getDeclarationLineNumber(), struct.bMethod
-                                       .getDeclarationOffset());
+                       ISourceLocation sl = struct.context.makeSourceLocation(struct.bMethod.getDeclarationLineNumber(),
+                                       struct.bMethod.getDeclarationOffset());
                        struct.ajAttributes.add(new AjAttribute.AdviceAttribute(AdviceKind.AfterReturning, pc, extraArgument, sl.getOffset(),
                                        sl.getOffset() + 1,// FIXME AVASM
                                        struct.context));
@@ -1276,8 +1277,8 @@ public class AtAjAttributes {
                        }
                        setIgnoreUnboundBindingNames(pc, bindings);
 
-                       ISourceLocation sl = struct.context.makeSourceLocation(struct.bMethod.getDeclarationLineNumber(), struct.bMethod
-                                       .getDeclarationOffset());
+                       ISourceLocation sl = struct.context.makeSourceLocation(struct.bMethod.getDeclarationLineNumber(),
+                                       struct.bMethod.getDeclarationOffset());
                        struct.ajAttributes.add(new AjAttribute.AdviceAttribute(AdviceKind.AfterThrowing, pc, extraArgument, sl.getOffset(), sl
                                        .getOffset() + 1, struct.context));
                        return true;
@@ -1326,8 +1327,8 @@ public class AtAjAttributes {
                                }
                                setIgnoreUnboundBindingNames(pc, bindings);
 
-                               ISourceLocation sl = struct.context.makeSourceLocation(struct.bMethod.getDeclarationLineNumber(), struct.bMethod
-                                               .getDeclarationOffset());
+                               ISourceLocation sl = struct.context.makeSourceLocation(struct.bMethod.getDeclarationLineNumber(),
+                                               struct.bMethod.getDeclarationOffset());
                                struct.ajAttributes.add(new AjAttribute.AdviceAttribute(AdviceKind.Around, pc, extraArgument, sl.getOffset(), sl
                                                .getOffset() + 1,// FIXME AVASM
                                                struct.context));
@@ -1648,8 +1649,7 @@ public class AtAjAttributes {
         */
        private static AnnotationGen getAnnotation(RuntimeAnnos rvs, UnresolvedType annotationType) {
                final String annotationTypeName = annotationType.getName();
-               for (Iterator iterator = rvs.getAnnotations().iterator(); iterator.hasNext();) {
-                       AnnotationGen rv = (AnnotationGen) iterator.next();
+               for (AnnotationGen rv : rvs.getAnnotations()) {
                        if (annotationTypeName.equals(rv.getTypeName())) {
                                return rv;
                        }
@@ -1665,8 +1665,7 @@ public class AtAjAttributes {
         * @return annotation NVP
         */
        private static NameValuePair getAnnotationElement(AnnotationGen annotation, String elementName) {
-               for (Iterator iterator1 = annotation.getValues().iterator(); iterator1.hasNext();) {
-                       NameValuePair element = (NameValuePair) iterator1.next();
+               for (NameValuePair element : annotation.getValues()) {
                        if (elementName.equals(element.getNameString())) {
                                return element;
                        }
@@ -1778,10 +1777,8 @@ public class AtAjAttributes {
                }
 
                // sort by index
-               Collections.sort(arguments, new Comparator() {
-                       public int compare(Object o, Object o1) {
-                               MethodArgument mo = (MethodArgument) o;
-                               MethodArgument mo1 = (MethodArgument) o1;
+               Collections.sort(arguments, new Comparator<MethodArgument>() {
+                       public int compare(MethodArgument mo, MethodArgument mo1) {
                                if (mo.indexOnStack == mo1.indexOnStack) {
                                        return 0;
                                } else if (mo.indexOnStack > mo1.indexOnStack) {
@@ -1866,14 +1863,14 @@ public class AtAjAttributes {
        private static void setIgnoreUnboundBindingNames(Pointcut pointcut, FormalBinding[] bindings) {
                // register ImplicitBindings as to be ignored since unbound
                // TODO is it likely to fail in a bad way if f.e. this(jp) etc ?
-               List ignores = new ArrayList();
+               List<String> ignores = new ArrayList<String>();
                for (int i = 0; i < bindings.length; i++) {
                        FormalBinding formalBinding = bindings[i];
                        if (formalBinding instanceof FormalBinding.ImplicitFormalBinding) {
                                ignores.add(formalBinding.getName());
                        }
                }
-               pointcut.m_ignoreUnboundBindingForNames = (String[]) ignores.toArray(new String[ignores.size()]);
+               pointcut.m_ignoreUnboundBindingForNames = ignores.toArray(new String[ignores.size()]);
        }
 
        /**
index 64efb0a316aab4ea957ea273f276ba0d11031414..b915ca5f5f54ef20aa47c17398df16363054978e 100644 (file)
@@ -14,7 +14,6 @@ package org.aspectj.weaver.bcel;
 import java.lang.reflect.Modifier;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -55,7 +54,7 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger {
         * Wrapper member cache, key is wrapper name. This structure is queried when regular shadow matching in the advice body
         * (call/get/set) occurs
         */
-       private Map m_inlineAccessorBcelMethods;
+       private Map<String, ResolvedMember> m_inlineAccessorBcelMethods;
 
        /**
         * The aspect we act for
@@ -65,7 +64,7 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger {
        /**
         * The wrapper method we need to add. Those are added at the end of the munging
         */
-       private Set m_inlineAccessorMethodGens;
+       private Set<LazyMethodGen> inlineAccessorMethodGens;
 
        public BcelAccessForInlineMunger(ResolvedType aspectType) {
                super(null, aspectType);
@@ -77,25 +76,23 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger {
        @Override
        public boolean munge(BcelClassWeaver weaver) {
                m_aspectGen = weaver.getLazyClassGen();
-               m_inlineAccessorBcelMethods = new HashMap(0);
-               m_inlineAccessorMethodGens = new HashSet();
+               m_inlineAccessorBcelMethods = new HashMap<String, ResolvedMember>(0);
+               inlineAccessorMethodGens = new HashSet<LazyMethodGen>();
 
                // look for all @Around advices
-               for (Iterator iterator = m_aspectGen.getMethodGens().iterator(); iterator.hasNext();) {
-                       LazyMethodGen methodGen = (LazyMethodGen) iterator.next();
+               for (LazyMethodGen methodGen : m_aspectGen.getMethodGens()) {
                        if (methodGen.hasAnnotation(UnresolvedType.forName("org/aspectj/lang/annotation/Around"))) {
                                openAroundAdvice(methodGen);
                        }
                }
 
                // add the accessors
-               for (Iterator iterator = m_inlineAccessorMethodGens.iterator(); iterator.hasNext();) {
-                       LazyMethodGen lazyMethodGen = (LazyMethodGen) iterator.next();
+               for (LazyMethodGen lazyMethodGen : inlineAccessorMethodGens) {
                        m_aspectGen.addMethodGen(lazyMethodGen);
                }
 
                // flush some
-               m_inlineAccessorMethodGens = null;
+               inlineAccessorMethodGens = null;
                // we keep m_inlineAccessorsResolvedMembers for shadow matching
 
                return true;
@@ -109,7 +106,7 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger {
         */
        @Override
        public ResolvedMember getMatchingSyntheticMember(Member member) {
-               return (ResolvedMember) m_inlineAccessorBcelMethods.get(member.getName());
+               return m_inlineAccessorBcelMethods.get(member.getName());
        }
 
        @Override
@@ -154,9 +151,8 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger {
                                ResolvedType callee = m_aspectGen.getWorld().resolve(UnresolvedType.forName(invoke.getClassName(cpg)));
 
                                // look in the whole method list and not just declared for super calls and alike
-                               List methods = callee.getMethodsWithoutIterator(false, true, false);
-                               for (Iterator iter = methods.iterator(); iter.hasNext();) {
-                                       ResolvedMember resolvedMember = (ResolvedMember) iter.next();
+                               List<ResolvedMember> methods = callee.getMethodsWithoutIterator(false, true, false);
+                               for (ResolvedMember resolvedMember : methods) {
                                        if (invoke.getName(cpg).equals(resolvedMember.getName())
                                                        && invoke.getSignature(cpg).equals(resolvedMember.getSignature()) && !resolvedMember.isPublic()) {
                                                if ("<init>".equals(invoke.getName(cpg))) {
@@ -174,14 +170,14 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger {
                                                                // && aspectType.getSuperclass().getName().equals(resolvedMember.getDeclaringType().getName())) {
                                                                ResolvedMember accessor = createOrGetInlineAccessorForSuperDispatch(resolvedMember);
                                                                InvokeInstruction newInst = factory.createInvoke(aspectType.getName(), accessor.getName(),
-                                                                               BcelWorld.makeBcelType(accessor.getReturnType()), BcelWorld.makeBcelTypes(accessor
-                                                                                               .getParameterTypes()), Constants.INVOKEVIRTUAL);
+                                                                               BcelWorld.makeBcelType(accessor.getReturnType()),
+                                                                               BcelWorld.makeBcelTypes(accessor.getParameterTypes()), Constants.INVOKEVIRTUAL);
                                                                curr.setInstruction(newInst);
                                                        } else {
                                                                ResolvedMember accessor = createOrGetInlineAccessorForMethod(resolvedMember);
                                                                InvokeInstruction newInst = factory.createInvoke(aspectType.getName(), accessor.getName(),
-                                                                               BcelWorld.makeBcelType(accessor.getReturnType()), BcelWorld.makeBcelTypes(accessor
-                                                                                               .getParameterTypes()), Constants.INVOKESTATIC);
+                                                                               BcelWorld.makeBcelType(accessor.getReturnType()),
+                                                                               BcelWorld.makeBcelTypes(accessor.getParameterTypes()), Constants.INVOKESTATIC);
                                                                curr.setInstruction(newInst);
                                                        }
                                                }
@@ -202,9 +198,9 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger {
                                                } else {
                                                        accessor = createOrGetInlineAccessorForFieldSet(resolvedMember);
                                                }
-                                               InvokeInstruction newInst = factory.createInvoke(aspectType.getName(), accessor.getName(), BcelWorld
-                                                               .makeBcelType(accessor.getReturnType()), BcelWorld.makeBcelTypes(accessor.getParameterTypes()),
-                                                               Constants.INVOKESTATIC);
+                                               InvokeInstruction newInst = factory.createInvoke(aspectType.getName(), accessor.getName(),
+                                                               BcelWorld.makeBcelType(accessor.getReturnType()),
+                                                               BcelWorld.makeBcelTypes(accessor.getParameterTypes()), Constants.INVOKESTATIC);
                                                curr.setInstruction(newInst);
 
                                                break;// ok we found a matching callee member and swapped the instruction with the accessor
@@ -232,7 +228,7 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger {
        private ResolvedMember createOrGetInlineAccessorForMethod(ResolvedMember resolvedMember) {
                String accessor = NameMangler.inlineAccessMethodForMethod(resolvedMember.getName(), resolvedMember.getDeclaringType(),
                                aspectType);
-               ResolvedMember inlineAccessor = (ResolvedMember) m_inlineAccessorBcelMethods.get(accessor);
+               ResolvedMember inlineAccessor = m_inlineAccessorBcelMethods.get(accessor);
                if (inlineAccessor == null) {
                        // add static method to aspect
                        inlineAccessor = AjcMemberMaker.inlineAccessMethodForMethod(aspectType, resolvedMember);
@@ -247,7 +243,7 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger {
                        method.addAttribute(Utility.bcelAttribute(new AjAttribute.EffectiveSignatureAttribute(resolvedMember,
                                        Shadow.MethodCall, false), m_aspectGen.getConstantPool()));
 
-                       m_inlineAccessorMethodGens.add(method);
+                       inlineAccessorMethodGens.add(method);
 
                        InstructionList il = method.getBody();
                        int register = 0;
@@ -274,7 +270,7 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger {
         */
        private ResolvedMember createOrGetInlineAccessorForSuperDispatch(ResolvedMember resolvedMember) {
                String accessor = NameMangler.superDispatchMethod(aspectType, resolvedMember.getName());
-               ResolvedMember inlineAccessor = (ResolvedMember) m_inlineAccessorBcelMethods.get(accessor);
+               ResolvedMember inlineAccessor = m_inlineAccessorBcelMethods.get(accessor);
                if (inlineAccessor == null) {
                        // add super accessor method to class:
                        inlineAccessor = AjcMemberMaker.superAccessMethod(aspectType, resolvedMember);
@@ -289,7 +285,7 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger {
                        method.addAttribute(Utility.bcelAttribute(new AjAttribute.EffectiveSignatureAttribute(resolvedMember,
                                        Shadow.MethodCall, false), m_aspectGen.getConstantPool()));
 
-                       m_inlineAccessorMethodGens.add(method);
+                       inlineAccessorMethodGens.add(method);
 
                        InstructionList il = method.getBody();
                        il.append(InstructionConstants.ALOAD_0);
@@ -317,7 +313,7 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger {
        private ResolvedMember createOrGetInlineAccessorForFieldGet(ResolvedMember resolvedMember) {
                String accessor = NameMangler.inlineAccessMethodForFieldGet(resolvedMember.getName(), resolvedMember.getDeclaringType(),
                                aspectType);
-               ResolvedMember inlineAccessor = (ResolvedMember) m_inlineAccessorBcelMethods.get(accessor);
+               ResolvedMember inlineAccessor = m_inlineAccessorBcelMethods.get(accessor);
                if (inlineAccessor == null) {
                        // add static method to aspect
                        inlineAccessor = AjcMemberMaker.inlineAccessMethodForFieldGet(aspectType, resolvedMember);
@@ -332,7 +328,7 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger {
                        method.addAttribute(Utility.bcelAttribute(new AjAttribute.EffectiveSignatureAttribute(resolvedMember, Shadow.FieldGet,
                                        false), m_aspectGen.getConstantPool()));
 
-                       m_inlineAccessorMethodGens.add(method);
+                       inlineAccessorMethodGens.add(method);
 
                        InstructionList il = method.getBody();
                        if (Modifier.isStatic(resolvedMember.getModifiers())) {
@@ -357,7 +353,7 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger {
        private ResolvedMember createOrGetInlineAccessorForFieldSet(ResolvedMember resolvedMember) {
                String accessor = NameMangler.inlineAccessMethodForFieldSet(resolvedMember.getName(), resolvedMember.getDeclaringType(),
                                aspectType);
-               ResolvedMember inlineAccessor = (ResolvedMember) m_inlineAccessorBcelMethods.get(accessor);
+               ResolvedMember inlineAccessor = m_inlineAccessorBcelMethods.get(accessor);
                if (inlineAccessor == null) {
                        // add static method to aspect
                        inlineAccessor = AjcMemberMaker.inlineAccessMethodForFieldSet(aspectType, resolvedMember);
@@ -372,7 +368,7 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger {
                        method.addAttribute(Utility.bcelAttribute(new AjAttribute.EffectiveSignatureAttribute(resolvedMember, Shadow.FieldSet,
                                        false), m_aspectGen.getConstantPool()));
 
-                       m_inlineAccessorMethodGens.add(method);
+                       inlineAccessorMethodGens.add(method);
 
                        InstructionList il = method.getBody();
                        if (Modifier.isStatic(resolvedMember.getModifiers())) {
index ef102adbc25eaf638359e4291c7a8f894ef7ea2d..f8d48c7bcf6ebc69c632c50cba82da6fd06aa6a2 100644 (file)
@@ -91,8 +91,8 @@ class BcelAdvice extends Advice {
                                        if (bm.getMethod() != null && bm.getMethod().getAnnotations() != null) {
                                                return adviceSignature;
                                        }
-                                       ResolvedMemberImpl simplermember = new ResolvedMemberImpl(bm.getKind(), bm.getDeclaringType(), bm
-                                                       .getModifiers(), bm.getReturnType(), bm.getName(), bm.getParameterTypes());// ,bm.getExceptions(),bm.getBackingGenericMember()
+                                       ResolvedMemberImpl simplermember = new ResolvedMemberImpl(bm.getKind(), bm.getDeclaringType(),
+                                                       bm.getModifiers(), bm.getReturnType(), bm.getName(), bm.getParameterTypes());// ,bm.getExceptions(),bm.getBackingGenericMember()
                                        // );
                                        simplermember.setParameterNames(bm.getParameterNames());
                                        return simplermember;
@@ -126,7 +126,7 @@ class BcelAdvice extends Advice {
        }
 
        @Override
-       public ShadowMunger parameterizeWith(ResolvedType declaringType, Map typeVariableMap) {
+       public ShadowMunger parameterizeWith(ResolvedType declaringType, Map<String, UnresolvedType> typeVariableMap) {
                Pointcut pc = getPointcut().parameterizeWith(typeVariableMap, declaringType.getWorld());
 
                BcelAdvice ret = null;
@@ -274,8 +274,8 @@ class BcelAdvice extends Advice {
                                if (resolvedMember instanceof BcelMethod && shadow.getEnclosingShadow() instanceof BcelShadow) {
                                        Member enclosingMember = shadow.getEnclosingShadow().getSignature();
                                        if (enclosingMember instanceof BcelMethod) {
-                                               removeUnnecessaryProblems((BcelMethod) enclosingMember, ((BcelMethod) resolvedMember)
-                                                               .getDeclarationLineNumber());
+                                               removeUnnecessaryProblems((BcelMethod) enclosingMember,
+                                                               ((BcelMethod) resolvedMember).getDeclarationLineNumber());
                                        }
                                }
                        }
@@ -283,8 +283,8 @@ class BcelAdvice extends Advice {
 
                if (shadow.getIWorld().isJoinpointSynchronizationEnabled() && shadow.getKind() == Shadow.MethodExecution
                                && (s.getSignature().getModifiers() & Modifier.SYNCHRONIZED) != 0) {
-                       shadow.getIWorld().getLint().advisingSynchronizedMethods.signal(new String[] { shadow.toString() }, shadow
-                                       .getSourceLocation(), new ISourceLocation[] { getSourceLocation() });
+                       shadow.getIWorld().getLint().advisingSynchronizedMethods.signal(new String[] { shadow.toString() },
+                                       shadow.getSourceLocation(), new ISourceLocation[] { getSourceLocation() });
                }
 
                // FIXME AV - see #75442, this logic is not enough so for now comment it out until we fix the bug
@@ -334,8 +334,8 @@ class BcelAdvice extends Advice {
                        LazyClassGen enclosingClass = shadow.getEnclosingClass();
                        if (enclosingClass != null && enclosingClass.isInterface() && shadow.getEnclosingMethod().getName().charAt(0) == '<') {
                                // Do not add methods with bodies to an interface (252198, 163005)
-                               shadow.getWorld().getLint().cannotAdviseJoinpointInInterfaceWithAroundAdvice.signal(shadow.toString(), shadow
-                                               .getSourceLocation());
+                               shadow.getWorld().getLint().cannotAdviseJoinpointInInterfaceWithAroundAdvice.signal(shadow.toString(),
+                                               shadow.getSourceLocation());
                                return false;
                        }
                        if (!canInline(s)) {
@@ -384,8 +384,9 @@ class BcelAdvice extends Advice {
                for (int i = 0, len = excs.length; i < len; i++) {
                        ResolvedType t = world.resolve(excs[i], true);
                        if (t.isMissing()) {
-                               world.getLint().cantFindType.signal(WeaverMessages.format(WeaverMessages.CANT_FIND_TYPE_EXCEPTION_TYPE, excs[i]
-                                               .getName()), getSourceLocation());
+                               world.getLint().cantFindType
+                                               .signal(WeaverMessages.format(WeaverMessages.CANT_FIND_TYPE_EXCEPTION_TYPE, excs[i].getName()),
+                                                               getSourceLocation());
                                // IMessage msg = new Message(
                                // WeaverMessages.format(WeaverMessages.CANT_FIND_TYPE_EXCEPTION_TYPE,excs[i].getName()),
                                // "",IMessage.ERROR,getSourceLocation(),null,null);
@@ -468,8 +469,8 @@ class BcelAdvice extends Advice {
                if (hasExtraParameter() && getKind() == AdviceKind.AfterReturning) {
                        UnresolvedType extraParameterType = getExtraParameterType();
                        if (!extraParameterType.equals(UnresolvedType.OBJECT) && !extraParameterType.isPrimitiveType()) {
-                               il.append(BcelRenderer.renderTest(fact, world, Test.makeInstanceof(extraArgVar, getExtraParameterType().resolve(
-                                               world)), null, ifNoAdvice, null));
+                               il.append(BcelRenderer.renderTest(fact, world,
+                                               Test.makeInstanceof(extraArgVar, getExtraParameterType().resolve(world)), null, ifNoAdvice, null));
                        }
                }
                il.append(getAdviceArgSetup(shadow, extraArgVar, null));
@@ -522,7 +523,7 @@ class BcelAdvice extends Advice {
                // BcelWorld.makeBcelType(targetAspectField.getType()),
                // Constants.GETSTATIC));
                // }
-               //        
+               //
                // System.err.println("BcelAdvice: " + exposedState);
 
                if (exposedState.getAspectInstance() != null) {
@@ -551,9 +552,12 @@ class BcelAdvice extends Advice {
                                                // make sure we are in an around, since we deal with the closure, not the arg here
                                                if (getKind() != AdviceKind.Around) {
                                                        previousIsClosure = false;
-                                                       getConcreteAspect().getWorld().getMessageHandler().handleMessage(
-                                                                       new Message("use of ProceedingJoinPoint is allowed only on around advice (" + "arg " + i
-                                                                                       + " in " + toString() + ")", this.getSourceLocation(), true));
+                                                       getConcreteAspect()
+                                                                       .getWorld()
+                                                                       .getMessageHandler()
+                                                                       .handleMessage(
+                                                                                       new Message("use of ProceedingJoinPoint is allowed only on around advice (" + "arg "
+                                                                                                       + i + " in " + toString() + ")", this.getSourceLocation(), true));
                                                        // try to avoid verify error and pass in null
                                                        il.append(InstructionConstants.ACONST_NULL);
                                                } else {
@@ -586,9 +590,12 @@ class BcelAdvice extends Advice {
                                                extraVar.appendLoadAndConvert(il, fact, getExtraParameterType().resolve(world));
                                        } else {
                                                previousIsClosure = false;
-                                               getConcreteAspect().getWorld().getMessageHandler().handleMessage(
-                                                               new Message("use of ProceedingJoinPoint is allowed only on around advice (" + "arg " + i + " in "
-                                                                               + toString() + ")", this.getSourceLocation(), true));
+                                               getConcreteAspect()
+                                                               .getWorld()
+                                                               .getMessageHandler()
+                                                               .handleMessage(
+                                                                               new Message("use of ProceedingJoinPoint is allowed only on around advice (" + "arg " + i
+                                                                                               + " in " + toString() + ")", this.getSourceLocation(), true));
                                                // try to avoid verify error and pass in null
                                                il.append(InstructionConstants.ACONST_NULL);
                                        }
index 0bc63ff0a8b710784191bad3a19188cd2f07de68..5990bec495da24f969f732a3f5cfa95162f36d14 100644 (file)
@@ -93,7 +93,7 @@ class BcelClassWeaver implements IClassWeaver {
        private static Trace trace = TraceFactory.getTraceFactory().getTrace(BcelClassWeaver.class);
 
        public static boolean weave(BcelWorld world, LazyClassGen clazz, List<ShadowMunger> shadowMungers,
-                       List<ConcreteTypeMunger> typeMungers, List lateTypeMungers, boolean inReweavableMode) {
+                       List<ConcreteTypeMunger> typeMungers, List<ConcreteTypeMunger> lateTypeMungers, boolean inReweavableMode) {
                BcelClassWeaver classWeaver = new BcelClassWeaver(world, clazz, shadowMungers, typeMungers, lateTypeMungers);
                classWeaver.setReweavableMode(inReweavableMode);
                boolean b = classWeaver.weave();
@@ -105,7 +105,7 @@ class BcelClassWeaver implements IClassWeaver {
        private final LazyClassGen clazz;
        private final List<ShadowMunger> shadowMungers;
        private final List<ConcreteTypeMunger> typeMungers;
-       private final List lateTypeMungers;
+       private final List<ConcreteTypeMunger> lateTypeMungers;
 
        private List<ShadowMunger>[] indexedShadowMungers;
        private boolean canMatchBodyShadows = false;
@@ -136,7 +136,7 @@ class BcelClassWeaver implements IClassWeaver {
        private final List<BcelShadow> initializationShadows = new ArrayList<BcelShadow>();
 
        private BcelClassWeaver(BcelWorld world, LazyClassGen clazz, List<ShadowMunger> shadowMungers,
-                       List<ConcreteTypeMunger> typeMungers, List lateTypeMungers) {
+                       List<ConcreteTypeMunger> typeMungers, List<ConcreteTypeMunger> lateTypeMungers) {
                super();
                this.world = world;
                this.clazz = clazz;
@@ -334,8 +334,8 @@ class BcelClassWeaver implements IClassWeaver {
                        mods = mods - Modifier.ABSTRACT;
                }
 
-               LazyMethodGen ret = new LazyMethodGen(mods, BcelWorld.makeBcelType(member.getReturnType()), member.getName(), BcelWorld
-                               .makeBcelTypes(member.getParameterTypes()), UnresolvedType.getNames(member.getExceptions()), gen);
+               LazyMethodGen ret = new LazyMethodGen(mods, BcelWorld.makeBcelType(member.getReturnType()), member.getName(),
+                               BcelWorld.makeBcelTypes(member.getParameterTypes()), UnresolvedType.getNames(member.getExceptions()), gen);
 
                // 43972 : Static crosscutting makes interfaces unusable for javac
                // ret.makeSynthetic();
@@ -355,8 +355,8 @@ class BcelClassWeaver implements IClassWeaver {
 
                if (whatToBridgeTo == null) {
                        whatToBridgeTo = new ResolvedMemberImpl(Member.METHOD, whatToBridgeToMethodGen.getEnclosingClass().getType(),
-                                       whatToBridgeToMethodGen.getAccessFlags(), whatToBridgeToMethodGen.getName(), whatToBridgeToMethodGen
-                                                       .getSignature());
+                                       whatToBridgeToMethodGen.getAccessFlags(), whatToBridgeToMethodGen.getName(),
+                                       whatToBridgeToMethodGen.getSignature());
                }
                // The bridge method in this type will have the same signature as the one in the supertype
                LazyMethodGen bridgeMethod = makeBridgeMethod(clazz, theBridgeMethod);
@@ -401,8 +401,8 @@ class BcelClassWeaver implements IClassWeaver {
         */
        public boolean weave() {
                if (clazz.isWoven() && !clazz.isReweavable()) {
-                       world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.ALREADY_WOVEN, clazz.getType().getName()), ty
-                                       .getSourceLocation(), null);
+                       world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.ALREADY_WOVEN, clazz.getType().getName()),
+                                       ty.getSourceLocation(), null);
                        return false;
                }
 
@@ -854,8 +854,8 @@ class BcelClassWeaver implements IClassWeaver {
                                        System.err.println("Bridging:checking superinterface " + interfaces[j]);
                                }
                                ResolvedType interfaceType = world.resolve(interfaces[j]);
-                               overriddenMethod = checkForOverride(interfaceType, name, psig, rsig, bridgeToCandidate.getAccessFlags(), clazz
-                                               .getPackageName(), bm);
+                               overriddenMethod = checkForOverride(interfaceType, name, psig, rsig, bridgeToCandidate.getAccessFlags(),
+                                               clazz.getPackageName(), bm);
                                if (overriddenMethod != null) {
                                        String key = new StringBuffer().append(overriddenMethod.getName())
                                                        .append(overriddenMethod.getSignatureErased()).toString(); // pr
@@ -937,8 +937,8 @@ class BcelClassWeaver implements IClassWeaver {
                                                        annotationsToAdd.add(ag);
                                                        mg.addAnnotation(decaM.getAnnotation());
 
-                                                       AsmRelationshipProvider.addDeclareAnnotationMethodRelationship(decaM.getSourceLocation(), clazz
-                                                                       .getName(), mg.getMemberView(), world.getModelAsAsmManager());// getMethod());
+                                                       AsmRelationshipProvider.addDeclareAnnotationMethodRelationship(decaM.getSourceLocation(),
+                                                                       clazz.getName(), mg.getMemberView(), world.getModelAsAsmManager());// getMethod());
                                                        reportMethodCtorWeavingMessage(clazz, mg.getMemberView(), decaM, mg.getDeclarationLineNumber());
                                                        isChanged = true;
                                                        modificationOccured = true;
@@ -979,8 +979,8 @@ class BcelClassWeaver implements IClassWeaver {
                                                                AnnotationGen ag = new AnnotationGen(a, clazz.getConstantPool(), true);
                                                                annotationsToAdd.add(ag);
                                                                mg.addAnnotation(decaM.getAnnotation());
-                                                               AsmRelationshipProvider.addDeclareAnnotationMethodRelationship(decaM.getSourceLocation(), clazz
-                                                                               .getName(), mg.getMemberView(), world.getModelAsAsmManager());// getMethod());
+                                                               AsmRelationshipProvider.addDeclareAnnotationMethodRelationship(decaM.getSourceLocation(),
+                                                                               clazz.getName(), mg.getMemberView(), world.getModelAsAsmManager());// getMethod());
                                                                isChanged = true;
                                                                modificationOccured = true;
                                                                forRemoval.add(decaM);
@@ -1047,10 +1047,11 @@ class BcelClassWeaver implements IClassWeaver {
                                }
                        }
                        getWorld().getMessageHandler().handleMessage(
-                                       WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_ANNOTATES, new String[] { sig.toString(),
-                                                       loc.toString(), decaM.getAnnotationString(),
-                                                       methodName.startsWith("<init>") ? "constructor" : "method", decaM.getAspect().toString(),
-                                                       Utility.beautifyLocation(decaM.getSourceLocation()) }));
+                                       WeaveMessage.constructWeavingMessage(
+                                                       WeaveMessage.WEAVEMESSAGE_ANNOTATES,
+                                                       new String[] { sig.toString(), loc.toString(), decaM.getAnnotationString(),
+                                                                       methodName.startsWith("<init>") ? "constructor" : "method", decaM.getAspect().toString(),
+                                                                       Utility.beautifyLocation(decaM.getSourceLocation()) }));
                }
        }
 
@@ -1138,8 +1139,8 @@ class BcelClassWeaver implements IClassWeaver {
                                                continue; // skip this one...
                                        }
                                        annotationHolder.addAnnotation(decaF.getAnnotation());
-                                       AsmRelationshipProvider.addDeclareAnnotationRelationship(world.getModelAsAsmManager(), decaF
-                                                       .getSourceLocation(), itdIsActually.getSourceLocation());
+                                       AsmRelationshipProvider.addDeclareAnnotationRelationship(world.getModelAsAsmManager(),
+                                                       decaF.getSourceLocation(), itdIsActually.getSourceLocation());
                                        isChanged = true;
                                        modificationOccured = true;
 
@@ -1163,8 +1164,8 @@ class BcelClassWeaver implements IClassWeaver {
                                                        continue; // skip this one...
                                                }
                                                annotationHolder.addAnnotation(decaF.getAnnotation());
-                                               AsmRelationshipProvider.addDeclareAnnotationRelationship(world.getModelAsAsmManager(), decaF
-                                                               .getSourceLocation(), itdIsActually.getSourceLocation());
+                                               AsmRelationshipProvider.addDeclareAnnotationRelationship(world.getModelAsAsmManager(),
+                                                               decaF.getSourceLocation(), itdIsActually.getSourceLocation());
                                                isChanged = true;
                                                modificationOccured = true;
                                                forRemoval.add(decaF);
@@ -1348,8 +1349,8 @@ class BcelClassWeaver implements IClassWeaver {
                                                                }
                                                        }
 
-                                                       AsmRelationshipProvider.addDeclareAnnotationFieldRelationship(world.getModelAsAsmManager(), decaF
-                                                                       .getSourceLocation(), clazz.getName(), aBcelField);
+                                                       AsmRelationshipProvider.addDeclareAnnotationFieldRelationship(world.getModelAsAsmManager(),
+                                                                       decaF.getSourceLocation(), clazz.getName(), aBcelField);
                                                        reportFieldAnnotationWeavingMessage(clazz, fields, fieldCounter, decaF);
                                                        isChanged = true;
                                                        modificationOccured = true;
@@ -1384,8 +1385,8 @@ class BcelClassWeaver implements IClassWeaver {
                                                                        continue; // skip this one...
                                                                }
                                                                aBcelField.addAnnotation(decaF.getAnnotation());
-                                                               AsmRelationshipProvider.addDeclareAnnotationFieldRelationship(world.getModelAsAsmManager(), decaF
-                                                                               .getSourceLocation(), clazz.getName(), aBcelField);
+                                                               AsmRelationshipProvider.addDeclareAnnotationFieldRelationship(world.getModelAsAsmManager(),
+                                                                               decaF.getSourceLocation(), clazz.getName(), aBcelField);
                                                                isChanged = true;
                                                                modificationOccured = true;
                                                                forRemoval.add(decaF);
@@ -1455,11 +1456,11 @@ class BcelClassWeaver implements IClassWeaver {
                                if (!itdMatch) {
                                        IMessage message = null;
                                        if (isDeclareAtField) {
-                                               message = new Message("The field '" + declA.getSignaturePattern().toString() + "' does not exist", declA
-                                                               .getSourceLocation(), true);
+                                               message = new Message("The field '" + declA.getSignaturePattern().toString() + "' does not exist",
+                                                               declA.getSourceLocation(), true);
                                        } else {
-                                               message = new Message("The method '" + declA.getSignaturePattern().toString() + "' does not exist", declA
-                                                               .getSourceLocation(), true);
+                                               message = new Message("The method '" + declA.getSignaturePattern().toString() + "' does not exist",
+                                                               declA.getSourceLocation(), true);
                                        }
                                        world.getMessageHandler().handleMessage(message);
                                }
@@ -1472,10 +1473,11 @@ class BcelClassWeaver implements IClassWeaver {
                if (!getWorld().getMessageHandler().isIgnoring(IMessage.WEAVEINFO)) {
                        BcelField theField = (BcelField) fields.get(fieldCounter);
                        world.getMessageHandler().handleMessage(
-                                       WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_ANNOTATES, new String[] {
-                                                       theField.getFieldAsIs().toString() + "' of type '" + clazz.getName(), clazz.getFileName(),
-                                                       decaF.getAnnotationString(), "field", decaF.getAspect().toString(),
-                                                       Utility.beautifyLocation(decaF.getSourceLocation()) }));
+                                       WeaveMessage.constructWeavingMessage(
+                                                       WeaveMessage.WEAVEMESSAGE_ANNOTATES,
+                                                       new String[] { theField.getFieldAsIs().toString() + "' of type '" + clazz.getName(),
+                                                                       clazz.getFileName(), decaF.getAnnotationString(), "field", decaF.getAspect().toString(),
+                                                                       Utility.beautifyLocation(decaF.getSourceLocation()) }));
                }
        }
 
@@ -1489,8 +1491,8 @@ class BcelClassWeaver implements IClassWeaver {
                                if (!reportedProblems.contains(uniqueID)) {
                                        reportedProblems.add(uniqueID);
                                        world.getLint().elementAlreadyAnnotated.signal(new String[] { rm.toString(),
-                                                       deca.getAnnotationType().toString() }, rm.getSourceLocation(), new ISourceLocation[] { deca
-                                                       .getSourceLocation() });
+                                                       deca.getAnnotationType().toString() }, rm.getSourceLocation(),
+                                                       new ISourceLocation[] { deca.getSourceLocation() });
                                }
                        }
                        return true;
@@ -1507,8 +1509,8 @@ class BcelClassWeaver implements IClassWeaver {
                                        reportedProblems.add(uniqueID);
                                        reportedProblems.add(new Integer(itdfieldsig.hashCode() * deca.hashCode()));
                                        world.getLint().elementAlreadyAnnotated.signal(new String[] { itdfieldsig.toString(),
-                                                       deca.getAnnotationType().toString() }, rm.getSourceLocation(), new ISourceLocation[] { deca
-                                                       .getSourceLocation() });
+                                                       deca.getAnnotationType().toString() }, rm.getSourceLocation(),
+                                                       new ISourceLocation[] { deca.getSourceLocation() });
                                }
                        }
                        return true;
@@ -1621,7 +1623,7 @@ class BcelClassWeaver implements IClassWeaver {
        // return new BcelVar(typeX.resolve(world),
        // genTempVarIndex(typeX.getSize()));
        // }
-       //       
+       //
        // private int genTempVarIndex(int size) {
        // return enclosingMethod.allocateLocal(size);
        // }
@@ -1670,7 +1672,7 @@ class BcelClassWeaver implements IClassWeaver {
                                // will ensure monitorexit is called. Content on the finally
                                // block seems to
                                // be always:
-                               // 
+                               //
                                // E1: ALOAD_1
                                // MONITOREXIT
                                // ATHROW
@@ -1788,7 +1790,7 @@ class BcelClassWeaver implements IClassWeaver {
                                // 32: dup <-- partTwo (branch target)
                                // 33: astore_0
                                // 34: monitorenter
-                               //                      
+                               //
                                // plus exceptiontable entry!
                                // 8 13 20 Class java/lang/ClassNotFoundException
                                Type classType = BcelWorld.makeBcelType(synchronizedMethod.getEnclosingClass().getType());
@@ -1833,8 +1835,8 @@ class BcelClassWeaver implements IClassWeaver {
                                InstructionHandle catchInstruction = prepend.getEnd();
                                prepend.append(InstructionFactory.createDup(1));
 
-                               prepend.append(fact.createPutStatic(synchronizedMethod.getEnclosingClass().getType().getName(), fieldname, Type
-                                               .getType(Class.class)));
+                               prepend.append(fact.createPutStatic(synchronizedMethod.getEnclosingClass().getType().getName(), fieldname,
+                                               Type.getType(Class.class)));
                                prepend.append(InstructionFactory.createBranchInstruction(Constants.GOTO, parttwo.getStart()));
 
                                // start of catch block
@@ -1842,8 +1844,8 @@ class BcelClassWeaver implements IClassWeaver {
                                catchBlockForLiteralLoadingFail.append(fact.createNew((ObjectType) Type.getType(NoClassDefFoundError.class)));
                                catchBlockForLiteralLoadingFail.append(InstructionFactory.createDup_1(1));
                                catchBlockForLiteralLoadingFail.append(InstructionFactory.SWAP);
-                               catchBlockForLiteralLoadingFail.append(fact.createInvoke("java.lang.Throwable", "getMessage", Type
-                                               .getType(String.class), new Type[] {}, Constants.INVOKEVIRTUAL));
+                               catchBlockForLiteralLoadingFail.append(fact.createInvoke("java.lang.Throwable", "getMessage",
+                                               Type.getType(String.class), new Type[] {}, Constants.INVOKEVIRTUAL));
                                catchBlockForLiteralLoadingFail.append(fact.createInvoke("java.lang.NoClassDefFoundError", "<init>", Type.VOID,
                                                new Type[] { Type.getType(String.class) }, Constants.INVOKESPECIAL));
                                catchBlockForLiteralLoadingFail.append(InstructionFactory.ATHROW);
@@ -1871,7 +1873,7 @@ class BcelClassWeaver implements IClassWeaver {
                                // will ensure monitorexit is called. Content on the finally
                                // block seems to
                                // be always:
-                               // 
+                               //
                                // E1: ALOAD_1
                                // MONITOREXIT
                                // ATHROW
@@ -1965,8 +1967,8 @@ class BcelClassWeaver implements IClassWeaver {
 
                                synchronizedMethod.getBody().append(finallyBlock);
                                synchronizedMethod.addExceptionHandler(tryPosition, catchPosition, finallyStart, null/* ==finally */, false);
-                               synchronizedMethod.addExceptionHandler(tryInstruction, catchInstruction, catchBlockStart, (ObjectType) Type
-                                               .getType(ClassNotFoundException.class), true);
+                               synchronizedMethod.addExceptionHandler(tryInstruction, catchInstruction, catchBlockStart,
+                                               (ObjectType) Type.getType(ClassNotFoundException.class), true);
                                synchronizedMethod.addExceptionHandler(finallyStart, finallyStart.getNext(), finallyStart, null, false);
                        }
                } else {
@@ -1992,7 +1994,7 @@ class BcelClassWeaver implements IClassWeaver {
                        // will ensure monitorexit is called. Content on the finally block
                        // seems to
                        // be always:
-                       // 
+                       //
                        // E1: ALOAD_1
                        // MONITOREXIT
                        // ATHROW
@@ -2211,8 +2213,8 @@ class BcelClassWeaver implements IClassWeaver {
                                                        LocalVariableTag lvTag = (LocalVariableTag) old;
                                                        LocalVariableTag lvTagFresh = (LocalVariableTag) fresh;
                                                        if (lvTag.getSlot() == 0) {
-                                                               fresh = new LocalVariableTag(lvTag.getRealType().getSignature(), "ajc$aspectInstance", frameEnv
-                                                                               .get(lvTag.getSlot()), 0);
+                                                               fresh = new LocalVariableTag(lvTag.getRealType().getSignature(), "ajc$aspectInstance",
+                                                                               frameEnv.get(lvTag.getSlot()), 0);
                                                        } else {
                                                                // // Do not move it - when copying the code from the aspect to the affected target, 'this' is
                                                                // // going to change from aspect to affected type. So just fix the type
@@ -2268,7 +2270,7 @@ class BcelClassWeaver implements IClassWeaver {
        // InstructionList newList = new InstructionList();
        //
        // Map srcToDest = new HashMap();
-       //                      
+       //
        // // first pass: copy the instructions directly, populate the srcToDest
        // map,
        // // fix frame instructions
@@ -2313,7 +2315,7 @@ class BcelClassWeaver implements IClassWeaver {
        // }
        // srcToDest.put(src, dest);
        // }
-       //                      
+       //
        // // second pass: retarget branch instructions, copy ranges and tags
        // Map tagMap = new HashMap();
        // for (InstructionHandle dest = newList.getStart(), src =
@@ -2321,7 +2323,7 @@ class BcelClassWeaver implements IClassWeaver {
        // dest != null;
        // dest = dest.getNext(), src = src.getNext()) {
        // Instruction inst = dest.getInstruction();
-       //                              
+       //
        // // retarget branches
        // if (inst instanceof InstructionBranch) {
        // InstructionBranch branch = (InstructionBranch) inst;
@@ -2344,7 +2346,7 @@ class BcelClassWeaver implements IClassWeaver {
        // }
        // }
        // }
-       //                              
+       //
        // //copy over tags and range attributes
        // Iterator tIter = src.getTargeters().iterator();
        //
@@ -2987,8 +2989,8 @@ class BcelClassWeaver implements IClassWeaver {
                                                annotations = theRealMember.getAnnotationTypes();
                                        }
                                } else if (rm.getKind() == Member.CONSTRUCTOR) {
-                                       ResolvedMember realThing = AjcMemberMaker.postIntroducedConstructor(memberHostType.resolve(world), rm
-                                                       .getDeclaringType(), rm.getParameterTypes());
+                                       ResolvedMember realThing = AjcMemberMaker.postIntroducedConstructor(memberHostType.resolve(world),
+                                                       rm.getDeclaringType(), rm.getParameterTypes());
                                        ResolvedMember resolvedDooberry = world.resolve(realThing);
                                        // AMC temp guard for M4
                                        if (resolvedDooberry == null) {
index 85e2a608b78118aa4c6aafc9efd85b46105245e5..b11f8577e9b207bfaf0af2dbb694fcd6106e0a3c 100644 (file)
@@ -28,10 +28,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.jar.Attributes;
+import java.util.jar.Attributes.Name;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 import java.util.jar.Manifest;
-import java.util.jar.Attributes.Name;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
 import java.util.zip.ZipOutputStream;
@@ -115,7 +115,7 @@ public class BcelWeaver {
        // These four are setup by prepareForWeave
        private transient List<ShadowMunger> shadowMungerList = null;
        private transient List<ConcreteTypeMunger> typeMungerList = null;
-       private transient List lateTypeMungerList = null;
+       private transient List<ConcreteTypeMunger> lateTypeMungerList = null;
        private transient List declareParentsList = null;
 
        private Manifest manifest = null;
@@ -928,8 +928,8 @@ public class BcelWeaver {
         * @param userPointcut
         */
        private void raiseUnboundFormalError(String name, Pointcut userPointcut) {
-               world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.UNBOUND_FORMAL, name), userPointcut
-                               .getSourceLocation(), null);
+               world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.UNBOUND_FORMAL, name),
+                               userPointcut.getSourceLocation(), null);
        }
 
        public void addManifest(Manifest newManifest) {
@@ -1331,8 +1331,8 @@ public class BcelWeaver {
                                        ResolvedType rtx = world.resolve(UnresolvedType.forSignature(requiredTypeSignature), true);
                                        boolean exists = !rtx.isMissing();
                                        if (!exists) {
-                                               world.getLint().missingAspectForReweaving.signal(new String[] { rtx.getName(), className }, classType
-                                                               .getSourceLocation(), null);
+                                               world.getLint().missingAspectForReweaving.signal(new String[] { rtx.getName(), className },
+                                                               classType.getSourceLocation(), null);
                                                // world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.MISSING_REWEAVABLE_TYPE,
                                                // requiredTypeName, className), classType.getSourceLocation(), null);
                                        } else {
@@ -1349,8 +1349,8 @@ public class BcelWeaver {
                                                                world.showMessage(IMessage.ERROR, WeaverMessages.format(
                                                                                WeaverMessages.REWEAVABLE_ASPECT_NOT_REGISTERED, rtx.getName(), className), null, null);
                                                        } else if (!world.getMessageHandler().isIgnoring(IMessage.INFO)) {
-                                                               world.showMessage(IMessage.INFO, WeaverMessages.format(WeaverMessages.VERIFIED_REWEAVABLE_TYPE, rtx
-                                                                               .getName(), rtx.getSourceLocation().getSourceFile()), null, null);
+                                                               world.showMessage(IMessage.INFO, WeaverMessages.format(WeaverMessages.VERIFIED_REWEAVABLE_TYPE,
+                                                                               rtx.getName(), rtx.getSourceLocation().getSourceFile()), null, null);
                                                        }
                                                }
                                                alreadyConfirmedReweavableState.add(requiredTypeSignature);
@@ -1416,12 +1416,12 @@ public class BcelWeaver {
        }
 
        public UnwovenClassFile[] getClassFilesFor(LazyClassGen clazz) {
-               List childClasses = clazz.getChildClasses(world);
+               List<UnwovenClassFile.ChildClass> childClasses = clazz.getChildClasses(world);
                UnwovenClassFile[] ret = new UnwovenClassFile[1 + childClasses.size()];
                ret[0] = new UnwovenClassFile(clazz.getFileName(), clazz.getClassName(), clazz.getJavaClassBytesIncludingReweavable(world));
                int index = 1;
-               for (Iterator iter = childClasses.iterator(); iter.hasNext();) {
-                       UnwovenClassFile.ChildClass element = (UnwovenClassFile.ChildClass) iter.next();
+               for (Iterator<UnwovenClassFile.ChildClass> iter = childClasses.iterator(); iter.hasNext();) {
+                       UnwovenClassFile.ChildClass element = iter.next();
                        UnwovenClassFile childClass = new UnwovenClassFile(clazz.getFileName() + "$" + element.name, element.bytes);
                        ret[index++] = childClass;
                }
@@ -1525,10 +1525,11 @@ public class BcelWeaver {
                                // TAG: WeavingMessage
                                if (!getWorld().getMessageHandler().isIgnoring(IMessage.WEAVEINFO)) {
                                        getWorld().getMessageHandler().handleMessage(
-                                                       WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_ANNOTATES, new String[] {
-                                                                       onType.toString(), Utility.beautifyLocation(onType.getSourceLocation()),
-                                                                       decA.getAnnotationString(), "type", decA.getAspect().toString(),
-                                                                       Utility.beautifyLocation(decA.getSourceLocation()) }));
+                                                       WeaveMessage.constructWeavingMessage(
+                                                                       WeaveMessage.WEAVEMESSAGE_ANNOTATES,
+                                                                       new String[] { onType.toString(), Utility.beautifyLocation(onType.getSourceLocation()),
+                                                                                       decA.getAnnotationString(), "type", decA.getAspect().toString(),
+                                                                                       Utility.beautifyLocation(decA.getSourceLocation()) }));
                                }
                                didSomething = true;
                                ResolvedTypeMunger newAnnotationTM = new AnnotationOnTypeMunger(annoX);
@@ -1551,13 +1552,15 @@ public class BcelWeaver {
                                if (outputProblems) {
                                        if (decA.isExactPattern()) {
                                                world.getMessageHandler().handleMessage(
-                                                               MessageUtil.error(WeaverMessages.format(WeaverMessages.INCORRECT_TARGET_FOR_DECLARE_ANNOTATION,
-                                                                               onType.getName(), annoX.getTypeName(), annoX.getValidTargets()), decA.getSourceLocation()));
+                                                               MessageUtil.error(
+                                                                               WeaverMessages.format(WeaverMessages.INCORRECT_TARGET_FOR_DECLARE_ANNOTATION,
+                                                                                               onType.getName(), annoX.getTypeName(), annoX.getValidTargets()),
+                                                                               decA.getSourceLocation()));
                                        } else {
                                                if (world.getLint().invalidTargetForAnnotation.isEnabled()) {
                                                        world.getLint().invalidTargetForAnnotation.signal(new String[] { onType.getName(), annoX.getTypeName(),
-                                                                       annoX.getValidTargets() }, decA.getSourceLocation(), new ISourceLocation[] { onType
-                                                                       .getSourceLocation() });
+                                                                       annoX.getValidTargets() }, decA.getSourceLocation(),
+                                                                       new ISourceLocation[] { onType.getSourceLocation() });
                                                }
                                        }
                                }
@@ -1600,8 +1603,8 @@ public class BcelWeaver {
        }
 
        public void weaveNormalTypeMungers(ResolvedType onType) {
-               ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.PROCESSING_TYPE_MUNGERS, onType
-                               .getName());
+               ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.PROCESSING_TYPE_MUNGERS,
+                               onType.getName());
                if (onType.isRawType() || onType.isParameterizedType()) {
                        onType = onType.getGenericType();
                }
@@ -1779,9 +1782,10 @@ public class BcelWeaver {
                if (zipOutputStream != null) {
                        String mainClassName = classFile.getJavaClass().getClassName();
                        writeZipEntry(getEntryName(mainClassName), clazz.getJavaClass(world).getBytes());
-                       if (!clazz.getChildClasses(world).isEmpty()) {
-                               for (Iterator i = clazz.getChildClasses(world).iterator(); i.hasNext();) {
-                                       UnwovenClassFile.ChildClass c = (UnwovenClassFile.ChildClass) i.next();
+                       List<UnwovenClassFile.ChildClass> childClasses = clazz.getChildClasses(world);
+                       if (!childClasses.isEmpty()) {
+                               for (Iterator<UnwovenClassFile.ChildClass> i = childClasses.iterator(); i.hasNext();) {
+                                       UnwovenClassFile.ChildClass c = i.next();
                                        writeZipEntry(getEntryName(mainClassName + "$" + c.name), c.bytes);
                                }
                        }
index fa16e011315b2597aaa394025efca615c1fa0437..81f0c9863e9df36260140b817f8a256d3c5d8562 100644 (file)
@@ -51,6 +51,7 @@ import org.aspectj.bridge.IMessage;
 import org.aspectj.bridge.ISourceLocation;
 import org.aspectj.bridge.SourceLocation;
 import org.aspectj.weaver.AjAttribute;
+import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;
 import org.aspectj.weaver.BCException;
 import org.aspectj.weaver.Member;
 import org.aspectj.weaver.NameMangler;
@@ -60,11 +61,10 @@ import org.aspectj.weaver.Shadow;
 import org.aspectj.weaver.SignatureUtils;
 import org.aspectj.weaver.TypeVariable;
 import org.aspectj.weaver.UnresolvedType;
+import org.aspectj.weaver.UnresolvedType.TypeKind;
 import org.aspectj.weaver.WeaverMessages;
 import org.aspectj.weaver.WeaverStateInfo;
 import org.aspectj.weaver.World;
-import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;
-import org.aspectj.weaver.UnresolvedType.TypeKind;
 import org.aspectj.weaver.bcel.asm.AsmDetector;
 import org.aspectj.weaver.bcel.asm.StackMapAdder;
 
@@ -293,8 +293,8 @@ public final class LazyClassGen {
                                serialVersionUIDRequiresInitialization = true;
                                // warn about what we've done?
                                if (world.getLint().calculatingSerialVersionUID.isEnabled()) {
-                                       world.getLint().calculatingSerialVersionUID.signal(new String[] { getClassName(),
-                                                       Long.toString(calculatedSerialVersionUID) + "L" }, null, null);
+                                       world.getLint().calculatingSerialVersionUID.signal(
+                                                       new String[] { getClassName(), Long.toString(calculatedSerialVersionUID) + "L" }, null, null);
                                }
                        }
                }
@@ -651,8 +651,8 @@ public final class LazyClassGen {
                // create an empty myGen so that we can give back a return value that
                // doesn't upset the
                // rest of the process.
-               myGen = new ClassGen(myGen.getClassName(), myGen.getSuperclassName(), myGen.getFileName(), myGen.getModifiers(), myGen
-                               .getInterfaceNames());
+               myGen = new ClassGen(myGen.getClassName(), myGen.getSuperclassName(), myGen.getFileName(), myGen.getModifiers(),
+                               myGen.getInterfaceNames());
                // raise an error against this compilation unit.
                getWorld().showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.CLASS_TOO_BIG, this.getClassName()),
                                new SourceLocation(new File(myGen.getFileName()), 0), null);
@@ -741,9 +741,9 @@ public final class LazyClassGen {
                return ret;
        }
 
-       public List getChildClasses(BcelWorld world) {
+       public List<UnwovenClassFile.ChildClass> getChildClasses(BcelWorld world) {
                if (classGens.isEmpty()) {
-                       return Collections.EMPTY_LIST;
+                       return Collections.emptyList();
                }
                List<UnwovenClassFile.ChildClass> ret = new ArrayList<UnwovenClassFile.ChildClass>();
                for (LazyClassGen clazz : classGens) {
index b0516a3def37a190a5f531d6b46161d446d6efa4..fa162c5264d0ef6ce424935d9e86ca662f641dbc 100644 (file)
@@ -54,8 +54,9 @@ abstract class Range implements InstructionTargeter {
                // System.err.println("  looking for " + end);
                while (ih != end) {
                        // System.err.println("    ih " + ih);
-                       if (!Range.isRangeHandle(ih))
+                       if (!Range.isRangeHandle(ih)) {
                                return false;
+                       }
                        ih = ih.getNext();
                }
                return true;
@@ -143,16 +144,18 @@ abstract class Range implements InstructionTargeter {
        }
 
        static InstructionHandle genStart(InstructionList body, InstructionHandle ih) {
-               if (ih == null)
+               if (ih == null) {
                        return genStart(body);
+               }
                InstructionHandle freshIh = body.insert(ih, Range.RANGEINSTRUCTION);
                setLineNumberFromNext(freshIh);
                return freshIh;
        }
 
        static InstructionHandle genEnd(InstructionList body, InstructionHandle ih) {
-               if (ih == null)
+               if (ih == null) {
                        return genEnd(body);
+               }
                return body.append(ih, Range.RANGEINSTRUCTION);
        }
 
@@ -168,8 +171,9 @@ abstract class Range implements InstructionTargeter {
 
        protected void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih, InstructionList new_il) {
                old_ih.removeTargeter(this);
-               if (new_ih != null)
+               if (new_ih != null) {
                        new_ih.addTargeter(this);
+               }
                body = new_il;
 
                if (old_ih == start) {
@@ -181,23 +185,26 @@ abstract class Range implements InstructionTargeter {
        }
 
        public static final boolean isRangeHandle(InstructionHandle ih) {
-               if (ih == null)
+               if (ih == null) {
                        return false;
+               }
                return ih.getInstruction() == Range.RANGEINSTRUCTION;
        }
 
        protected static final Range getRange(InstructionHandle ih) {
                // assert isRangeHandle(ih)
                Range ret = null;
-               Iterator tIter = ih.getTargeters().iterator();
+               Iterator<InstructionTargeter> tIter = ih.getTargeters().iterator();
                while (tIter.hasNext()) {
-                       InstructionTargeter targeter = (InstructionTargeter) tIter.next();
+                       InstructionTargeter targeter = tIter.next();
                        if (targeter instanceof Range) {
                                Range r = (Range) targeter;
-                               if (r.getStart() != ih && r.getEnd() != ih)
+                               if (r.getStart() != ih && r.getEnd() != ih) {
                                        continue;
-                               if (ret != null)
+                               }
+                               if (ret != null) {
                                        throw new BCException("multiple ranges on same range handle: " + ret + ",  " + targeter);
+                               }
                                ret = r;
                        }
                }
index d7cdd8256c0045e4e85518abcc6543dd98c95a9d..47c8400c54c391e130fa27492d2b638c6f97611c 100644 (file)
@@ -190,9 +190,9 @@ final class ShadowRange extends Range {
                // now go through again and update variable slots that have been altered as a result
                // of remapping...
                for (InstructionHandle newIh = freshBody.getStart(); newIh != freshBody.getEnd(); newIh = newIh.getNext()) {
-                       Iterator tIter = newIh.getTargeters().iterator();
+                       Iterator<InstructionTargeter> tIter = newIh.getTargeters().iterator();
                        while (tIter.hasNext()) {
-                               InstructionTargeter source = (InstructionTargeter) tIter.next();
+                               InstructionTargeter source = tIter.next();
                                if (source instanceof LocalVariableTag) {
                                        LocalVariableTag lvt = (LocalVariableTag) source;
                                        if (!lvt.isRemapped() && remap.hasKey(lvt.getSlot())) {
index d7b77ea1480b90eb87de7f46be01d5252168bbf2..96efd8d33fab99a074515b835a80c8854d186dbe 100644 (file)
@@ -51,6 +51,7 @@ import org.aspectj.apache.bcel.generic.TargetLostException;
 import org.aspectj.apache.bcel.generic.Type;
 import org.aspectj.bridge.ISourceLocation;
 import org.aspectj.weaver.AjAttribute;
+import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;
 import org.aspectj.weaver.AnnotationAJ;
 import org.aspectj.weaver.BCException;
 import org.aspectj.weaver.ConstantPoolReader;
@@ -61,7 +62,6 @@ import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.UnresolvedType;
 import org.aspectj.weaver.Utils;
 import org.aspectj.weaver.World;
-import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;
 
 public class Utility {
 
@@ -140,8 +140,8 @@ public class Utility {
                        kind = Constants.INVOKESPECIAL;
                }
 
-               return fact.createInvoke(signature.getDeclaringType().getName(), signature.getName(), BcelWorld.makeBcelType(signature
-                               .getReturnType()), BcelWorld.makeBcelTypes(signature.getParameterTypes()), kind);
+               return fact.createInvoke(signature.getDeclaringType().getName(), signature.getName(),
+                               BcelWorld.makeBcelType(signature.getReturnType()), BcelWorld.makeBcelTypes(signature.getParameterTypes()), kind);
        }
 
        // XXX don't need the world now
@@ -174,8 +174,8 @@ public class Utility {
                        kind = Constants.GETFIELD;
                }
 
-               return fact.createFieldAccess(signature.getDeclaringType().getName(), signature.getName(), BcelWorld.makeBcelType(signature
-                               .getReturnType()), kind);
+               return fact.createFieldAccess(signature.getDeclaringType().getName(), signature.getName(),
+                               BcelWorld.makeBcelType(signature.getReturnType()), kind);
        }
 
        public static Instruction createSet(InstructionFactory fact, Member signature) {
@@ -186,8 +186,8 @@ public class Utility {
                        kind = Constants.PUTFIELD;
                }
 
-               return fact.createFieldAccess(signature.getDeclaringType().getName(), signature.getName(), BcelWorld.makeBcelType(signature
-                               .getReturnType()), kind);
+               return fact.createFieldAccess(signature.getDeclaringType().getName(), signature.getName(),
+                               BcelWorld.makeBcelType(signature.getReturnType()), kind);
        }
 
        public static Instruction createInstanceof(InstructionFactory fact, ReferenceType t) {
@@ -220,8 +220,8 @@ public class Utility {
         * @return
         */
        public static Instruction createInvoke(InstructionFactory fact, short kind, Member member) {
-               return fact.createInvoke(member.getDeclaringType().getName(), member.getName(), BcelWorld.makeBcelType(member
-                               .getReturnType()), BcelWorld.makeBcelTypes(member.getParameterTypes()), kind);
+               return fact.createInvoke(member.getDeclaringType().getName(), member.getName(),
+                               BcelWorld.makeBcelType(member.getReturnType()), BcelWorld.makeBcelTypes(member.getParameterTypes()), kind);
        }
 
        private static String[] argNames = new String[] { "arg0", "arg1", "arg2", "arg3", "arg4" };
@@ -549,7 +549,7 @@ public class Utility {
        // tail recursion...
        // public static int getSourceLine(InstructionHandle ih) {
        // if (ih == null) return -1;
-       //              
+       //
        // InstructionTargeter[] ts = ih.getTargeters();
        // if (ts != null) {
        // for (int j = ts.length - 1; j >= 0; j--) {
@@ -570,9 +570,9 @@ public class Utility {
                        if (ih == null) {
                                return -1;
                        }
-                       Iterator tIter = ih.getTargeters().iterator();
+                       Iterator<InstructionTargeter> tIter = ih.getTargeters().iterator();
                        while (tIter.hasNext()) {
-                               InstructionTargeter t = (InstructionTargeter) tIter.next();
+                               InstructionTargeter t = tIter.next();
                                if (t instanceof LineNumberTag) {
                                        return ((LineNumberTag) t).getLineNumber();
                                }
@@ -638,7 +638,7 @@ public class Utility {
 
        public static List<Lint.Kind> getSuppressedWarnings(AnnotationAJ[] anns, Lint lint) {
                if (anns == null) {
-                       return Collections.EMPTY_LIST;
+                       return Collections.emptyList();
                }
                // Go through the annotation types
                List<Lint.Kind> suppressedWarnings = new ArrayList<Lint.Kind>();