aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2010-07-07 18:24:57 +0000
committeraclement <aclement>2010-07-07 18:24:57 +0000
commit0cb91f239c9934f7b4d5e0968d6205f7d347bbdc (patch)
treebf75e492ca8ef0ee0b4eb3efd7d3b201115eff44
parentdc34940150f311eecacb8524da0ca9090c210827 (diff)
downloadaspectj-0cb91f239c9934f7b4d5e0968d6205f7d347bbdc.tar.gz
aspectj-0cb91f239c9934f7b4d5e0968d6205f7d347bbdc.zip
generics
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/AnnotationAccessFieldVar.java11
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java53
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelAccessForInlineMunger.java54
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java47
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java118
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java52
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java16
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/Range.java25
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/ShadowRange.java4
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/Utility.java26
10 files changed, 209 insertions, 197 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/AnnotationAccessFieldVar.java b/weaver/src/org/aspectj/weaver/bcel/AnnotationAccessFieldVar.java
index c96987f53..041e92c54 100644
--- a/weaver/src/org/aspectj/weaver/bcel/AnnotationAccessFieldVar.java
+++ b/weaver/src/org/aspectj/weaver/bcel/AnnotationAccessFieldVar.java
@@ -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++) {
diff --git a/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java b/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
index dd95873d0..d8b694c0d 100644
--- a/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
+++ b/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
@@ -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()]);
}
/**
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelAccessForInlineMunger.java b/weaver/src/org/aspectj/weaver/bcel/BcelAccessForInlineMunger.java
index 64efb0a31..b915ca5f5 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelAccessForInlineMunger.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelAccessForInlineMunger.java
@@ -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())) {
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java b/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java
index ef102adbc..f8d48c7bc 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java
@@ -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);
}
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
index 0bc63ff0a..5990bec49 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
@@ -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) {
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
index 85e2a608b..b11f8577e 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
@@ -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);
}
}
diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java b/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
index fa16e0113..81f0c9863 100644
--- a/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
+++ b/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
@@ -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) {
diff --git a/weaver/src/org/aspectj/weaver/bcel/Range.java b/weaver/src/org/aspectj/weaver/bcel/Range.java
index b0516a3de..fa162c526 100644
--- a/weaver/src/org/aspectj/weaver/bcel/Range.java
+++ b/weaver/src/org/aspectj/weaver/bcel/Range.java
@@ -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;
}
}
diff --git a/weaver/src/org/aspectj/weaver/bcel/ShadowRange.java b/weaver/src/org/aspectj/weaver/bcel/ShadowRange.java
index d7cdd8256..47c8400c5 100644
--- a/weaver/src/org/aspectj/weaver/bcel/ShadowRange.java
+++ b/weaver/src/org/aspectj/weaver/bcel/ShadowRange.java
@@ -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())) {
diff --git a/weaver/src/org/aspectj/weaver/bcel/Utility.java b/weaver/src/org/aspectj/weaver/bcel/Utility.java
index d7b77ea14..96efd8d33 100644
--- a/weaver/src/org/aspectj/weaver/bcel/Utility.java
+++ b/weaver/src/org/aspectj/weaver/bcel/Utility.java
@@ -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>();