@@ -0,0 +1,44 @@ | |||
/******************************************************************************* | |||
* Copyright (c) 2004 IBM Corporation and others. | |||
* All rights reserved. This program and the accompanying materials | |||
* are made available under the terms of the Eclipse Public License v1.0 | |||
* which accompanies this distribution, and is available at | |||
* http://www.eclipse.org/legal/epl-v10.html | |||
* | |||
* Contributors: | |||
* IBM Corporation - initial API and implementation | |||
*******************************************************************************/ | |||
package org.aspectj.weaver; | |||
import java.util.Iterator; | |||
import org.aspectj.weaver.bcel.UnwovenClassFile; | |||
/** | |||
* @author colyer | |||
* | |||
* Clients implementing the IClassFileProvider can have a set of class files under their control woven by a weaver, by | |||
* calling the weave(IClassFileProvider source) method. The contract is that a call to getRequestor().acceptResult() is | |||
* providing a result for the class file most recently returned from the getClassFileIterator(). | |||
*/ | |||
public interface IClassFileProvider { | |||
/** | |||
* Answer an iterator that can be used to iterate over a set of UnwovenClassFiles to be woven. During a weave, this method may | |||
* be called multiple times. | |||
* | |||
* @return iterator over UnwovenClassFiles. | |||
*/ | |||
Iterator<UnwovenClassFile> getClassFileIterator(); | |||
/** | |||
* The client to which the woven results should be returned. | |||
*/ | |||
IWeaveRequestor getRequestor(); | |||
/** | |||
* @return true if weaver should only do some internal munging as the one needed for @AspectJ aspectOf methods creation | |||
*/ | |||
boolean isApplyAtAspectJMungersOnly(); | |||
} |
@@ -286,8 +286,8 @@ class BcelClassWeaver implements IClassWeaver { | |||
return; | |||
} | |||
for (Iterator i = addedLazyMethodGens.iterator(); i.hasNext();) { | |||
LazyMethodGen existing = (LazyMethodGen) i.next(); | |||
for (Iterator<LazyMethodGen> i = addedLazyMethodGens.iterator(); i.hasNext();) { | |||
LazyMethodGen existing = i.next(); | |||
if (signaturesMatch(mg, existing)) { | |||
if (existing.definingType == null) { | |||
// this means existing was introduced on the class itself | |||
@@ -495,14 +495,13 @@ class BcelClassWeaver implements IClassWeaver { | |||
// infinetly as compiler will have detected and reported | |||
// "Recursive constructor invocation" | |||
while (inlineSelfConstructors(methodGens)) { | |||
; | |||
} | |||
positionAndImplement(initializationShadows); | |||
} | |||
// now proceed with late type mungers | |||
if (lateTypeMungers != null) { | |||
for (Iterator i = lateTypeMungers.iterator(); i.hasNext();) { | |||
for (Iterator<ConcreteTypeMunger> i = lateTypeMungers.iterator(); i.hasNext();) { | |||
BcelTypeMunger munger = (BcelTypeMunger) i.next(); | |||
if (munger.matches(clazz.getType())) { | |||
boolean typeMungerAffectedType = munger.munge(this); | |||
@@ -725,9 +724,10 @@ class BcelClassWeaver implements IClassWeaver { | |||
} | |||
} | |||
// was: List l = typeToCheck.getInterTypeMungers(); | |||
List l = (typeToCheck.isRawType() ? typeToCheck.getGenericType().getInterTypeMungers() : typeToCheck.getInterTypeMungers()); | |||
for (Iterator iterator = l.iterator(); iterator.hasNext();) { | |||
Object o = iterator.next(); | |||
List<ConcreteTypeMunger> l = (typeToCheck.isRawType() ? typeToCheck.getGenericType().getInterTypeMungers() : typeToCheck | |||
.getInterTypeMungers()); | |||
for (Iterator<ConcreteTypeMunger> iterator = l.iterator(); iterator.hasNext();) { | |||
ConcreteTypeMunger o = iterator.next(); | |||
// FIXME asc if its not a BcelTypeMunger then its an | |||
// EclipseTypeMunger ... do I need to worry about that? | |||
if (o instanceof BcelTypeMunger) { | |||
@@ -1536,17 +1536,16 @@ class BcelClassWeaver implements IClassWeaver { | |||
return aspectsAffectingType; | |||
} | |||
private boolean inlineSelfConstructors(List methodGens) { | |||
private boolean inlineSelfConstructors(List<LazyMethodGen> methodGens) { | |||
boolean inlinedSomething = false; | |||
for (Iterator i = methodGens.iterator(); i.hasNext();) { | |||
LazyMethodGen mg = (LazyMethodGen) i.next(); | |||
if (!mg.getName().equals("<init>")) { | |||
for (LazyMethodGen methodGen : methodGens) { | |||
if (!methodGen.getName().equals("<init>")) { | |||
continue; | |||
} | |||
InstructionHandle ih = findSuperOrThisCall(mg); | |||
InstructionHandle ih = findSuperOrThisCall(methodGen); | |||
if (ih != null && isThisCall(ih)) { | |||
LazyMethodGen donor = getCalledMethod(ih); | |||
inlineMethod(donor, mg, ih); | |||
inlineMethod(donor, methodGen, ih); | |||
inlinedSomething = true; | |||
} | |||
} | |||
@@ -1905,7 +1904,7 @@ class BcelClassWeaver implements IClassWeaver { | |||
// search for 'returns' and make them to the | |||
// aload_<n>,monitorexit | |||
InstructionHandle walker = body.getStart(); | |||
List rets = new ArrayList(); | |||
List<InstructionHandle> rets = new ArrayList<InstructionHandle>(); | |||
while (walker != null) { // !walker.equals(body.getEnd())) { | |||
if (walker.getInstruction().isReturnInstruction()) { | |||
rets.add(walker); | |||
@@ -1917,8 +1916,7 @@ class BcelClassWeaver implements IClassWeaver { | |||
// the load instruction | |||
// (so we never jump over the monitorexit logic) | |||
for (Iterator iter = rets.iterator(); iter.hasNext();) { | |||
InstructionHandle element = (InstructionHandle) iter.next(); | |||
for (InstructionHandle ret : rets) { | |||
// System.err.println("Adding monitor exit block at "+ | |||
// element); | |||
InstructionList monitorExitBlock = new InstructionList(); | |||
@@ -1928,11 +1926,11 @@ class BcelClassWeaver implements IClassWeaver { | |||
// .getInstruction())); | |||
// element.setInstruction(InstructionFactory.createLoad( | |||
// classType,slotForThis)); | |||
InstructionHandle monitorExitBlockStart = body.insert(element, monitorExitBlock); | |||
InstructionHandle monitorExitBlockStart = body.insert(ret, monitorExitBlock); | |||
// now move the targeters from the RET to the start of | |||
// the monitorexit block | |||
for (InstructionTargeter targeter : element.getTargetersCopy()) { | |||
for (InstructionTargeter targeter : ret.getTargetersCopy()) { | |||
// what kinds are there? | |||
if (targeter instanceof LocalVariableTag) { | |||
// ignore | |||
@@ -1945,7 +1943,7 @@ class BcelClassWeaver implements IClassWeaver { | |||
// monitorExitBlockStart); | |||
} else if (targeter instanceof InstructionBranch) { | |||
// move it | |||
targeter.updateTarget(element, monitorExitBlockStart); | |||
targeter.updateTarget(ret, monitorExitBlockStart); | |||
} else { | |||
throw new BCException("Unexpected targeter encountered during transform: " + targeter); | |||
} | |||
@@ -2448,10 +2446,8 @@ class BcelClassWeaver implements IClassWeaver { | |||
} | |||
private void weaveInAddedMethods() { | |||
Collections.sort(addedLazyMethodGens, new Comparator() { | |||
public int compare(Object a, Object b) { | |||
LazyMethodGen aa = (LazyMethodGen) a; | |||
LazyMethodGen bb = (LazyMethodGen) b; | |||
Collections.sort(addedLazyMethodGens, new Comparator<LazyMethodGen>() { | |||
public int compare(LazyMethodGen aa, LazyMethodGen bb) { | |||
int i = aa.getName().compareTo(bb.getName()); | |||
if (i != 0) { | |||
return i; | |||
@@ -2607,8 +2603,8 @@ class BcelClassWeaver implements IClassWeaver { | |||
// now add interface inits | |||
if (!isThisCall(superOrThisCall)) { | |||
InstructionHandle curr = enclosingShadow.getRange().getStart(); | |||
for (Iterator i = addedSuperInitializersAsList.iterator(); i.hasNext();) { | |||
IfaceInitList l = (IfaceInitList) i.next(); | |||
for (Iterator<IfaceInitList> i = addedSuperInitializersAsList.iterator(); i.hasNext();) { | |||
IfaceInitList l = i.next(); | |||
Member ifaceInitSig = AjcMemberMaker.interfaceConstructor(l.onType); | |||
@@ -2656,7 +2652,7 @@ class BcelClassWeaver implements IClassWeaver { | |||
/** | |||
* first sorts the mungers, then gens the initializers in the right order | |||
*/ | |||
private InstructionList genInitInstructions(List list, boolean isStatic) { | |||
private InstructionList genInitInstructions(List<ConcreteTypeMunger> list, boolean isStatic) { | |||
list = PartialOrder.sort(list); | |||
if (list == null) { | |||
throw new BCException("circularity in inter-types"); | |||
@@ -2664,8 +2660,7 @@ class BcelClassWeaver implements IClassWeaver { | |||
InstructionList ret = new InstructionList(); | |||
for (Iterator i = list.iterator(); i.hasNext();) { | |||
ConcreteTypeMunger cmunger = (ConcreteTypeMunger) i.next(); | |||
for (ConcreteTypeMunger cmunger : list) { | |||
NewFieldTypeMunger munger = (NewFieldTypeMunger) cmunger.getMunger(); | |||
ResolvedMember initMethod = munger.getInitMethod(cmunger.getAspectType()); | |||
if (!isStatic) { |
@@ -37,14 +37,15 @@ public class BcelGenericSignatureToTypeXConverter { | |||
public static ResolvedType classTypeSignature2TypeX(GenericSignature.ClassTypeSignature aClassTypeSignature, | |||
GenericSignature.FormalTypeParameter[] typeParams, World world) throws GenericSignatureFormatException { | |||
Map typeMap = new HashMap(); | |||
Map<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<GenericSignature.FormalTypeParameter, ReferenceType>(); | |||
ResolvedType ret = classTypeSignature2TypeX(aClassTypeSignature, typeParams, world, typeMap); | |||
fixUpCircularDependencies(ret, typeMap); | |||
return ret; | |||
} | |||
private static ResolvedType classTypeSignature2TypeX(GenericSignature.ClassTypeSignature aClassTypeSignature, | |||
GenericSignature.FormalTypeParameter[] typeParams, World world, Map inProgressTypeVariableResolutions) | |||
GenericSignature.FormalTypeParameter[] typeParams, World world, | |||
Map<GenericSignature.FormalTypeParameter, ReferenceType> inProgressTypeVariableResolutions) | |||
throws GenericSignatureFormatException { | |||
// class type sig consists of an outer type, and zero or more nested types | |||
// the fully qualified name is outer-type.nested-type1.nested-type2.... | |||
@@ -75,8 +76,9 @@ public class BcelGenericSignatureToTypeXConverter { | |||
// that a type is not parameterizable (is that a word?). I think in these cases it is ok to | |||
// just return with what we know (the base type). (see pr152848) | |||
if (!(theBaseType.isGenericType() || theBaseType.isRawType())) { | |||
if (trace.isTraceEnabled()) | |||
if (trace.isTraceEnabled()) { | |||
trace.event("classTypeSignature2TypeX: this type is not a generic type:", null, new Object[] { theBaseType }); | |||
} | |||
return theBaseType; | |||
} | |||
@@ -98,14 +100,15 @@ public class BcelGenericSignatureToTypeXConverter { | |||
public static ResolvedType fieldTypeSignature2TypeX(GenericSignature.FieldTypeSignature aFieldTypeSignature, | |||
GenericSignature.FormalTypeParameter[] typeParams, World world) throws GenericSignatureFormatException { | |||
Map typeMap = new HashMap(); | |||
Map<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<GenericSignature.FormalTypeParameter, ReferenceType>(); | |||
ResolvedType ret = fieldTypeSignature2TypeX(aFieldTypeSignature, typeParams, world, typeMap); | |||
fixUpCircularDependencies(ret, typeMap); | |||
return ret; | |||
} | |||
private static ResolvedType fieldTypeSignature2TypeX(GenericSignature.FieldTypeSignature aFieldTypeSignature, | |||
GenericSignature.FormalTypeParameter[] typeParams, World world, Map inProgressTypeVariableResolutions) | |||
GenericSignature.FormalTypeParameter[] typeParams, World world, | |||
Map<GenericSignature.FormalTypeParameter, ReferenceType> inProgressTypeVariableResolutions) | |||
throws GenericSignatureFormatException { | |||
if (aFieldTypeSignature.isClassTypeSignature()) { | |||
return classTypeSignature2TypeX((GenericSignature.ClassTypeSignature) aFieldTypeSignature, typeParams, world, | |||
@@ -117,8 +120,8 @@ public class BcelGenericSignatureToTypeXConverter { | |||
dims++; | |||
ats = ((GenericSignature.ArrayTypeSignature) ats).typeSig; | |||
} | |||
return world.resolve(UnresolvedType.makeArray(typeSignature2TypeX(ats, typeParams, world, | |||
inProgressTypeVariableResolutions), dims)); | |||
return world.resolve(UnresolvedType.makeArray( | |||
typeSignature2TypeX(ats, typeParams, world, inProgressTypeVariableResolutions), dims)); | |||
} else if (aFieldTypeSignature.isTypeVariableSignature()) { | |||
ResolvedType rtx = typeVariableSignature2TypeX((GenericSignature.TypeVariableSignature) aFieldTypeSignature, | |||
typeParams, world, inProgressTypeVariableResolutions); | |||
@@ -130,12 +133,13 @@ public class BcelGenericSignatureToTypeXConverter { | |||
public static TypeVariable formalTypeParameter2TypeVariable(GenericSignature.FormalTypeParameter aFormalTypeParameter, | |||
GenericSignature.FormalTypeParameter[] typeParams, World world) throws GenericSignatureFormatException { | |||
Map typeMap = new HashMap(); | |||
Map<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<GenericSignature.FormalTypeParameter, ReferenceType>(); | |||
return formalTypeParameter2TypeVariable(aFormalTypeParameter, typeParams, world, typeMap); | |||
} | |||
private static TypeVariable formalTypeParameter2TypeVariable(GenericSignature.FormalTypeParameter aFormalTypeParameter, | |||
GenericSignature.FormalTypeParameter[] typeParams, World world, Map inProgressTypeVariableResolutions) | |||
GenericSignature.FormalTypeParameter[] typeParams, World world, | |||
Map<GenericSignature.FormalTypeParameter, ReferenceType> inProgressTypeVariableResolutions) | |||
throws GenericSignatureFormatException { | |||
UnresolvedType upperBound = fieldTypeSignature2TypeX(aFormalTypeParameter.classBound, typeParams, world, | |||
inProgressTypeVariableResolutions); | |||
@@ -148,10 +152,12 @@ public class BcelGenericSignatureToTypeXConverter { | |||
} | |||
private static ResolvedType typeArgument2TypeX(GenericSignature.TypeArgument aTypeArgument, | |||
GenericSignature.FormalTypeParameter[] typeParams, World world, Map inProgressTypeVariableResolutions) | |||
GenericSignature.FormalTypeParameter[] typeParams, World world, | |||
Map<GenericSignature.FormalTypeParameter, ReferenceType> inProgressTypeVariableResolutions) | |||
throws GenericSignatureFormatException { | |||
if (aTypeArgument.isWildcard) | |||
if (aTypeArgument.isWildcard) { | |||
return UnresolvedType.SOMETHING.resolve(world); | |||
} | |||
if (aTypeArgument.isMinus) { | |||
UnresolvedType bound = fieldTypeSignature2TypeX(aTypeArgument.signature, typeParams, world, | |||
inProgressTypeVariableResolutions); | |||
@@ -169,14 +175,15 @@ public class BcelGenericSignatureToTypeXConverter { | |||
public static ResolvedType typeSignature2TypeX(GenericSignature.TypeSignature aTypeSig, | |||
GenericSignature.FormalTypeParameter[] typeParams, World world) throws GenericSignatureFormatException { | |||
Map typeMap = new HashMap(); | |||
Map<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<GenericSignature.FormalTypeParameter, ReferenceType>(); | |||
ResolvedType ret = typeSignature2TypeX(aTypeSig, typeParams, world, typeMap); | |||
fixUpCircularDependencies(ret, typeMap); | |||
return ret; | |||
} | |||
private static ResolvedType typeSignature2TypeX(GenericSignature.TypeSignature aTypeSig, | |||
GenericSignature.FormalTypeParameter[] typeParams, World world, Map inProgressTypeVariableResolutions) | |||
GenericSignature.FormalTypeParameter[] typeParams, World world, | |||
Map<GenericSignature.FormalTypeParameter, ReferenceType> inProgressTypeVariableResolutions) | |||
throws GenericSignatureFormatException { | |||
if (aTypeSig.isBaseType()) { | |||
return world.resolve(UnresolvedType.forSignature(((GenericSignature.BaseTypeSignature) aTypeSig).toString())); | |||
@@ -187,7 +194,8 @@ public class BcelGenericSignatureToTypeXConverter { | |||
} | |||
private static ResolvedType typeVariableSignature2TypeX(GenericSignature.TypeVariableSignature aTypeVarSig, | |||
GenericSignature.FormalTypeParameter[] typeParams, World world, Map inProgressTypeVariableResolutions) | |||
GenericSignature.FormalTypeParameter[] typeParams, World world, | |||
Map<GenericSignature.FormalTypeParameter, ReferenceType> inProgressTypeVariableResolutions) | |||
throws GenericSignatureFormatException { | |||
GenericSignature.FormalTypeParameter typeVarBounds = null; | |||
for (int i = 0; i < typeParams.length; i++) { | |||
@@ -204,16 +212,17 @@ public class BcelGenericSignatureToTypeXConverter { | |||
// throw new GenericSignatureFormatException("Undeclared type variable in signature: " + aTypeVarSig.typeVariableName); | |||
} | |||
if (inProgressTypeVariableResolutions.containsKey(typeVarBounds)) { | |||
return (ResolvedType) inProgressTypeVariableResolutions.get(typeVarBounds); | |||
return inProgressTypeVariableResolutions.get(typeVarBounds); | |||
} | |||
inProgressTypeVariableResolutions.put(typeVarBounds, new FTPHolder(typeVarBounds, world)); | |||
ResolvedType ret = new TypeVariableReferenceType(formalTypeParameter2TypeVariable(typeVarBounds, typeParams, world, | |||
ReferenceType ret = new TypeVariableReferenceType(formalTypeParameter2TypeVariable(typeVarBounds, typeParams, world, | |||
inProgressTypeVariableResolutions), world); | |||
inProgressTypeVariableResolutions.put(typeVarBounds, ret); | |||
return ret; | |||
} | |||
private static void fixUpCircularDependencies(ResolvedType aTypeX, Map typeVariableResolutions) { | |||
private static void fixUpCircularDependencies(ResolvedType aTypeX, | |||
Map<GenericSignature.FormalTypeParameter, ReferenceType> typeVariableResolutions) { | |||
if (!(aTypeX instanceof ReferenceType)) { | |||
return; | |||
} | |||
@@ -224,7 +233,7 @@ public class BcelGenericSignatureToTypeXConverter { | |||
for (int i = 0; i < typeVars.length; i++) { | |||
if (typeVars[i].getUpperBound() instanceof FTPHolder) { | |||
GenericSignature.FormalTypeParameter key = ((FTPHolder) typeVars[i].getUpperBound()).ftpToBeSubstituted; | |||
typeVars[i].setUpperBound((UnresolvedType) typeVariableResolutions.get(key)); | |||
typeVars[i].setUpperBound(typeVariableResolutions.get(key)); | |||
} | |||
} | |||
} |
@@ -150,7 +150,7 @@ public final class BcelRenderer implements ITestVisitor, IExprVisitor { | |||
InstructionList il = new InstructionList(); | |||
// If it is null jump past the advice call | |||
il.append(fact.createBranchInstruction(Constants.IFNULL, fk)); | |||
il.append(InstructionFactory.createBranchInstruction(Constants.IFNULL, fk)); | |||
// Load up the var again | |||
il.append(((BcelVar) hasAnnotation.getVar()).createLoad(fact)); | |||
@@ -201,8 +201,9 @@ public final class BcelRenderer implements ITestVisitor, IExprVisitor { | |||
} | |||
public void visit(Literal literal) { | |||
if (literal == Literal.FALSE) | |||
if (literal == Literal.FALSE) { | |||
throw new BCException("visiting a false expression"); | |||
} | |||
} | |||
public void visit(Call call) { |
@@ -91,7 +91,7 @@ public final class LazyClassGen { | |||
private final World world; | |||
private final String packageName = null; | |||
private final List fields = new ArrayList(); | |||
private final List<BcelField> fields = new ArrayList<BcelField>(); | |||
private final List<LazyMethodGen> methodGens = new ArrayList<LazyMethodGen>(); | |||
private final List<LazyClassGen> classGens = new ArrayList<LazyClassGen>(); | |||
private final List<AnnotationGen> annotations = new ArrayList<AnnotationGen>(); | |||
@@ -311,7 +311,7 @@ public final class LazyClassGen { | |||
ResolvedMember[] fields = myType.getDeclaredFields(); | |||
for (int i = 0; i < fields.length; i++) { | |||
this.fields.add(fields[i]); | |||
this.fields.add((BcelField) fields[i]); | |||
} | |||
} | |||
@@ -492,7 +492,7 @@ public final class LazyClassGen { | |||
len = fields.size(); | |||
myGen.setFields(Field.NoFields); | |||
for (int i = 0; i < len; i++) { | |||
BcelField gen = (BcelField) fields.get(i); | |||
BcelField gen = fields.get(i); | |||
myGen.addField(gen.getField(cp)); | |||
} | |||
@@ -784,9 +784,9 @@ public final class LazyClassGen { | |||
} | |||
public void print(PrintStream out) { | |||
List classGens = getClassGens(); | |||
for (Iterator iter = classGens.iterator(); iter.hasNext();) { | |||
LazyClassGen element = (LazyClassGen) iter.next(); | |||
List<LazyClassGen> classGens = getClassGens(); | |||
for (Iterator<LazyClassGen> iter = classGens.iterator(); iter.hasNext();) { | |||
LazyClassGen element = iter.next(); | |||
element.printOne(out); | |||
if (iter.hasNext()) { | |||
out.println(); | |||
@@ -821,9 +821,9 @@ public final class LazyClassGen { | |||
out.print(" "); | |||
out.println(fields[i]); | |||
} | |||
List methodGens = getMethodGens(); | |||
for (Iterator iter = methodGens.iterator(); iter.hasNext();) { | |||
LazyMethodGen gen = (LazyMethodGen) iter.next(); | |||
List<LazyMethodGen> methodGens = getMethodGens(); | |||
for (Iterator<LazyMethodGen> iter = methodGens.iterator(); iter.hasNext();) { | |||
LazyMethodGen gen = iter.next(); | |||
// we skip empty clinits | |||
if (isEmptyClinit(gen)) { | |||
continue; | |||
@@ -1420,9 +1420,9 @@ public final class LazyClassGen { | |||
} | |||
} | |||
private boolean hasSyntheticAttribute(List attributes) { | |||
private boolean hasSyntheticAttribute(List<Attribute> attributes) { | |||
for (int i = 0; i < attributes.size(); i++) { | |||
if (((Attribute) attributes.get(i)).getName().equals("Synthetic")) { | |||
if ((attributes.get(i)).getName().equals("Synthetic")) { | |||
return true; | |||
} | |||
} | |||
@@ -1457,8 +1457,7 @@ public final class LazyClassGen { | |||
} | |||
public LazyMethodGen getLazyMethodGen(String name, String signature, boolean allowMissing) { | |||
for (Iterator i = methodGens.iterator(); i.hasNext();) { | |||
LazyMethodGen gen = (LazyMethodGen) i.next(); | |||
for (LazyMethodGen gen : methodGens) { | |||
if (gen.getName().equals(name) && gen.getSignature().equals(signature)) { | |||
return gen; | |||
} | |||
@@ -1540,9 +1539,8 @@ public final class LazyClassGen { | |||
*/ | |||
public String allocateField(String prefix) { | |||
int highestAllocated = -1; | |||
List/* BcelField */fs = getFieldGens(); | |||
for (int i = 0; i < fs.size(); i++) { | |||
BcelField field = (BcelField) fs.get(i); | |||
List<BcelField> fs = getFieldGens(); | |||
for (BcelField field : fs) { | |||
if (field.getName().startsWith(prefix)) { | |||
try { | |||
int num = Integer.parseInt(field.getName().substring(prefix.length())); |
@@ -32,6 +32,7 @@ import java.util.StringTokenizer; | |||
import org.aspectj.bridge.AbortException; | |||
import org.aspectj.bridge.IMessage; | |||
import org.aspectj.bridge.IMessage.Kind; | |||
import org.aspectj.bridge.IMessageContext; | |||
import org.aspectj.bridge.IMessageHandler; | |||
import org.aspectj.bridge.IMessageHolder; | |||
@@ -41,7 +42,6 @@ import org.aspectj.bridge.MessageUtil; | |||
import org.aspectj.bridge.MessageWriter; | |||
import org.aspectj.bridge.Version; | |||
import org.aspectj.bridge.WeaveMessage; | |||
import org.aspectj.bridge.IMessage.Kind; | |||
import org.aspectj.util.FileUtil; | |||
import org.aspectj.util.LangUtil; | |||
import org.aspectj.weaver.IClassFileProvider; | |||
@@ -443,7 +443,7 @@ public class WeavingAdaptor implements IMessageContext { | |||
// spe.printStackTrace(); | |||
// return false; | |||
// } | |||
// | |||
// | |||
// return detector.isAspect(); | |||
// } | |||
@@ -603,7 +603,7 @@ public class WeavingAdaptor implements IMessageContext { | |||
protected class WeavingAdaptorMessageHolder extends MessageHandler { | |||
private IMessageHandler delegate; | |||
private List savedMessages; | |||
private List<IMessage> savedMessages; | |||
protected boolean traceMessages = Boolean.getBoolean(TRACE_MESSAGES_PROPERTY); | |||
@@ -639,11 +639,10 @@ public class WeavingAdaptor implements IMessageContext { | |||
public void flushMessages() { | |||
if (savedMessages == null) { | |||
savedMessages = new ArrayList(); | |||
savedMessages = new ArrayList<IMessage>(); | |||
savedMessages.addAll(super.getUnmodifiableListView()); | |||
clearMessages(); | |||
for (Iterator iter = savedMessages.iterator(); iter.hasNext();) { | |||
IMessage message = (IMessage) iter.next(); | |||
for (IMessage message : savedMessages) { | |||
delegate.handleMessage(message); | |||
} | |||
} | |||
@@ -709,9 +708,9 @@ public class WeavingAdaptor implements IMessageContext { | |||
*/ | |||
@Override | |||
public List getUnmodifiableListView() { | |||
public List<IMessage> getUnmodifiableListView() { | |||
// System.err.println("? WeavingAdaptorMessageHolder.getUnmodifiableListView() savedMessages=" + savedMessages); | |||
List allMessages = new ArrayList(); | |||
List<IMessage> allMessages = new ArrayList<IMessage>(); | |||
allMessages.addAll(savedMessages); | |||
allMessages.addAll(super.getUnmodifiableListView()); | |||
return allMessages; | |||
@@ -720,7 +719,7 @@ public class WeavingAdaptor implements IMessageContext { | |||
protected class WeavingAdaptorMessageWriter extends MessageWriter { | |||
private final Set ignoring = new HashSet(); | |||
private final Set<IMessage.Kind> ignoring = new HashSet<IMessage.Kind>(); | |||
private final IMessage.Kind failKind; | |||
public WeavingAdaptorMessageWriter(PrintWriter writer) { | |||
@@ -776,7 +775,7 @@ public class WeavingAdaptor implements IMessageContext { | |||
private class WeavingClassFileProvider implements IClassFileProvider { | |||
private final UnwovenClassFile unwovenClass; | |||
private final List unwovenClasses = new ArrayList(); /* List<UnovenClassFile> */ | |||
private final List<UnwovenClassFile> unwovenClasses = new ArrayList<UnwovenClassFile>(); | |||
private IUnwovenClassFile wovenClass; | |||
private boolean isApplyAtAspectJMungersOnly = false; | |||
@@ -807,7 +806,7 @@ public class WeavingAdaptor implements IMessageContext { | |||
} | |||
} | |||
public Iterator getClassFileIterator() { | |||
public Iterator<UnwovenClassFile> getClassFileIterator() { | |||
return unwovenClasses.iterator(); | |||
} | |||