diff options
Diffstat (limited to 'weaver/src')
40 files changed, 233 insertions, 233 deletions
diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java b/weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java index 971ee314d..b91496ea7 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java @@ -109,7 +109,7 @@ public class AtAjAttributes { /** * The list of AjAttribute.XXX that we are populating from the @AJ read */ - List<AjAttribute> ajAttributes = new ArrayList<AjAttribute>(); + List<AjAttribute> ajAttributes = new ArrayList<>(); /** * The resolved type (class) for which we are reading @AJ for (be it class, method, field annotations) @@ -721,7 +721,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<TypePattern> parents = new ArrayList<TypePattern>(1); + List<TypePattern> parents = new ArrayList<>(1); parents.add(parent); DeclareParents dp = new DeclareParents(typePattern, parents, false); dp.resolve(binding); // resolves the parent and child parts of the decp @@ -923,8 +923,8 @@ public class AtAjAttributes { // supplied as just the class return value of the annotated method NameValuePair interfaceListSpecified = getAnnotationElement(declareMixinAnnotation, "interfaces"); - List<TypePattern> newParents = new ArrayList<TypePattern>(1); - List<ResolvedType> newInterfaceTypes = new ArrayList<ResolvedType>(1); + List<TypePattern> newParents = new ArrayList<>(1); + List<ResolvedType> newInterfaceTypes = new ArrayList<>(1); if (interfaceListSpecified != null) { ArrayElementValue arrayOfInterfaceTypes = (ArrayElementValue) interfaceListSpecified.getValue(); int numberOfTypes = arrayOfInterfaceTypes.getElementValuesArraySize(); @@ -1558,7 +1558,7 @@ public class AtAjAttributes { throw new UnreadableDebugInfoException(); } - List<FormalBinding> bindings = new ArrayList<FormalBinding>(); + List<FormalBinding> bindings = new ArrayList<>(); for (int i = 0; i < argumentNames.length; i++) { String argumentName = argumentNames[i]; UnresolvedType argumentType = UnresolvedType.forSignature(method.getArgumentTypes()[i].getSignature()); @@ -1726,7 +1726,7 @@ public class AtAjAttributes { } final int startAtStackIndex = method.isStatic() ? 0 : 1; - final List<MethodArgument> arguments = new ArrayList<MethodArgument>(); + final List<MethodArgument> arguments = new ArrayList<>(); LocalVariableTable lt = method.getLocalVariableTable(); if (lt != null) { LocalVariable[] lvt = lt.getLocalVariableTable(); @@ -1807,7 +1807,7 @@ public class AtAjAttributes { private static String[] extractArgNamesFromAnnotationValue(Method method, String argNamesFromAnnotation, AjAttributeMethodStruct methodStruct) { StringTokenizer st = new StringTokenizer(argNamesFromAnnotation, " ,"); - List<String> args = new ArrayList<String>(); + List<String> args = new ArrayList<>(); while (st.hasMoreTokens()) { args.add(st.nextToken()); } @@ -1899,7 +1899,7 @@ 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<String> ignores = new ArrayList<String>(); + List<String> ignores = new ArrayList<>(); for (FormalBinding formalBinding : bindings) { if (formalBinding instanceof FormalBinding.ImplicitFormalBinding) { ignores.add(formalBinding.getName()); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAccessForInlineMunger.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAccessForInlineMunger.java index 8d2709966..497df1a3a 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAccessForInlineMunger.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAccessForInlineMunger.java @@ -72,8 +72,8 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger { @Override public boolean munge(BcelClassWeaver weaver) { aspectGen = weaver.getLazyClassGen(); - inlineAccessors = new HashMap<String, ResolvedMember>(0); - inlineAccessorMethodGens = new HashSet<LazyMethodGen>(); + inlineAccessors = new HashMap<>(0); + inlineAccessorMethodGens = new HashSet<>(); // look for all @Around advices for (LazyMethodGen methodGen : aspectGen.getMethodGens()) { @@ -238,7 +238,7 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger { InstructionFactory factory = aspectGen.getFactory(); LazyMethodGen method = makeMethodGen(aspectGen, inlineAccessor); method.makeSynthetic(); - List<AjAttribute> methodAttributes = new ArrayList<AjAttribute>(); + List<AjAttribute> methodAttributes = new ArrayList<>(); methodAttributes.add(new AjAttribute.AjSynthetic()); methodAttributes.add(new AjAttribute.EffectiveSignatureAttribute(resolvedMember, Shadow.MethodCall, false)); method.addAttribute(Utility.bcelAttribute(methodAttributes.get(0), aspectGen.getConstantPool())); @@ -282,7 +282,7 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger { LazyMethodGen method = makeMethodGen(aspectGen, inlineAccessor); // flag it synthetic, AjSynthetic method.makeSynthetic(); - List<AjAttribute> methodAttributes = new ArrayList<AjAttribute>(); + List<AjAttribute> methodAttributes = new ArrayList<>(); methodAttributes.add(new AjAttribute.AjSynthetic()); methodAttributes.add(new AjAttribute.EffectiveSignatureAttribute(resolvedMember, Shadow.MethodCall, false)); method.addAttribute(Utility.bcelAttribute(methodAttributes.get(0), aspectGen.getConstantPool())); @@ -326,7 +326,7 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger { LazyMethodGen method = makeMethodGen(aspectGen, inlineAccessor); // flag it synthetic, AjSynthetic method.makeSynthetic(); - List<AjAttribute> methodAttributes = new ArrayList<AjAttribute>(); + List<AjAttribute> methodAttributes = new ArrayList<>(); methodAttributes.add(new AjAttribute.AjSynthetic()); methodAttributes.add(new AjAttribute.EffectiveSignatureAttribute(resolvedMember, Shadow.FieldGet, false)); // flag the effective signature, so that we can deobfuscate the signature to apply method call pointcut @@ -367,7 +367,7 @@ public class BcelAccessForInlineMunger extends BcelTypeMunger { LazyMethodGen method = makeMethodGen(aspectGen, inlineAccessor); // flag it synthetic, AjSynthetic method.makeSynthetic(); - List<AjAttribute> methodAttributes = new ArrayList<AjAttribute>(); + List<AjAttribute> methodAttributes = new ArrayList<>(); methodAttributes.add(new AjAttribute.AjSynthetic()); methodAttributes.add(new AjAttribute.EffectiveSignatureAttribute(resolvedMember, Shadow.FieldSet, false)); method.addAttribute(Utility.bcelAttribute(methodAttributes.get(0), aspectGen.getConstantPool())); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAdvice.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAdvice.java index 7736addcd..85cd66e54 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAdvice.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAdvice.java @@ -423,7 +423,7 @@ class BcelAdvice extends Advice { return Collections.emptyList(); } - Collection<ResolvedType> ret = new ArrayList<ResolvedType>(); + Collection<ResolvedType> ret = new ArrayList<>(); World world = concreteAspect.getWorld(); ResolvedType runtimeException = world.getCoreType(UnresolvedType.RUNTIME_EXCEPTION); ResolvedType error = world.getCoreType(UnresolvedType.ERROR); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAnnotation.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAnnotation.java index b11afc77d..73699f2a0 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAnnotation.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAnnotation.java @@ -75,7 +75,7 @@ public class BcelAnnotation extends AbstractAnnotationAJ { NameValuePair envp = values.get(0); ArrayElementValue aev = (ArrayElementValue) envp.getValue(); ElementValue[] evs = aev.getElementValuesArray(); - Set<String> targets = new HashSet<String>(); + Set<String> targets = new HashSet<>(); for (ElementValue elementValue : evs) { EnumElementValue ev = (EnumElementValue) elementValue; targets.add(ev.getEnumValueString()); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java index 2e0b8e5f3..8bd479332 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java @@ -119,17 +119,17 @@ class BcelClassWeaver implements IClassWeaver { private final ConstantPool cpg; // alias of clazz.getConstantPoolGen() private final InstructionFactory fact; // alias of clazz.getFactory(); - private final List<LazyMethodGen> addedLazyMethodGens = new ArrayList<LazyMethodGen>(); - private final Set<ResolvedMember> addedDispatchTargets = new HashSet<ResolvedMember>(); + private final List<LazyMethodGen> addedLazyMethodGens = new ArrayList<>(); + private final Set<ResolvedMember> addedDispatchTargets = new HashSet<>(); private boolean inReweavableMode = false; private List<IfaceInitList> addedSuperInitializersAsList = null; - private final Map<ResolvedType, IfaceInitList> addedSuperInitializers = new HashMap<ResolvedType, IfaceInitList>(); - private final List<ConcreteTypeMunger> addedThisInitializers = new ArrayList<ConcreteTypeMunger>(); - private final List<ConcreteTypeMunger> addedClassInitializers = new ArrayList<ConcreteTypeMunger>(); + private final Map<ResolvedType, IfaceInitList> addedSuperInitializers = new HashMap<>(); + private final List<ConcreteTypeMunger> addedThisInitializers = new ArrayList<>(); + private final List<ConcreteTypeMunger> addedClassInitializers = new ArrayList<>(); - private final Map<ResolvedMember, ResolvedMember> mapToAnnotationHolder = new HashMap<ResolvedMember, ResolvedMember>(); + private final Map<ResolvedMember, ResolvedMember> mapToAnnotationHolder = new HashMap<>(); // private BcelShadow clinitShadow = null; @@ -137,7 +137,7 @@ class BcelClassWeaver implements IClassWeaver { * This holds the initialization and pre-initialization shadows for this class that were actually matched by mungers (if no * match, then we don't even create the shadows really). */ - private final List<BcelShadow> initializationShadows = new ArrayList<BcelShadow>(); + private final List<BcelShadow> initializationShadows = new ArrayList<>(); private BcelClassWeaver(BcelWorld world, LazyClassGen clazz, List<ShadowMunger> shadowMungers, List<ConcreteTypeMunger> typeMungers, List<ConcreteTypeMunger> lateTypeMungers) { @@ -209,7 +209,7 @@ class BcelClassWeaver implements IClassWeaver { if (kind.isSet(couldMatchKinds)) { byte k = kind.getKey(); if (indexedShadowMungers[k] == null) { - indexedShadowMungers[k] = new ArrayList<ShadowMunger>(); + indexedShadowMungers[k] = new ArrayList<>(); if (!kind.isEnclosingKind()) { canMatchBodyShadows = true; } @@ -254,7 +254,7 @@ class BcelClassWeaver implements IClassWeaver { private static class IfaceInitList implements PartialOrder.PartialComparable { final ResolvedType onType; - List<ConcreteTypeMunger> list = new ArrayList<ConcreteTypeMunger>(); + List<ConcreteTypeMunger> list = new ArrayList<>(); IfaceInitList(ResolvedType onType) { this.onType = onType; @@ -418,7 +418,7 @@ class BcelClassWeaver implements IClassWeaver { Set<String> aspectsAffectingType = null; if (inReweavableMode || clazz.getType().isAspect()) { - aspectsAffectingType = new HashSet<String>(); + aspectsAffectingType = new HashSet<>(); } boolean isChanged = false; @@ -457,7 +457,7 @@ class BcelClassWeaver implements IClassWeaver { // sort according to: Major: type hierarchy // within each list: dominates // don't forget to sort addedThisInitialiers according to dominates - addedSuperInitializersAsList = new ArrayList<IfaceInitList>(addedSuperInitializers.values()); + addedSuperInitializersAsList = new ArrayList<>(addedSuperInitializers.values()); addedSuperInitializersAsList = PartialOrder.sort(addedSuperInitializersAsList); if (addedSuperInitializersAsList == null) { throw new BCException("circularity in inter-types"); @@ -471,7 +471,7 @@ class BcelClassWeaver implements IClassWeaver { // now go through each method, and match against each method. This // sets up each method's {@link LazyMethodGen#matchedShadows} field, // and it also possibly adds to {@link #initializationShadows}. - List<LazyMethodGen> methodGens = new ArrayList<LazyMethodGen>(clazz.getMethodGens()); + List<LazyMethodGen> methodGens = new ArrayList<>(clazz.getMethodGens()); for (LazyMethodGen member : methodGens) { if (!member.hasBody()) { continue; @@ -504,7 +504,7 @@ class BcelClassWeaver implements IClassWeaver { // Repeat next step until nothing left to inline...cant go on // infinetly as compiler will have detected and reported // "Recursive constructor invocation" - List<LazyMethodGen> recursiveCtors = new ArrayList<LazyMethodGen>(); + List<LazyMethodGen> recursiveCtors = new ArrayList<>(); while (inlineSelfConstructors(methodGens, recursiveCtors)) { } positionAndImplement(initializationShadows); @@ -789,7 +789,7 @@ class BcelClassWeaver implements IClassWeaver { // Keep a set of all methods from this type - it'll help us to check if bridge methods // have already been created, we don't want to do it twice! - Set<String> methodsSet = new HashSet<String>(); + Set<String> methodsSet = new HashSet<>(); for (LazyMethodGen aMethod : methods) { StringBuilder sb = new StringBuilder(aMethod.getName()); sb.append(aMethod.getSignature()); @@ -825,7 +825,7 @@ class BcelClassWeaver implements IClassWeaver { } String pkgName = clazz.getPackageName(); UnresolvedType[] bm = BcelWorld.fromBcel(bridgeToCandidate.getArgumentTypes()); - List<ResolvedMember> overriddenMethodsCollector = new ArrayList<ResolvedMember>(); + List<ResolvedMember> overriddenMethodsCollector = new ArrayList<>(); checkForOverride(theSuperclass, name, psig, rsig, bridgeToCandidate.getAccessFlags(), pkgName, bm, overriddenMethodsCollector); if (overriddenMethodsCollector.size() != 0) { for (ResolvedMember overriddenMethod : overriddenMethodsCollector) { @@ -876,7 +876,7 @@ class BcelClassWeaver implements IClassWeaver { * Weave any declare @method/@ctor statements into the members of the supplied class */ private boolean weaveDeclareAtMethodCtor(LazyClassGen clazz) { - List<Integer> reportedProblems = new ArrayList<Integer>(); + List<Integer> reportedProblems = new ArrayList<>(); List<DeclareAnnotation> allDecams = world.getDeclareAnnotationOnMethods(); if (allDecams.isEmpty()) { @@ -899,7 +899,7 @@ class BcelClassWeaver implements IClassWeaver { return false; // nothing to do } - Set<DeclareAnnotation> unusedDecams = new HashSet<DeclareAnnotation>(); + Set<DeclareAnnotation> unusedDecams = new HashSet<>(); unusedDecams.addAll(decaMs); // These methods may have been targeted with declare annotation. Example: ITD on an interface @@ -915,7 +915,7 @@ class BcelClassWeaver implements IClassWeaver { resolvedmember.setAnnotationTypes(method.getAnnotationTypes()); resolvedmember.setAnnotations(method.getAnnotations()); - List<DeclareAnnotation> worthRetrying = new ArrayList<DeclareAnnotation>(); + List<DeclareAnnotation> worthRetrying = new ArrayList<>(); boolean modificationOccured = false; for (DeclareAnnotation decam: decaMs) { if (decam.matches(resolvedmember, world)) { @@ -947,7 +947,7 @@ class BcelClassWeaver implements IClassWeaver { while (!worthRetrying.isEmpty() && modificationOccured) { modificationOccured = false; // lets have another go - List<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>(); + List<DeclareAnnotation> forRemoval = new ArrayList<>(); for (DeclareAnnotation decam : worthRetrying) { if (decam.matches(resolvedmember, world)) { if (doesAlreadyHaveAnnotation(resolvedmember, decam, reportedProblems,false)) { @@ -984,7 +984,7 @@ class BcelClassWeaver implements IClassWeaver { if (!mg.getName().startsWith(NameMangler.PREFIX)) { // Single first pass - List<DeclareAnnotation> worthRetrying = new ArrayList<DeclareAnnotation>(); + List<DeclareAnnotation> worthRetrying = new ArrayList<>(); boolean modificationOccured = false; List<AnnotationGen> annotationsToAdd = null; for (DeclareAnnotation decaM : decaMs) { @@ -998,7 +998,7 @@ class BcelClassWeaver implements IClassWeaver { } if (annotationsToAdd == null) { - annotationsToAdd = new ArrayList<AnnotationGen>(); + annotationsToAdd = new ArrayList<>(); } AnnotationGen a = ((BcelAnnotation) decaM.getAnnotation()).getBcelAnnotation(); AnnotationGen ag = new AnnotationGen(a, clazz.getConstantPool(), true); @@ -1028,7 +1028,7 @@ class BcelClassWeaver implements IClassWeaver { while (!worthRetrying.isEmpty() && modificationOccured) { modificationOccured = false; // lets have another go - List<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>(); + List<DeclareAnnotation> forRemoval = new ArrayList<>(); for (DeclareAnnotation decaM : worthRetrying) { if (decaM.matches(mg.getMemberView(), world)) { if (doesAlreadyHaveAnnotation(mg.getMemberView(), decaM, reportedProblems,true)) { @@ -1040,7 +1040,7 @@ class BcelClassWeaver implements IClassWeaver { } if (annotationsToAdd == null) { - annotationsToAdd = new ArrayList<AnnotationGen>(); + annotationsToAdd = new ArrayList<>(); } AnnotationGen a = ((BcelAnnotation) decaM.getAnnotation()).getBcelAnnotation(); // create copy to get the annotation type into the right constant pool @@ -1128,7 +1128,7 @@ class BcelClassWeaver implements IClassWeaver { * in type. */ private List<DeclareAnnotation> getMatchingSubset(List<DeclareAnnotation> declareAnnotations, ResolvedType type) { - List<DeclareAnnotation> subset = new ArrayList<DeclareAnnotation>(); + List<DeclareAnnotation> subset = new ArrayList<>(); for (DeclareAnnotation da : declareAnnotations) { if (da.couldEverMatch(type)) { subset.add(da); @@ -1141,7 +1141,7 @@ class BcelClassWeaver implements IClassWeaver { * Get a subset of all the type mungers defined on this aspect */ private List<ConcreteTypeMunger> getITDSubset(LazyClassGen clazz, ResolvedTypeMunger.Kind wantedKind) { - List<ConcreteTypeMunger> subset = new ArrayList<ConcreteTypeMunger>(); + List<ConcreteTypeMunger> subset = new ArrayList<>(); for (ConcreteTypeMunger typeMunger : clazz.getBcelObjectType().getTypeMungers()) { if (typeMunger.getMunger().getKind() == wantedKind) { subset.add(typeMunger); @@ -1196,7 +1196,7 @@ class BcelClassWeaver implements IClassWeaver { for (ConcreteTypeMunger itdField : itdFields) { BcelTypeMunger fieldMunger = (BcelTypeMunger) itdField; ResolvedMember itdIsActually = fieldMunger.getSignature(); - Set<DeclareAnnotation> worthRetrying = new LinkedHashSet<DeclareAnnotation>(); + Set<DeclareAnnotation> worthRetrying = new LinkedHashSet<>(); boolean modificationOccured = false; for (DeclareAnnotation decaF : decaFs) { @@ -1235,7 +1235,7 @@ class BcelClassWeaver implements IClassWeaver { while (!worthRetrying.isEmpty() && modificationOccured) { modificationOccured = false; - List<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>(); + List<DeclareAnnotation> forRemoval = new ArrayList<>(); for (DeclareAnnotation decaF : worthRetrying) { if (decaF.matches(itdIsActually, world)) { if (decaF.isRemover()) { @@ -1280,7 +1280,7 @@ class BcelClassWeaver implements IClassWeaver { // for (Iterator iter = itdsForMethodAndConstructor.iterator(); iter.hasNext();) { // BcelTypeMunger methodctorMunger = (BcelTypeMunger) iter.next(); ResolvedMember unMangledInterMethod = methodctorMunger.getSignature(); - List<DeclareAnnotation> worthRetrying = new ArrayList<DeclareAnnotation>(); + List<DeclareAnnotation> worthRetrying = new ArrayList<>(); boolean modificationOccured = false; for (DeclareAnnotation decaMC : decaMCs) { @@ -1306,7 +1306,7 @@ class BcelClassWeaver implements IClassWeaver { while (!worthRetrying.isEmpty() && modificationOccured) { modificationOccured = false; - List<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>(); + List<DeclareAnnotation> forRemoval = new ArrayList<>(); for (DeclareAnnotation decaMC : worthRetrying) { if (decaMC.matches(unMangledInterMethod, world)) { LazyMethodGen annotationHolder = locateAnnotationHolderForFieldMunger(clazz, methodctorMunger); @@ -1371,7 +1371,7 @@ class BcelClassWeaver implements IClassWeaver { * as well as on the interfieldinit method. */ private boolean weaveDeclareAtField(LazyClassGen clazz) { - List<Integer> reportedProblems = new ArrayList<Integer>(); + List<Integer> reportedProblems = new ArrayList<>(); List<DeclareAnnotation> allDecafs = world.getDeclareAnnotationOnFields(); if (allDecafs.isEmpty()) { return false; @@ -1389,12 +1389,12 @@ class BcelClassWeaver implements IClassWeaver { List<BcelField> fields = clazz.getFieldGens(); if (fields != null) { - Set<DeclareAnnotation> unusedDecafs = new HashSet<DeclareAnnotation>(); + Set<DeclareAnnotation> unusedDecafs = new HashSet<>(); unusedDecafs.addAll(decafs); for (BcelField field : fields) { if (!field.getName().startsWith(NameMangler.PREFIX)) { // Single first pass - Set<DeclareAnnotation> worthRetrying = new LinkedHashSet<DeclareAnnotation>(); + Set<DeclareAnnotation> worthRetrying = new LinkedHashSet<>(); boolean modificationOccured = false; AnnotationAJ[] dontAddMeTwice = field.getAnnotations(); @@ -1443,7 +1443,7 @@ class BcelClassWeaver implements IClassWeaver { while (!worthRetrying.isEmpty() && modificationOccured) { modificationOccured = false; // lets have another go with any remaining ones - List<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>(); + List<DeclareAnnotation> forRemoval = new ArrayList<>(); for (DeclareAnnotation decaF : worthRetrying) { if (decaF.matches(field, world)) { if (decaF.isRemover()) { @@ -1592,7 +1592,7 @@ class BcelClassWeaver implements IClassWeaver { } private Set<String> findAspectsForMungers(LazyMethodGen mg) { - Set<String> aspectsAffectingType = new HashSet<String>(); + Set<String> aspectsAffectingType = new HashSet<>(); for (BcelShadow shadow : mg.matchedShadows) { for (ShadowMunger munger : shadow.getMungers()) { if (munger instanceof BcelAdvice) { @@ -1611,7 +1611,7 @@ class BcelClassWeaver implements IClassWeaver { private boolean inlineSelfConstructors(List<LazyMethodGen> methodGens, List<LazyMethodGen> recursiveCtors) { boolean inlinedSomething = false; - List<LazyMethodGen> newRecursiveCtors = new ArrayList<LazyMethodGen>(); + List<LazyMethodGen> newRecursiveCtors = new ArrayList<>(); for (LazyMethodGen methodGen : methodGens) { if (!methodGen.getName().equals("<init>")) { continue; @@ -1783,7 +1783,7 @@ class BcelClassWeaver implements IClassWeaver { // search for 'returns' and make them jump to the // aload_<n>,monitorexit InstructionHandle walker = body.getStart(); - List<InstructionHandle> rets = new ArrayList<InstructionHandle>(); + List<InstructionHandle> rets = new ArrayList<>(); while (walker != null) { if (walker.getInstruction().isReturnInstruction()) { rets.add(walker); @@ -1984,7 +1984,7 @@ class BcelClassWeaver implements IClassWeaver { // search for 'returns' and make them to the // aload_<n>,monitorexit InstructionHandle walker = body.getStart(); - List<InstructionHandle> rets = new ArrayList<InstructionHandle>(); + List<InstructionHandle> rets = new ArrayList<>(); while (walker != null) { // !walker.equals(body.getEnd())) { if (walker.getInstruction().isReturnInstruction()) { rets.add(walker); @@ -2101,7 +2101,7 @@ class BcelClassWeaver implements IClassWeaver { // search for 'returns' and make them to the aload_<n>,monitorexit InstructionHandle walker = body.getStart(); - List<InstructionHandle> rets = new ArrayList<InstructionHandle>(); + List<InstructionHandle> rets = new ArrayList<>(); while (walker != null) { // !walker.equals(body.getEnd())) { if (walker.getInstruction().isReturnInstruction()) { rets.add(walker); @@ -2192,7 +2192,7 @@ class BcelClassWeaver implements IClassWeaver { InstructionList ret = new InstructionList(); InstructionList sourceList = donor.getBody(); - Map<InstructionHandle, InstructionHandle> srcToDest = new HashMap<InstructionHandle, InstructionHandle>(); + Map<InstructionHandle, InstructionHandle> srcToDest = new HashMap<>(); ConstantPool donorCpg = donor.getEnclosingClass().getConstantPool(); ConstantPool recipientCpg = recipient.getEnclosingClass().getConstantPool(); @@ -2296,8 +2296,8 @@ class BcelClassWeaver implements IClassWeaver { } // second pass: retarget branch instructions, copy ranges and tags - Map<Tag, Tag> tagMap = new HashMap<Tag, Tag>(); - Map<BcelShadow, BcelShadow> shadowMap = new HashMap<BcelShadow, BcelShadow>(); + Map<Tag, Tag> tagMap = new HashMap<>(); + Map<BcelShadow, BcelShadow> shadowMap = new HashMap<>(); for (InstructionHandle dest = ret.getStart(), src = sourceList.getStart(); dest != null; dest = dest.getNext(), src = src .getNext()) { Instruction inst = dest.getInstruction(); @@ -2630,7 +2630,7 @@ class BcelClassWeaver implements IClassWeaver { private boolean match(LazyMethodGen mg) { BcelShadow enclosingShadow; - List<BcelShadow> shadowAccumulator = new ArrayList<BcelShadow>(); + List<BcelShadow> shadowAccumulator = new ArrayList<>(); boolean isOverweaving = world.isOverWeaving(); boolean startsAngly = mg.getName().charAt(0) == '<'; // we want to match ajsynthetic constructors... @@ -3040,7 +3040,7 @@ class BcelClassWeaver implements IClassWeaver { */ private ResolvedMember findResolvedMemberNamed(ResolvedType type, String methodName, UnresolvedType[] params) { ResolvedMember[] allMethods = type.getDeclaredMethods(); - List<ResolvedMember> candidates = new ArrayList<ResolvedMember>(); + List<ResolvedMember> candidates = new ArrayList<>(); for (ResolvedMember candidate : allMethods) { if (candidate.getName().equals(methodName)) { if (candidate.getArity() == params.length) { diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXConverter.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXConverter.java index 7f6c70d72..70ea191cb 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXConverter.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXConverter.java @@ -37,7 +37,7 @@ public class BcelGenericSignatureToTypeXConverter { public static ResolvedType classTypeSignature2TypeX(GenericSignature.ClassTypeSignature aClassTypeSignature, GenericSignature.FormalTypeParameter[] typeParams, World world) throws GenericSignatureFormatException { - Map<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<GenericSignature.FormalTypeParameter, ReferenceType>(); + Map<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<>(); ResolvedType ret = classTypeSignature2TypeX(aClassTypeSignature, typeParams, world, typeMap); fixUpCircularDependencies(ret, typeMap); return ret; @@ -100,7 +100,7 @@ public class BcelGenericSignatureToTypeXConverter { public static ResolvedType fieldTypeSignature2TypeX(GenericSignature.FieldTypeSignature aFieldTypeSignature, GenericSignature.FormalTypeParameter[] typeParams, World world) throws GenericSignatureFormatException { - Map<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<GenericSignature.FormalTypeParameter, ReferenceType>(); + Map<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<>(); ResolvedType ret = fieldTypeSignature2TypeX(aFieldTypeSignature, typeParams, world, typeMap); fixUpCircularDependencies(ret, typeMap); return ret; @@ -133,7 +133,7 @@ public class BcelGenericSignatureToTypeXConverter { public static TypeVariable formalTypeParameter2TypeVariable(GenericSignature.FormalTypeParameter aFormalTypeParameter, GenericSignature.FormalTypeParameter[] typeParams, World world) throws GenericSignatureFormatException { - Map<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<GenericSignature.FormalTypeParameter, ReferenceType>(); + Map<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<>(); return formalTypeParameter2TypeVariable(aFormalTypeParameter, typeParams, world, typeMap); } @@ -185,7 +185,7 @@ public class BcelGenericSignatureToTypeXConverter { public static ResolvedType typeSignature2TypeX(GenericSignature.TypeSignature aTypeSig, GenericSignature.FormalTypeParameter[] typeParams, World world) throws GenericSignatureFormatException { - Map<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<GenericSignature.FormalTypeParameter, ReferenceType>(); + Map<GenericSignature.FormalTypeParameter, ReferenceType> typeMap = new HashMap<>(); ResolvedType ret = typeSignature2TypeX(aTypeSig, typeParams, world, typeMap); fixUpCircularDependencies(ret, typeMap); return ret; diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelMethod.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelMethod.java index 6da16be27..08651412c 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelMethod.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelMethod.java @@ -155,7 +155,7 @@ class BcelMethod extends ResolvedMemberImpl { if (nvPair.getNameString().equals("argNames")) { String argNames = nvPair.getValue().stringifyValue(); StringTokenizer argNameTokenizer = new StringTokenizer(argNames, " ,"); - List<String> argsList = new ArrayList<String>(); + List<String> argsList = new ArrayList<>(); while (argNameTokenizer.hasMoreTokens()) { argsList.add(argNameTokenizer.nextToken()); } @@ -257,7 +257,7 @@ class BcelMethod extends ResolvedMemberImpl { // for testing - use with the method above public String[] getAttributeNames(boolean onlyIncludeAjOnes) { Attribute[] as = method.getAttributes(); - List<String> names = new ArrayList<String>(); + List<String> names = new ArrayList<>(); // String[] strs = new String[as.length]; for (Attribute a : as) { if (!onlyIncludeAjOnes || a.getName().startsWith(AjAttribute.AttributePrefix)) { diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelObjectType.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelObjectType.java index b7ce3f842..3e9ac1b75 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelObjectType.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelObjectType.java @@ -113,8 +113,8 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { private boolean isCodeStyleAspect = false; // not redundant with field // above! - private WeakReference<ResolvedType> superTypeReference = new WeakReference<ResolvedType>(null); - private WeakReference<ResolvedType[]> superInterfaceReferences = new WeakReference<ResolvedType[]>(null); + private WeakReference<ResolvedType> superTypeReference = new WeakReference<>(null); + private WeakReference<ResolvedType[]> superInterfaceReferences = new WeakReference<>(null); private int bitflag = 0x0000; @@ -237,7 +237,7 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { } World world = getResolvedTypeX().getWorld(); supertype = world.resolve(UnresolvedType.forSignature(superclassSignature)); - superTypeReference = new WeakReference<ResolvedType>(supertype); + superTypeReference = new WeakReference<>(supertype); } return supertype; } @@ -275,7 +275,7 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { interfaceTypes[i] = getResolvedTypeX().getWorld().resolve(UnresolvedType.forSignature(interfaceSignatures[i])); } } - superInterfaceReferences = new WeakReference<ResolvedType[]>(interfaceTypes); + superInterfaceReferences = new WeakReference<>(interfaceTypes); return interfaceTypes; } else { return cachedInterfaceTypes; @@ -386,9 +386,9 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { } catch (RuntimeException re) { throw new RuntimeException("Problem processing attributes in " + javaClass.getFileName(), re); } - List<ResolvedPointcutDefinition> pointcuts = new ArrayList<ResolvedPointcutDefinition>(); - typeMungers = new ArrayList<ConcreteTypeMunger>(); - declares = new ArrayList<Declare>(); + List<ResolvedPointcutDefinition> pointcuts = new ArrayList<>(); + typeMungers = new ArrayList<>(); + declares = new ArrayList<>(); processAttributes(l, pointcuts, false); ReferenceType type = getResolvedTypeX(); AsmManager asmManager = ((BcelWorld) type.getWorld()).getModelAsAsmManager(); @@ -671,7 +671,7 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { bitflag |= DISCOVERED_ANNOTATION_TARGET_KINDS; annotationTargetKinds = null; // null means we have no idea or the // @Target annotation hasn't been used - List<AnnotationTargetKind> targetKinds = new ArrayList<AnnotationTargetKind>(); + List<AnnotationTargetKind> targetKinds = new ArrayList<>(); if (isAnnotation()) { AnnotationAJ[] annotationsOnThisType = getAnnotations(); for (AnnotationAJ a : annotationsOnThisType) { @@ -770,7 +770,7 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { // proceeding with resolution. GenericSignature.FormalTypeParameter[] extraFormals = getFormalTypeParametersFromOuterClass(); if (extraFormals.length > 0) { - List<FormalTypeParameter> allFormals = new ArrayList<FormalTypeParameter>(); + List<FormalTypeParameter> allFormals = new ArrayList<>(); for (FormalTypeParameter formalTypeParameter : formalsForResolution) { allFormals.add(formalTypeParameter); } diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java index 362c8be9d..61b0bf746 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java @@ -154,7 +154,7 @@ public class BcelShadow extends Shadow { if (mungers.size() > 0) { List<ShadowMunger> src = mungers; if (s.mungers == Collections.EMPTY_LIST) { - s.mungers = new ArrayList<ShadowMunger>(); + s.mungers = new ArrayList<>(); } List<ShadowMunger> dest = s.mungers; for (ShadowMunger shadowMunger : src) { @@ -299,7 +299,7 @@ public class BcelShadow extends Shadow { public void addAdvicePreventingLazyTjp(BcelAdvice advice) { if (badAdvice == null) { - badAdvice = new ArrayList<BcelAdvice>(); + badAdvice = new ArrayList<>(); } badAdvice.add(advice); } @@ -1431,7 +1431,7 @@ public class BcelShadow extends Shadow { if (thisAnnotationVars != null) { return; } - thisAnnotationVars = new HashMap<ResolvedType, TypeAnnotationAccessVar>(); + thisAnnotationVars = new HashMap<>(); // populate.. } @@ -1445,7 +1445,7 @@ public class BcelShadow extends Shadow { } targetAnnotationVars = thisAnnotationVars; } else { - targetAnnotationVars = new HashMap<ResolvedType, TypeAnnotationAccessVar>(); + targetAnnotationVars = new HashMap<>(); ResolvedType[] rtx = this.getTargetType().resolve(world).getAnnotationTypes(); // what about annotations we havent // gotten yet but we will get in // subclasses? @@ -1549,7 +1549,7 @@ public class BcelShadow extends Shadow { if (kindedAnnotationVars != null) { return; } - kindedAnnotationVars = new HashMap<ResolvedType, AnnotationAccessVar>(); + kindedAnnotationVars = new HashMap<>(); ResolvedType[] annotations = null; Member shadowSignature = getSignature(); @@ -1653,7 +1653,7 @@ public class BcelShadow extends Shadow { if (withinAnnotationVars != null) { return; } - withinAnnotationVars = new HashMap<ResolvedType, AnnotationAccessVar>(); + withinAnnotationVars = new HashMap<>(); ResolvedType[] annotations = getEnclosingType().resolve(world).getAnnotationTypes(); for (ResolvedType ann : annotations) { @@ -1666,7 +1666,7 @@ public class BcelShadow extends Shadow { if (withincodeAnnotationVars != null) { return; } - withincodeAnnotationVars = new HashMap<ResolvedType, AnnotationAccessVar>(); + withincodeAnnotationVars = new HashMap<>(); // For some shadow we are interested in annotations on the method containing that shadow. ResolvedType[] annotations = getEnclosingMethod().getMemberView().getAnnotationTypes(); @@ -1734,7 +1734,7 @@ public class BcelShadow extends Shadow { * @return a list of all the return instructions in the range of this shadow */ private List<InstructionHandle> findReturnInstructions() { - List<InstructionHandle> returns = new ArrayList<InstructionHandle>(); + List<InstructionHandle> returns = new ArrayList<>(); for (InstructionHandle ih = range.getStart(); ih != range.getEnd(); ih = ih.getNext()) { if (ih.getInstruction().isReturnInstruction()) { returns.add(ih); @@ -2187,14 +2187,14 @@ public class BcelShadow extends Shadow { // Parameters are: this if there is one, target if there is one and its different to this, then original arguments // at the shadow, then tjp String extractedShadowMethodName = NameMangler.aroundShadowMethodName(getSignature(), shadowClass.getNewGeneratedNameTag()); - List<String> parameterNames = new ArrayList<String>(); + List<String> parameterNames = new ArrayList<>(); boolean shadowClassIsInterface = shadowClass.isInterface(); LazyMethodGen extractedShadowMethod = extractShadowInstructionsIntoNewMethod(extractedShadowMethodName, shadowClassIsInterface?Modifier.PUBLIC:Modifier.PRIVATE, munger.getSourceLocation(), parameterNames,shadowClassIsInterface); - List<BcelVar> argsToCallLocalAdviceMethodWith = new ArrayList<BcelVar>(); - List<BcelVar> proceedVarList = new ArrayList<BcelVar>(); + List<BcelVar> argsToCallLocalAdviceMethodWith = new ArrayList<>(); + List<BcelVar> proceedVarList = new ArrayList<>(); int extraParamOffset = 0; // Create the extra parameters that are needed for passing to proceed @@ -2845,7 +2845,7 @@ public class BcelShadow extends Shadow { boolean shadowClassIsInterface = getEnclosingClass().isInterface(); LazyMethodGen callbackMethod = extractShadowInstructionsIntoNewMethod( NameMangler.aroundShadowMethodName(getSignature(), getEnclosingClass().getNewGeneratedNameTag()), shadowClassIsInterface?Modifier.PUBLIC:0, - munger.getSourceLocation(), new ArrayList<String>(),shadowClassIsInterface); + munger.getSourceLocation(), new ArrayList<>(),shadowClassIsInterface); BcelVar[] adviceVars = munger.getExposedStateAsBcelVars(true); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java index 60f366e5a..1fb2812bb 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java @@ -162,14 +162,14 @@ public class BcelTypeMunger extends ConcreteTypeMunger { thisAspect.getClassName()); Map<String, List<String>> declareParentsMap = thisAspectNode.getDeclareParentsMap(); if (declareParentsMap == null) { - declareParentsMap = new HashMap<String, List<String>>(); + declareParentsMap = new HashMap<>(); thisAspectNode.setDeclareParentsMap(declareParentsMap); } String tname = target.getName(); String pname = newParent.getName(); List<String> newparents = declareParentsMap.get(tname); if (newparents == null) { - newparents = new ArrayList<String>(); + newparents = new ArrayList<>(); declareParentsMap.put(tname, newparents); } newparents.add(pname); @@ -933,7 +933,7 @@ public class BcelTypeMunger extends ConcreteTypeMunger { } else { annotationsOnRealMember = realMember.getAnnotations(); } - Set<ResolvedType> addedAnnotations = new HashSet<ResolvedType>(); + Set<ResolvedType> addedAnnotations = new HashSet<>(); if (annotationsOnRealMember != null) { for (AnnotationAJ anno : annotationsOnRealMember) { AnnotationGen a = ((BcelAnnotation) anno).getBcelAnnotation(); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeaver.java index 41cbf9a7a..a6809f26f 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeaver.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeaver.java @@ -112,8 +112,8 @@ public class BcelWeaver { private boolean inReweavableMode = false; - private transient List<UnwovenClassFile> addedClasses = new ArrayList<UnwovenClassFile>(); - private transient List<String> deletedTypenames = new ArrayList<String>(); + private transient List<UnwovenClassFile> addedClasses = new ArrayList<>(); + private transient List<String> deletedTypenames = new ArrayList<>(); // These four are setup by prepareForWeave private transient List<ShadowMunger> shadowMungerList = null; @@ -244,7 +244,7 @@ public class BcelWeaver { private List<ResolvedType> addAspectsFromJarFile(File inFile) throws FileNotFoundException, IOException { ZipInputStream inStream = new ZipInputStream(new FileInputStream(inFile)); // ??? buffered - List<ResolvedType> addedAspects = new ArrayList<ResolvedType>(); + List<ResolvedType> addedAspects = new ArrayList<>(); try { while (true) { ZipEntry entry = inStream.getNextEntry(); @@ -286,7 +286,7 @@ public class BcelWeaver { * @throws IOException */ private List<ResolvedType> addAspectsFromDirectory(File directory) throws FileNotFoundException, IOException { - List<ResolvedType> addedAspects = new ArrayList<ResolvedType>(); + List<ResolvedType> addedAspects = new ArrayList<>(); File[] classFiles = FileUtil.listFiles(directory, new FileFilter() { public boolean accept(File pathname) { return pathname.getName().endsWith(".class"); @@ -350,7 +350,7 @@ public class BcelWeaver { * */ public List<UnwovenClassFile> addDirectoryContents(File inFile, File outDir) throws IOException { - List<UnwovenClassFile> addedClassFiles = new ArrayList<UnwovenClassFile>(); + List<UnwovenClassFile> addedClassFiles = new ArrayList<>(); // Get a list of all files (i.e. everything that isnt a directory) File[] files = FileUtil.listFiles(inFile, new FileFilter() { @@ -373,7 +373,7 @@ public class BcelWeaver { */ public List<UnwovenClassFile> addJarFile(File inFile, File outDir, boolean canBeDirectory) { // System.err.println("? addJarFile(" + inFile + ", " + outDir + ")"); - List<UnwovenClassFile> addedClassFiles = new ArrayList<UnwovenClassFile>(); + List<UnwovenClassFile> addedClassFiles = new ArrayList<>(); needToReweaveWorld = true; JarFile inJar = null; @@ -642,7 +642,7 @@ public class BcelWeaver { // across the set of pointcuts.... // Use a map from key based on pc equality, to value based on // pc identity. - Map<Pointcut, Pointcut> pcMap = new HashMap<Pointcut, Pointcut>(); + Map<Pointcut, Pointcut> pcMap = new HashMap<>(); for (ShadowMunger munger: shadowMungers) { Pointcut p = munger.getPointcut(); Pointcut newP = shareEntriesFromMap(p, pcMap); @@ -736,7 +736,7 @@ public class BcelWeaver { if (kindsInCommon != Shadow.NO_SHADOW_KINDS_BITS && couldEverMatchSameJoinPoints(left, right)) { // we know that every branch binds every formal, so there is no // ambiguity if each branch binds it in exactly the same way... - List<String> ambiguousNames = new ArrayList<String>(); + List<String> ambiguousNames = new ArrayList<>(); for (int i = 0; i < numFormals; i++) { if (leftBindings[i] == null) { if (rightBindings[i] != null) { @@ -1011,11 +1011,11 @@ public class BcelWeaver { trace.enter("weave", this, input); } ContextToken weaveToken = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.WEAVING, ""); - Collection<String> wovenClassNames = new ArrayList<String>(); + Collection<String> wovenClassNames = new ArrayList<>(); IWeaveRequestor requestor = input.getRequestor(); if (world.getModel() != null && world.isMinimalModel()) { - candidatesForRemoval = new HashSet<IProgramElement>(); + candidatesForRemoval = new HashSet<>(); } if (world.getModel() != null && !isBatchWeave) { AsmManager manager = world.getModelAsAsmManager(); @@ -1111,7 +1111,7 @@ public class BcelWeaver { // encountered). // For class A, the order is superclasses of A then superinterfaces of A // (and this mechanism is applied recursively) - List<String> typesToProcess = new ArrayList<String>(); + List<String> typesToProcess = new ArrayList<>(); for (Iterator<UnwovenClassFile> iter = input.getClassFileIterator(); iter.hasNext();) { UnwovenClassFile clf = iter.next(); if (clf.shouldBeWoven()) { @@ -1255,7 +1255,7 @@ public class BcelWeaver { // put out a warning if (world.isInJava5Mode() && world.getLint().adviceDidNotMatch.isEnabled()) { List l = world.getCrosscuttingMembersSet().getShadowMungers(); - Set<AdviceLocation> alreadyWarnedLocations = new HashSet<AdviceLocation>(); + Set<AdviceLocation> alreadyWarnedLocations = new HashSet<>(); for (Object o : l) { ShadowMunger element = (ShadowMunger) o; @@ -1353,7 +1353,7 @@ public class BcelWeaver { Set<String> aspectsPreviouslyInWorld = wsi.getAspectsAffectingType(); // keep track of them just to ensure unique missing aspect error // reporting - Set<String> alreadyConfirmedReweavableState = new HashSet<String>(); + Set<String> alreadyConfirmedReweavableState = new HashSet<>(); for (String requiredTypeSignature : aspectsPreviouslyInWorld) { // for (Iterator iter = aspectsPreviouslyInWorld.iterator(); iter.hasNext();) { // String requiredTypeName = (String) iter.next(); @@ -1480,7 +1480,7 @@ public class BcelWeaver { } onType.clearInterTypeMungers(); - List<DeclareParents> decpToRepeat = new ArrayList<DeclareParents>(); + List<DeclareParents> decpToRepeat = new ArrayList<>(); boolean aParentChangeOccurred = false; boolean anAnnotationChangeOccurred = false; @@ -1504,7 +1504,7 @@ public class BcelWeaver { while ((aParentChangeOccurred || anAnnotationChangeOccurred) && !decpToRepeat.isEmpty()) { anAnnotationChangeOccurred = aParentChangeOccurred = false; - List<DeclareParents> decpToRepeatNextTime = new ArrayList<DeclareParents>(); + List<DeclareParents> decpToRepeatNextTime = new ArrayList<>(); for (DeclareParents decp : decpToRepeat) { boolean typeChanged = applyDeclareParents(decp, onType); if (typeChanged) { @@ -1962,7 +1962,7 @@ public class BcelWeaver { // weaving FastMatchInfo info = new FastMatchInfo(type, null, world); - List<ShadowMunger> result = new ArrayList<ShadowMunger>(); + List<ShadowMunger> result = new ArrayList<>(); if (world.areInfoMessagesEnabled() && world.isTimingEnabled()) { for (ShadowMunger munger : list) { diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java index 5916e0117..65c3da11a 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java @@ -264,7 +264,7 @@ public class BcelWorld extends World implements Repository { } private static List<String> makeDefaultClasspath(String cp) { - List<String> classPath = new ArrayList<String>(); + List<String> classPath = new ArrayList<>(); classPath.addAll(getPathEntries(cp)); classPath.addAll(getPathEntries(ClassPath.getClassPath())); return classPath; @@ -272,7 +272,7 @@ public class BcelWorld extends World implements Repository { } private static List<String> getPathEntries(String s) { - List<String> ret = new ArrayList<String>(); + List<String> ret = new ArrayList<>(); StringTokenizer tok = new StringTokenizer(s, File.pathSeparator); while (tok.hasMoreTokens()) { ret.add(tok.nextToken()); @@ -880,7 +880,7 @@ public class BcelWorld extends World implements Repository { } onType.clearInterTypeMungers(); - List<DeclareParents> decpToRepeat = new ArrayList<DeclareParents>(); + List<DeclareParents> decpToRepeat = new ArrayList<>(); boolean aParentChangeOccurred = false; boolean anAnnotationChangeOccurred = false; @@ -914,7 +914,7 @@ public class BcelWorld extends World implements Repository { while ((aParentChangeOccurred || anAnnotationChangeOccurred) && !decpToRepeat.isEmpty()) { anAnnotationChangeOccurred = aParentChangeOccurred = false; - List<DeclareParents> decpToRepeatNextTime = new ArrayList<DeclareParents>(); + List<DeclareParents> decpToRepeatNextTime = new ArrayList<>(); for (DeclareParents decp: decpToRepeat) { if (applyDeclareParents(decp, onType)) { aParentChangeOccurred = true; @@ -1063,7 +1063,7 @@ public class BcelWorld extends World implements Repository { } anythingMissing = true; if (aspectRequiredTypes == null) { - aspectRequiredTypes = new HashMap<String,String>(); + aspectRequiredTypes = new HashMap<>(); } // Record that it has an invalid type reference aspectRequiredTypes.put(aspectName,requiredTypeName); @@ -1112,12 +1112,12 @@ public class BcelWorld extends World implements Repository { return aspectRequiredTypes.containsKey(aspectName); } - private List<String> aspectRequiredTypesProcessed = new ArrayList<String>(); + private List<String> aspectRequiredTypesProcessed = new ArrayList<>(); private Map<String, String> aspectRequiredTypes = null; public void addAspectRequires(String aspectClassName, String requiredType) { if (aspectRequiredTypes == null) { - aspectRequiredTypes = new HashMap<String, String>(); + aspectRequiredTypes = new HashMap<>(); } aspectRequiredTypes.put(aspectClassName,requiredType); } @@ -1137,10 +1137,10 @@ public class BcelWorld extends World implements Repository { private int mode; private boolean initialized = false; // Lazily done - private List<Definition> definitions = new ArrayList<Definition>(); + private List<Definition> definitions = new ArrayList<>(); - private List<String> resolvedIncludedAspects = new ArrayList<String>(); - private Map<String, TypePattern> scopes = new HashMap<String, TypePattern>(); + private List<String> resolvedIncludedAspects = new ArrayList<>(); + private Map<String, TypePattern> scopes = new HashMap<>(); // these are not set for LTW mode (exclusion of these fast match patterns is handled before the weaver/world are used) private List<String> includedFastMatchPatterns = Collections.emptyList(); @@ -1180,7 +1180,7 @@ public class BcelWorld extends World implements Repository { public void ensureInitialized() { if (!initialized) { try { - resolvedIncludedAspects = new ArrayList<String>(); + resolvedIncludedAspects = new ArrayList<>(); // Process the definitions into something more optimal for (Definition definition : definitions) { List<String> aspectNames = definition.getAspectClassNames(); @@ -1217,8 +1217,8 @@ public class BcelWorld extends World implements Repository { try { List<String> includePatterns = definition.getIncludePatterns(); if (includePatterns.size() > 0) { - includedPatterns = new ArrayList<TypePattern>(); - includedFastMatchPatterns = new ArrayList<String>(); + includedPatterns = new ArrayList<>(); + includedFastMatchPatterns = new ArrayList<>(); } for (String includePattern : includePatterns) { if (includePattern.endsWith("..*")) { @@ -1231,8 +1231,8 @@ public class BcelWorld extends World implements Repository { } List<String> excludePatterns = definition.getExcludePatterns(); if (excludePatterns.size() > 0) { - excludedPatterns = new ArrayList<TypePattern>(); - excludedFastMatchPatterns = new ArrayList<String>(); + excludedPatterns = new ArrayList<>(); + excludedFastMatchPatterns = new ArrayList<>(); } for (String excludePattern : excludePatterns) { if (excludePattern.endsWith("..*")) { @@ -1308,7 +1308,7 @@ public class BcelWorld extends World implements Repository { public void addTypeDelegateResolver(TypeDelegateResolver typeDelegateResolver) { if (typeDelegateResolvers == null) { - typeDelegateResolvers = new ArrayList<TypeDelegateResolver>(); + typeDelegateResolvers = new ArrayList<>(); } typeDelegateResolvers.add(typeDelegateResolver); } diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java b/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java index fa45b7df6..81dde3f58 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java @@ -67,7 +67,7 @@ public class ClassPathManager { // The max number is configured through the property: // org.aspectj.weaver.openarchives // and it defaults to 1000 - private List<ZipFile> openArchives = new ArrayList<ZipFile>(); + private List<ZipFile> openArchives = new ArrayList<>(); static { String openzipsString = getSystemPropertyWithoutSecurityException("org.aspectj.weaver.openarchives", @@ -82,7 +82,7 @@ public class ClassPathManager { if (trace.isTraceEnabled()) { trace.enter("<init>", this, new Object[] { classpath==null?"null":classpath.toString(), handler }); } - entries = new ArrayList<Entry>(); + entries = new ArrayList<>(); for (String classpathEntry: classpath) { addPath(classpathEntry,handler); } @@ -328,9 +328,9 @@ public class ClassPathManager { static class JImageState { private final String jrtFsPath; private final FileSystem fs; - Map<String,Path> fileCache = new SoftHashMap<String, Path>(); + Map<String,Path> fileCache = new SoftHashMap<>(); boolean packageCacheInitialized = false; - Map<String,Path> packageCache = new HashMap<String, Path>(); + Map<String,Path> packageCache = new HashMap<>(); public JImageState(String jrtFsPath, FileSystem fs) { this.jrtFsPath = jrtFsPath; @@ -516,7 +516,7 @@ public class ClassPathManager { public List<ZipEntryClassFile> getAllClassFiles() throws IOException { ensureOpen(); - List<ZipEntryClassFile> ret = new ArrayList<ZipEntryClassFile>(); + List<ZipEntryClassFile> ret = new ArrayList<>(); for (Enumeration<? extends ZipEntry> e = zipFile.entries(); e.hasMoreElements();) { ZipEntry entry = e.nextElement(); String name = entry.getName(); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java index c8185d1c2..0eb3cb2b2 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java @@ -126,7 +126,7 @@ public final class LazyClassGen { int highestLineNumber = 0; // ---- JSR 45 info - private final SortedMap<String, InlinedSourceFileInfo> inlinedFiles = new TreeMap<String, InlinedSourceFileInfo>(); + private final SortedMap<String, InlinedSourceFileInfo> inlinedFiles = new TreeMap<>(); private boolean regenerateGenericSignatureAttribute = false; @@ -136,10 +136,10 @@ public final class LazyClassGen { private final World world; private final String packageName = null; - 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>(); + private final List<BcelField> fields = new ArrayList<>(); + private final List<LazyMethodGen> methodGens = new ArrayList<>(); + private final List<LazyClassGen> classGens = new ArrayList<>(); + private final List<AnnotationGen> annotations = new ArrayList<>(); private int childCounter = 0; private final InstructionFactory fact; @@ -818,7 +818,7 @@ public final class LazyClassGen { // non-recursive, may be a bug, ha ha. private List<LazyClassGen> getClassGens() { - List<LazyClassGen> ret = new ArrayList<LazyClassGen>(); + List<LazyClassGen> ret = new ArrayList<>(); ret.add(this); ret.addAll(classGens); return ret; @@ -828,7 +828,7 @@ public final class LazyClassGen { if (classGens.isEmpty()) { return Collections.emptyList(); } - List<UnwovenClassFile.ChildClass> ret = new ArrayList<UnwovenClassFile.ChildClass>(); + List<UnwovenClassFile.ChildClass> ret = new ArrayList<>(); for (LazyClassGen clazz : classGens) { byte[] bytes = clazz.getJavaClass(world).getBytes(); String name = clazz.getName(); @@ -1044,8 +1044,8 @@ public final class LazyClassGen { // // reflective thisJoinPoint support - private Map<BcelShadow, Field> tjpFields = new HashMap<BcelShadow, Field>(); - Map<CacheKey, Field> annotationCachingFieldCache = new HashMap<CacheKey, Field>(); + private Map<BcelShadow, Field> tjpFields = new HashMap<>(); + Map<CacheKey, Field> annotationCachingFieldCache = new HashMap<>(); private int tjpFieldsCounter = -1; // -1 means not yet initialized private int annoFieldsCounter = 0; public static final ObjectType proceedingTjpType = new ObjectType("org.aspectj.lang.ProceedingJoinPoint"); @@ -1254,12 +1254,12 @@ public final class LazyClassGen { } private InstructionList[] initializeAllTjps() { - Vector<InstructionList> lists = new Vector<InstructionList>(); + Vector<InstructionList> lists = new Vector<>(); InstructionList list = initInstructionList(); lists.add(list); - List<Map.Entry<BcelShadow, Field>> entries = new ArrayList<Map.Entry<BcelShadow, Field>>(tjpFields.entrySet()); + List<Map.Entry<BcelShadow, Field>> entries = new ArrayList<>(tjpFields.entrySet()); Collections.sort(entries, new Comparator<Map.Entry<BcelShadow, Field>>() { @Override public int compare(Map.Entry<BcelShadow, Field> a, Map.Entry<BcelShadow, Field> b) { diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java index 97f805273..3ab0c5daf 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java @@ -155,7 +155,7 @@ public final class LazyMethodGen implements Traceable { } else { body = null; } - this.attributes = new ArrayList<Attribute>(); + this.attributes = new ArrayList<>(); this.enclosingClass = enclosingClass; assertGoodBody(); this.originalMethodHasLocalVariableTable = true; // it is a new method, we want an lvar table @@ -272,7 +272,7 @@ public final class LazyMethodGen implements Traceable { if (memberView == null) { // If member view is null, we manage them in newAnnotations if (newAnnotations == null) { - newAnnotations = new ArrayList<AnnotationAJ>(); + newAnnotations = new ArrayList<>(); } newAnnotations.add(ax); } else { @@ -285,7 +285,7 @@ public final class LazyMethodGen implements Traceable { if (memberView == null) { // If member view is null, we manage them in newAnnotations if (annotationsForRemoval == null) { - annotationsForRemoval = new ArrayList<ResolvedType>(); + annotationsForRemoval = new ArrayList<>(); } annotationsForRemoval.add(annotationType); } else { @@ -627,7 +627,7 @@ public final class LazyMethodGen implements Traceable { } private class BodyPrinter { - Map<InstructionHandle, String> labelMap = new HashMap<InstructionHandle, String>(); + Map<InstructionHandle, String> labelMap = new HashMap<>(); InstructionList body; PrintStream out; @@ -653,7 +653,7 @@ public final class LazyMethodGen implements Traceable { // label assignment void assignLabels() { - LinkedList<ExceptionRange> exnTable = new LinkedList<ExceptionRange>(); + LinkedList<ExceptionRange> exnTable = new LinkedList<>(); String pendingLabel = null; // boolean hasPendingTargeters = false; int lcounter = 0; @@ -1072,9 +1072,9 @@ public final class LazyMethodGen implements Traceable { */ InstructionHandle oldInstructionHandle = getBody().getStart(); InstructionHandle newInstructionHandle = fresh.getStart(); - LinkedList<ExceptionRange> exceptionList = new LinkedList<ExceptionRange>(); + LinkedList<ExceptionRange> exceptionList = new LinkedList<>(); - Map<LocalVariableTag, LVPosition> localVariables = new HashMap<LocalVariableTag, LVPosition>(); + Map<LocalVariableTag, LVPosition> localVariables = new HashMap<>(); int currLine = -1; int lineNumberOffset = (fromFilename == null) ? 0 : getEnclosingClass().getSourceDebugExtensionOffset(fromFilename); @@ -1198,10 +1198,10 @@ public final class LazyMethodGen implements Traceable { int currLine = -1; int lineNumberOffset = (fromFilename == null) ? 0 : getEnclosingClass().getSourceDebugExtensionOffset(fromFilename); - Map<LocalVariableTag, LVPosition> localVariables = new HashMap<LocalVariableTag, LVPosition>(); - LinkedList<ExceptionRange> exceptionList = new LinkedList<ExceptionRange>(); - Set<InstructionHandle> forDeletion = new HashSet<InstructionHandle>(); - Set<BranchHandle> branchInstructions = new HashSet<BranchHandle>(); + Map<LocalVariableTag, LVPosition> localVariables = new HashMap<>(); + LinkedList<ExceptionRange> exceptionList = new LinkedList<>(); + Set<InstructionHandle> forDeletion = new HashSet<>(); + Set<BranchHandle> branchInstructions = new HashSet<>(); // OPTIMIZE sort out in here: getRange()/insertHandler() and type of // exceptionList while (iHandle != null) { @@ -1333,7 +1333,7 @@ public final class LazyMethodGen implements Traceable { paramSlots = -1; } - Map<InstructionHandle, Set<Integer>> duplicatedLocalMap = new HashMap<InstructionHandle, Set<Integer>>(); + Map<InstructionHandle, Set<Integer>> duplicatedLocalMap = new HashMap<>(); for (LocalVariableTag tag : localVariables.keySet()) { // have we already added one with the same slot number and start // location? @@ -1343,7 +1343,7 @@ public final class LazyMethodGen implements Traceable { InstructionHandle end = (tag.getSlot() < paramSlots ? methodEnd : lvpos.end); Set<Integer> slots = duplicatedLocalMap.get(start); if (slots == null) { - slots = new HashSet<Integer>(); + slots = new HashSet<>(); duplicatedLocalMap.put(start, slots); } else if (slots.contains(tag.getSlot())) { // we already have a var starting at this tag with this slot @@ -1461,7 +1461,7 @@ public final class LazyMethodGen implements Traceable { * i.e., a 1:1 mapping. */ private Map<InstructionHandle, InstructionHandle> copyAllInstructionsExceptRangeInstructionsInto(InstructionList intoList) { - Map<InstructionHandle, InstructionHandle> map = new HashMap<InstructionHandle, InstructionHandle>(); + Map<InstructionHandle, InstructionHandle> map = new HashMap<>(); for (InstructionHandle ih = getBody().getStart(); ih != null; ih = ih.getNext()) { if (Range.isRangeHandle(ih)) { continue; diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/Utility.java b/weaver/src/main/java/org/aspectj/weaver/bcel/Utility.java index c29721d4a..44ac48b9f 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/Utility.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/Utility.java @@ -69,10 +69,10 @@ public class Utility { public static List<AjAttribute> readAjAttributes(String classname, Attribute[] as, ISourceContext context, World w, AjAttribute.WeaverVersionInfo version, ConstantPoolReader dataDecompressor) { - List<AjAttribute> attributes = new ArrayList<AjAttribute>(); + List<AjAttribute> attributes = new ArrayList<>(); // first pass, look for version - List<Unknown> forSecondPass = new ArrayList<Unknown>(); + List<Unknown> forSecondPass = new ArrayList<>(); for (int i = as.length - 1; i >= 0; i--) { Attribute a = as[i]; if (a instanceof Unknown) { @@ -248,7 +248,7 @@ public class Utility { // Lookup table, for converting between pairs of types, it gives // us the method name in the Conversions class - private static Hashtable<String, String> validBoxing = new Hashtable<String, String>(); + private static Hashtable<String, String> validBoxing = new Hashtable<>(); static { validBoxing.put("Ljava/lang/Byte;B", "byteObject"); @@ -649,7 +649,7 @@ public class Utility { return Collections.emptyList(); } // Go through the annotation types - List<Lint.Kind> suppressedWarnings = new ArrayList<Lint.Kind>(); + List<Lint.Kind> suppressedWarnings = new ArrayList<>(); boolean found = false; for (int i = 0; !found && i < anns.length; i++) { // Check for the SuppressAjWarnings annotation diff --git a/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/Definition.java b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/Definition.java index de780156e..81330ed36 100644 --- a/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/Definition.java +++ b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/Definition.java @@ -48,15 +48,15 @@ public class Definition { weaverOptions = new StringBuffer(); dumpBefore = false; perClassloaderDumpDir = false; - dumpPatterns = new ArrayList<String>(); - includePatterns = new ArrayList<String>(); - excludePatterns = new ArrayList<String>(); - aspectClassNames = new ArrayList<String>(); - aspectExcludePatterns = new ArrayList<String>(); - aspectIncludePatterns = new ArrayList<String>(); - concreteAspects = new ArrayList<Definition.ConcreteAspect>(); - scopedAspects = new HashMap<String, String>(); - requiredTypesForAspects = new HashMap<String, String>(); + dumpPatterns = new ArrayList<>(); + includePatterns = new ArrayList<>(); + excludePatterns = new ArrayList<>(); + aspectClassNames = new ArrayList<>(); + aspectExcludePatterns = new ArrayList<>(); + aspectIncludePatterns = new ArrayList<>(); + concreteAspects = new ArrayList<>(); + scopedAspects = new HashMap<>(); + requiredTypesForAspects = new HashMap<>(); } public String getWeaverOptions() { @@ -135,10 +135,10 @@ public class Definition { this.extend = extend; } this.precedence = precedence; - this.pointcuts = new ArrayList<Definition.Pointcut>(); - this.declareAnnotations = new ArrayList<Definition.DeclareAnnotation>(); - this.pointcutsAndAdvice = new ArrayList<Definition.PointcutAndAdvice>(); - this.deows = new ArrayList<Definition.DeclareErrorOrWarning>(); + this.pointcuts = new ArrayList<>(); + this.declareAnnotations = new ArrayList<>(); + this.pointcutsAndAdvice = new ArrayList<>(); + this.deows = new ArrayList<>(); this.perclause = perclause; } } diff --git a/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/DocumentParser.java b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/DocumentParser.java index bfef1244b..cdecd6aaa 100644 --- a/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/DocumentParser.java +++ b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/DocumentParser.java @@ -83,7 +83,7 @@ public class DocumentParser extends DefaultHandler { private Definition.ConcreteAspect activeConcreteAspectDefinition; - private static Hashtable<String, Definition> parsedFiles = new Hashtable<String, Definition>(); + private static Hashtable<String, Definition> parsedFiles = new Hashtable<>(); private static boolean CACHE; private static final boolean LIGHTPARSER; diff --git a/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/LightXMLParser.java b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/LightXMLParser.java index 09a9df96f..e93bc896c 100644 --- a/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/LightXMLParser.java +++ b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/LightXMLParser.java @@ -25,7 +25,7 @@ public class LightXMLParser { private char pushedBackChar; private Reader reader; - private static Map<String, char[]> entities = new HashMap<String, char[]>(); + private static Map<String, char[]> entities = new HashMap<>(); static { entities.put("amp", new char[] { '&' }); @@ -37,7 +37,7 @@ public class LightXMLParser { public LightXMLParser() { this.name = null; - this.attributes = new HashMap<String, Object>(); + this.attributes = new HashMap<>(); this.children = new ArrayList(); } @@ -51,7 +51,7 @@ public class LightXMLParser { public void parseFromReader(Reader reader) throws Exception { this.pushedBackChar = NULL_CHAR; - this.attributes = new HashMap<String, Object>(); + this.attributes = new HashMap<>(); this.name = null; this.children = new ArrayList(); this.reader = reader; diff --git a/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipProvider.java b/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipProvider.java index 7df7f438c..80cfb6de7 100644 --- a/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipProvider.java +++ b/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipProvider.java @@ -404,7 +404,7 @@ public class AsmRelationshipProvider { IProgramElement root = model.getHierarchy().getRoot(); IProgramElement binaries = model.getHierarchy().findElementForLabel(root, IProgramElement.Kind.SOURCE_FOLDER, "binaries"); if (binaries == null) { - binaries = new ProgramElement(model, "binaries", IProgramElement.Kind.SOURCE_FOLDER, new ArrayList<IProgramElement>()); + binaries = new ProgramElement(model, "binaries", IProgramElement.Kind.SOURCE_FOLDER, new ArrayList<>()); root.addChild(binaries); } // if (aspect.getPackageName() != null) { @@ -413,7 +413,7 @@ public class AsmRelationshipProvider { IProgramElement pkgNode = model.getHierarchy().findElementForLabel(binaries, IProgramElement.Kind.PACKAGE, packagename); // note packages themselves have no source location if (pkgNode == null) { - pkgNode = new ProgramElement(model, packagename, IProgramElement.Kind.PACKAGE, new ArrayList<IProgramElement>()); + pkgNode = new ProgramElement(model, packagename, IProgramElement.Kind.PACKAGE, new ArrayList<>()); binaries.addChild(pkgNode); pkgNode.addChild(classFileNode); } else { @@ -539,7 +539,7 @@ public class AsmRelationshipProvider { IProgramElement root = asm.getHierarchy().getRoot(); IProgramElement binaries = asm.getHierarchy().findElementForLabel(root, IProgramElement.Kind.SOURCE_FOLDER, "binaries"); if (binaries == null) { - binaries = new ProgramElement(asm, "binaries", IProgramElement.Kind.SOURCE_FOLDER, new ArrayList<IProgramElement>()); + binaries = new ProgramElement(asm, "binaries", IProgramElement.Kind.SOURCE_FOLDER, new ArrayList<>()); root.addChild(binaries); } // if (aspect.getPackageName() != null) { @@ -548,7 +548,7 @@ public class AsmRelationshipProvider { IProgramElement pkgNode = asm.getHierarchy().findElementForLabel(binaries, IProgramElement.Kind.PACKAGE, packagename); // note packages themselves have no source location if (pkgNode == null) { - pkgNode = new ProgramElement(asm, packagename, IProgramElement.Kind.PACKAGE, new ArrayList<IProgramElement>()); + pkgNode = new ProgramElement(asm, packagename, IProgramElement.Kind.PACKAGE, new ArrayList<>()); binaries.addChild(pkgNode); pkgNode.addChild(classFileNode); } else { @@ -764,7 +764,7 @@ public class AsmRelationshipProvider { if (ts == null) { pe.setParameterSignatures(Collections.<char[]>emptyList(), Collections.<String>emptyList()); } else { - List<char[]> paramSigs = new ArrayList<char[]>(); + List<char[]> paramSigs = new ArrayList<>(); for (UnresolvedType t : ts) { paramSigs.add(t.getSignature().toCharArray()); } @@ -783,7 +783,7 @@ public class AsmRelationshipProvider { private static void setParentTypesOnDeclareParentsNode(DeclareParents decp, IProgramElement decpElement) { TypePatternList tpl = decp.getParents(); - List<String> parents = new ArrayList<String>(); + List<String> parents = new ArrayList<>(); for (int i = 0; i < tpl.size(); i++) { parents.add(tpl.get(i).getExactType().getName().replaceAll("\\$", ".")); } diff --git a/weaver/src/main/java/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java b/weaver/src/main/java/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java index 30983e38f..74477d143 100644 --- a/weaver/src/main/java/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java +++ b/weaver/src/main/java/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java @@ -32,7 +32,7 @@ import org.aspectj.weaver.World; public class JavaLangTypeToResolvedTypeConverter { // Used to prevent recursion - we record what we are working on and return it if asked again *whilst* working on it - private Map<Type, TypeVariableReferenceType> typeVariablesInProgress = new HashMap<Type, TypeVariableReferenceType>(); + private Map<Type, TypeVariableReferenceType> typeVariablesInProgress = new HashMap<>(); private final World world; public JavaLangTypeToResolvedTypeConverter(World aWorld) { diff --git a/weaver/src/main/java/org/aspectj/weaver/tools/WeavingAdaptor.java b/weaver/src/main/java/org/aspectj/weaver/tools/WeavingAdaptor.java index 5bb0fd80d..d3a194fcc 100644 --- a/weaver/src/main/java/org/aspectj/weaver/tools/WeavingAdaptor.java +++ b/weaver/src/main/java/org/aspectj/weaver/tools/WeavingAdaptor.java @@ -91,7 +91,7 @@ public class WeavingAdaptor implements IMessageContext { private WeavingAdaptorMessageHolder messageHolder; private boolean abortOnError = false; protected GeneratedClassHandler generatedClassHandler; - protected Map<String, IUnwovenClassFile> generatedClasses = new HashMap<String, IUnwovenClassFile>(); + protected Map<String, IUnwovenClassFile> generatedClasses = new HashMap<>(); public BcelObjectType delegateForCurrentClass; // lazily initialized, should be used to prevent parsing bytecode multiple // times protected ProtectionDomain activeProtectionDomain; @@ -138,7 +138,7 @@ public class WeavingAdaptor implements IMessageContext { } protected List<String> getFullClassPath(ClassLoader loader) { - List<String> list = new LinkedList<String>(); + List<String> list = new LinkedList<>(); for (; loader != null; loader = loader.getParent()) { if (loader instanceof URLClassLoader) { URL[] urls = ((URLClassLoader) loader).getURLs(); @@ -165,7 +165,7 @@ public class WeavingAdaptor implements IMessageContext { } private List<String> getFullAspectPath(ClassLoader loader) { - List<String> list = new LinkedList<String>(); + List<String> list = new LinkedList<>(); for (; loader != null; loader = loader.getParent()) { if (loader instanceof WeavingClassLoader) { URL[] urls = ((WeavingClassLoader) loader).getAspectURLs(); @@ -602,7 +602,7 @@ public class WeavingAdaptor implements IMessageContext { } private static List<String> makeClasspath(String cp) { - List<String> ret = new ArrayList<String>(); + List<String> ret = new ArrayList<>(); if (cp != null) { StringTokenizer tok = new StringTokenizer(cp, File.pathSeparator); while (tok.hasMoreTokens()) { @@ -723,7 +723,7 @@ public class WeavingAdaptor implements IMessageContext { public void flushMessages() { if (savedMessages == null) { - savedMessages = new ArrayList<IMessage>(); + savedMessages = new ArrayList<>(); savedMessages.addAll(super.getUnmodifiableListView()); clearMessages(); for (IMessage message : savedMessages) { @@ -794,7 +794,7 @@ public class WeavingAdaptor implements IMessageContext { @Override public List<IMessage> getUnmodifiableListView() { // System.err.println("? WeavingAdaptorMessageHolder.getUnmodifiableListView() savedMessages=" + savedMessages); - List<IMessage> allMessages = new ArrayList<IMessage>(); + List<IMessage> allMessages = new ArrayList<>(); allMessages.addAll(savedMessages); allMessages.addAll(super.getUnmodifiableListView()); return allMessages; @@ -803,7 +803,7 @@ public class WeavingAdaptor implements IMessageContext { protected class WeavingAdaptorMessageWriter extends MessageWriter { - private final Set<IMessage.Kind> ignoring = new HashSet<IMessage.Kind>(); + private final Set<IMessage.Kind> ignoring = new HashSet<>(); private final IMessage.Kind failKind; public WeavingAdaptorMessageWriter(PrintWriter writer) { @@ -859,7 +859,7 @@ public class WeavingAdaptor implements IMessageContext { private class WeavingClassFileProvider implements IClassFileProvider { private final UnwovenClassFile unwovenClass; - private final List<UnwovenClassFile> unwovenClasses = new ArrayList<UnwovenClassFile>(); + private final List<UnwovenClassFile> unwovenClasses = new ArrayList<>(); private IUnwovenClassFile wovenClass; private boolean isApplyAtAspectJMungersOnly = false; diff --git a/weaver/src/main/java/org/aspectj/weaver/tools/cache/AbstractIndexedFileCacheBacking.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/AbstractIndexedFileCacheBacking.java index 1580277b1..cb05b10e0 100644 --- a/weaver/src/main/java/org/aspectj/weaver/tools/cache/AbstractIndexedFileCacheBacking.java +++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/AbstractIndexedFileCacheBacking.java @@ -59,7 +59,7 @@ public abstract class AbstractIndexedFileCacheBacking extends AbstractFileCacheB return EMPTY_KEYS; } - Collection<String> matches=new LinkedList<String>(); + Collection<String> matches= new LinkedList<>(); synchronized(index) { for (String key : index.keySet()) { if (key.matches(regex)) { @@ -96,7 +96,7 @@ public abstract class AbstractIndexedFileCacheBacking extends AbstractFileCacheB protected abstract Map<String, IndexEntry> getIndex (); protected Map<String, IndexEntry> readIndex (File cacheDir, File cacheFile) { - Map<String, IndexEntry> indexMap=new TreeMap<String, IndexEntry>(); + Map<String, IndexEntry> indexMap= new TreeMap<>(); IndexEntry[] idxValues=readIndex(cacheFile); if (LangUtil.isEmpty(idxValues)) { if ((logger != null) && logger.isTraceEnabled()) { diff --git a/weaver/src/main/java/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBacking.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBacking.java index 636a82a7a..bc0b678f4 100644 --- a/weaver/src/main/java/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBacking.java +++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBacking.java @@ -50,7 +50,7 @@ import org.aspectj.weaver.tools.TraceFactory; * The actual persistence is implemented by the <U>concrete</U> classes */ public abstract class AsynchronousFileCacheBacking extends AbstractIndexedFileCacheBacking { - private static final BlockingQueue<AsyncCommand> commandsQ=new LinkedBlockingQueue<AsyncCommand>(); + private static final BlockingQueue<AsyncCommand> commandsQ= new LinkedBlockingQueue<>(); private static final ExecutorService execService=Executors.newSingleThreadExecutor(); private static Future<?> commandsRunner; @@ -180,7 +180,7 @@ public abstract class AsynchronousFileCacheBacking extends AbstractIndexedFileCa if (index.isEmpty()) { return Collections.emptyList(); } else { - return new ArrayList<IndexEntry>(index.values()); + return new ArrayList<>(index.values()); } } } diff --git a/weaver/src/main/java/org/aspectj/weaver/tools/cache/DefaultCacheKeyResolver.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/DefaultCacheKeyResolver.java index 44728d041..b9031cbae 100644 --- a/weaver/src/main/java/org/aspectj/weaver/tools/cache/DefaultCacheKeyResolver.java +++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/DefaultCacheKeyResolver.java @@ -49,7 +49,7 @@ public class DefaultCacheKeyResolver implements CacheKeyResolver { public String createClassLoaderScope(ClassLoader cl, List<String> aspects) { String name = cl != null ? cl.getClass().getSimpleName() : "unknown"; - List<String> hashableStrings = new LinkedList<String>(); + List<String> hashableStrings = new LinkedList<>(); StringBuilder hashable = new StringBuilder(256); // Add the list of loader urls to the hash list diff --git a/weaver/src/main/java/org/aspectj/weaver/tools/cache/FlatFileCacheBacking.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/FlatFileCacheBacking.java index 6de416a80..e5f45f92c 100644 --- a/weaver/src/main/java/org/aspectj/weaver/tools/cache/FlatFileCacheBacking.java +++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/FlatFileCacheBacking.java @@ -57,7 +57,7 @@ public class FlatFileCacheBacking extends AsynchronousFileCacheBacking { } protected Map<String, byte[]> readClassBytes (Map<String,IndexEntry> indexMap, File[] files) { - Map<String, byte[]> result=new TreeMap<String, byte[]>(); + Map<String, byte[]> result= new TreeMap<>(); if (LangUtil.isEmpty(files)) { return result; } diff --git a/weaver/src/main/java/org/aspectj/weaver/tools/cache/WeavedClassCache.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/WeavedClassCache.java index 8e18dadde..c5c079dcf 100644 --- a/weaver/src/main/java/org/aspectj/weaver/tools/cache/WeavedClassCache.java +++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/WeavedClassCache.java @@ -78,7 +78,7 @@ public class WeavedClassCache { private final CacheKeyResolver resolver; private final String name; - private static final List<WeavedClassCache> cacheRegistry = new LinkedList<WeavedClassCache>(); + private static final List<WeavedClassCache> cacheRegistry = new LinkedList<>(); protected WeavedClassCache(GeneratedClassHandler existingClassHandler, IMessageHandler messageHandler, @@ -259,7 +259,7 @@ public class WeavedClassCache { */ public static List<WeavedClassCache> getCaches() { synchronized (cacheRegistry) { - return new LinkedList<WeavedClassCache>(cacheRegistry); + return new LinkedList<>(cacheRegistry); } } diff --git a/weaver/src/main/java/org/aspectj/weaver/tools/cache/ZippedFileCacheBacking.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/ZippedFileCacheBacking.java index 6ee8b728c..fa7fba074 100644 --- a/weaver/src/main/java/org/aspectj/weaver/tools/cache/ZippedFileCacheBacking.java +++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/ZippedFileCacheBacking.java @@ -156,7 +156,7 @@ public class ZippedFileCacheBacking extends AsynchronousFileCacheBacking { e); } - entriesMap = new TreeMap<String,byte[]>(); + entriesMap = new TreeMap<>(); okEntries = false; } @@ -196,7 +196,7 @@ public class ZippedFileCacheBacking extends AsynchronousFileCacheBacking { } if (toDelete == null) { - toDelete = new TreeSet<String>(); + toDelete = new TreeSet<>(); } toDelete.add(key); } @@ -259,7 +259,7 @@ public class ZippedFileCacheBacking extends AsynchronousFileCacheBacking { return Collections.emptyMap(); } - Map<String,byte[]> result=new TreeMap<String,byte[]>(); + Map<String,byte[]> result= new TreeMap<>(); byte[] copyBuf=new byte[4096]; ByteArrayOutputStream out=new ByteArrayOutputStream(copyBuf.length); ZipFile zipFile=new ZipFile(file); diff --git a/weaver/src/test/java/org/aspectj/weaver/JoinPointSignatureIteratorTest.java b/weaver/src/test/java/org/aspectj/weaver/JoinPointSignatureIteratorTest.java index ad384fa49..c4d8efa80 100644 --- a/weaver/src/test/java/org/aspectj/weaver/JoinPointSignatureIteratorTest.java +++ b/weaver/src/test/java/org/aspectj/weaver/JoinPointSignatureIteratorTest.java @@ -78,29 +78,29 @@ public class JoinPointSignatureIteratorTest extends TestCase { public static Map<String, List<String>> expectedResults = new HashMap<>(); static { - List<String> sigs = new ArrayList<String>(); + List<String> sigs = new ArrayList<>(); sigs.add("java.lang.Object $Proxy1.get1(java.io.Serializable)"); sigs.add("java.lang.Object MessageService.get1(java.io.Serializable)"); sigs.add("java.lang.Object GenericService.get1(java.io.Serializable)"); sigs.add("java.lang.Object GenericService.get1(java.io.Serializable)"); expectedResults.put("java.lang.Object $Proxy1.get1(java.io.Serializable)", sigs); - sigs = new ArrayList<String>(); + sigs = new ArrayList<>(); sigs.add("java.lang.Object $Proxy1.get2(java.io.Serializable)"); sigs.add("java.lang.Object MessageService.get2(java.io.Serializable)"); sigs.add("java.lang.Object GenericService.get2(java.io.Serializable)"); sigs.add("java.lang.Object GenericService.get2(java.io.Serializable)"); expectedResults.put("java.lang.Object $Proxy1.get2(java.io.Serializable)", sigs); - sigs = new ArrayList<String>(); + sigs = new ArrayList<>(); sigs.add("java.lang.Object $Proxy1.get1(java.lang.Long)"); expectedResults.put("java.lang.Object $Proxy1.get1(java.lang.Long)", sigs); - sigs = new ArrayList<String>(); + sigs = new ArrayList<>(); sigs.add("java.lang.Object GenericService.get1(java.io.Serializable)"); expectedResults.put("java.lang.Object GenericService.get1(java.io.Serializable)", sigs); - sigs = new ArrayList<String>(); + sigs = new ArrayList<>(); sigs.add("java.lang.Object GenericService.get2(java.io.Serializable)"); expectedResults.put("java.lang.Object GenericService.get2(java.io.Serializable)", sigs); } diff --git a/weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java b/weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java index d4ed852d2..2c99ee29f 100644 --- a/weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java +++ b/weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java @@ -83,7 +83,7 @@ public class ReferenceTypeTestCase extends TestCase { public void testAssignable01() { List list = new ArrayList(); - List<String> listOfString = new ArrayList<String>(); + List<String> listOfString = new ArrayList<>(); List<?> listOfSomething = new ArrayList<Integer>(); List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>(); List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>(); @@ -192,7 +192,7 @@ public class ReferenceTypeTestCase extends TestCase { public void testAssignable02() { List list = new ArrayList(); ArrayList arraylist = null; - List<String> listOfString = new ArrayList<String>(); + List<String> listOfString = new ArrayList<>(); List<?> listOfSomething = new ArrayList<Integer>(); ArrayList<?> arrayListOfSomething = null; List<Number> listOfNumber = null; @@ -200,7 +200,7 @@ public class ReferenceTypeTestCase extends TestCase { ArrayList<? extends Number> arrayListOfSomethingNumberish = null; List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>(); List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>(); - List<Integer> listOfInteger = new ArrayList<Integer>(); + List<Integer> listOfInteger = new ArrayList<>(); ArrayList<String> arrayListOfString; ArrayList<Integer> arraylistOfInteger; // interfaces too List<? extends A,B> @@ -275,7 +275,7 @@ public class ReferenceTypeTestCase extends TestCase { public void testAssignable03_method_m2() { List list = new ArrayList(); ArrayList arraylist = null; - List<String> listOfString = new ArrayList<String>(); + List<String> listOfString = new ArrayList<>(); List<?> listOfSomething = new ArrayList<Integer>(); ArrayList<?> arrayListOfSomething = null; List<Number> listOfNumber = null; @@ -284,7 +284,7 @@ public class ReferenceTypeTestCase extends TestCase { ArrayList<? extends Number> arrayListOfSomethingNumberish = null; List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>(); List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>(); - List<Integer> listOfInteger = new ArrayList<Integer>(); + List<Integer> listOfInteger = new ArrayList<>(); ArrayList<String> arrayListOfString; ArrayList<Integer> arraylistOfInteger; // interfaces too List<? extends A,B> @@ -362,7 +362,7 @@ public class ReferenceTypeTestCase extends TestCase { public void testAssignable04_method_m3() { List list = new ArrayList(); ArrayList arraylist = null; - List<String> listOfString = new ArrayList<String>(); + List<String> listOfString = new ArrayList<>(); List<?> listOfSomething = new ArrayList<Integer>(); ArrayList<?> arrayListOfSomething = null; List<Number> listOfNumber = null; @@ -371,7 +371,7 @@ public class ReferenceTypeTestCase extends TestCase { ArrayList<? extends Number> arrayListOfSomethingNumberish = null; List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>(); List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>(); - List<Integer> listOfInteger = new ArrayList<Integer>(); + List<Integer> listOfInteger = new ArrayList<>(); ArrayList arrayList = null; ArrayList<String> arrayListOfString; ArrayList<Integer> arraylistOfInteger; @@ -478,7 +478,7 @@ public class ReferenceTypeTestCase extends TestCase { public void testAssignable03_method_m4() { List list = new ArrayList(); ArrayList arraylist = null; - List<String> listOfString = new ArrayList<String>(); + List<String> listOfString = new ArrayList<>(); List<?> listOfSomething = new ArrayList<Integer>(); ArrayList<?> arrayListOfSomething = null; List<Number> listOfNumber = null; @@ -486,7 +486,7 @@ public class ReferenceTypeTestCase extends TestCase { ArrayList<? extends Number> arrayListOfSomethingNumberish = null; List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>(); List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>(); - List<Integer> listOfInteger = new ArrayList<Integer>(); + List<Integer> listOfInteger = new ArrayList<>(); ArrayList<String> arrayListOfString; ArrayList<Integer> arraylistOfInteger; // interfaces too List<? extends A,B> @@ -564,7 +564,7 @@ public class ReferenceTypeTestCase extends TestCase { // copy of the real one in BcelClassWeaver public static class IfaceInitList implements PartialOrder.PartialComparable { final ResolvedType onType; - List<ConcreteTypeMunger> list = new ArrayList<ConcreteTypeMunger>(); + List<ConcreteTypeMunger> list = new ArrayList<>(); IfaceInitList(ResolvedType onType) { this.onType = onType; diff --git a/weaver/src/test/java/org/aspectj/weaver/WeaverMessagesTestCase.java b/weaver/src/test/java/org/aspectj/weaver/WeaverMessagesTestCase.java index eddcd146d..f8eaa4c9d 100644 --- a/weaver/src/test/java/org/aspectj/weaver/WeaverMessagesTestCase.java +++ b/weaver/src/test/java/org/aspectj/weaver/WeaverMessagesTestCase.java @@ -26,7 +26,7 @@ public class WeaverMessagesTestCase extends TestCase { Class<?> wmClass = WeaverMessages.class; Field[] fields = wmClass.getDeclaredFields(); - List<String> fieldList = new ArrayList<String>(); + List<String> fieldList = new ArrayList<>(); for (Field f : fields) { if (f.getType() == String.class) { try { diff --git a/weaver/src/test/java/org/aspectj/weaver/bcel/MegaZipTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/MegaZipTestCase.java index 4e24bb555..a5684db18 100644 --- a/weaver/src/test/java/org/aspectj/weaver/bcel/MegaZipTestCase.java +++ b/weaver/src/test/java/org/aspectj/weaver/bcel/MegaZipTestCase.java @@ -60,7 +60,7 @@ public class MegaZipTestCase extends WeaveTestCase { } public List<ShadowMunger> getShadowMungers() { - List<ShadowMunger> ret = new ArrayList<ShadowMunger>(); + List<ShadowMunger> ret = new ArrayList<>(); ret.add(makeConcreteAdvice("before" + "(): call(* *.println(..)) -> static void fluffy.Aspect.before_method_call()")); ret.add(makeConcreteAdvice("afterReturning" + "(): call(* *.println(..)) -> static void fluffy.Aspect.afterReturning_method_call()")); diff --git a/weaver/src/test/java/org/aspectj/weaver/bcel/WeaveTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/WeaveTestCase.java index 6e69e2c0f..f547d6afd 100644 --- a/weaver/src/test/java/org/aspectj/weaver/bcel/WeaveTestCase.java +++ b/weaver/src/test/java/org/aspectj/weaver/bcel/WeaveTestCase.java @@ -84,7 +84,7 @@ public abstract class WeaveTestCase extends TestCase { } public void weaveTest(String name, String outName, ShadowMunger planner) throws IOException { - List<ShadowMunger> l = new ArrayList<ShadowMunger>(1); + List<ShadowMunger> l = new ArrayList<>(1); l.add(planner); weaveTest(name, outName, l); } @@ -215,7 +215,7 @@ public abstract class WeaveTestCase extends TestCase { } public List<ShadowMunger> makeAdviceAll(String kind, boolean matchOnlyPrintln) { - List<ShadowMunger> ret = new ArrayList<ShadowMunger>(); + List<ShadowMunger> ret = new ArrayList<>(); if (matchOnlyPrintln) { ret.add(makeConcreteAdvice(kind + "(): call(* *.println(..)) -> static void Aspect.ajc_" + kind + "_method_execution()")); } else { diff --git a/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java b/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java index 8e84a71e5..eb5c50948 100644 --- a/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java +++ b/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java @@ -93,7 +93,7 @@ public class AnnotationPatternMatchingTestCase extends TestCase { } static class MyMessageHandler implements IMessageHandler { - public List<IMessage> messages = new ArrayList<IMessage>(); + public List<IMessage> messages = new ArrayList<>(); public boolean handleMessage(IMessage message) throws AbortException { messages.add(message); diff --git a/weaver/src/test/java/org/aspectj/weaver/tools/Java15PointcutExpressionTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/Java15PointcutExpressionTest.java index f65053f7e..5181efcf6 100644 --- a/weaver/src/test/java/org/aspectj/weaver/tools/Java15PointcutExpressionTest.java +++ b/weaver/src/test/java/org/aspectj/weaver/tools/Java15PointcutExpressionTest.java @@ -140,7 +140,7 @@ public class Java15PointcutExpressionTest extends TestCase { } - private static final Set<PointcutPrimitive> DEFAULT_SUPPORTED_PRIMITIVES = new HashSet<PointcutPrimitive>(); + private static final Set<PointcutPrimitive> DEFAULT_SUPPORTED_PRIMITIVES = new HashSet<>(); static { DEFAULT_SUPPORTED_PRIMITIVES.add(PointcutPrimitive.EXECUTION); @@ -286,7 +286,7 @@ public class Java15PointcutExpressionTest extends TestCase { tps[parameterNumber].getAnnotationPattern().toString(); // parameter type annotation checking - Set<String> expected = new HashSet<String>(); + Set<String> expected = new HashSet<>(); expected.addAll(mpnv.getParameterTypeAnnotations()); StringTokenizer st = new StringTokenizer(expectedParameterTypeAnnotations==null?"":expectedParameterTypeAnnotations); @@ -305,7 +305,7 @@ public class Java15PointcutExpressionTest extends TestCase { } // parameter annotation checking - expected = new HashSet<String>(); + expected = new HashSet<>(); expected.addAll(mpnv.getParameterAnnotations()); st = new StringTokenizer(expectedParameterAnnotations==null?"":expectedParameterAnnotations); @@ -327,8 +327,8 @@ public class Java15PointcutExpressionTest extends TestCase { static class MyPatternNodeVisitor extends AbstractPatternNodeVisitor { private StringBuffer stringRep = new StringBuffer(); - private List<String> parameterAnnotations = new ArrayList<String>(); - private List<String> parameterTypeAnnotations = new ArrayList<String>(); + private List<String> parameterAnnotations = new ArrayList<>(); + private List<String> parameterTypeAnnotations = new ArrayList<>(); public String getStringRepresentation() { return stringRep.toString(); } public List<String> getParameterAnnotations() { return parameterAnnotations; } diff --git a/weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java index fbf4d3068..46f841666 100644 --- a/weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java +++ b/weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java @@ -87,7 +87,7 @@ public class PointcutParserTest extends TestCase { .getPointcutParserSupportingSpecifiedPrimitivesAndUsingSpecifiedClassLoaderForResolution(p, this.getClass() .getClassLoader()); assertEquals("Should use the set we pass in", p, parser.getSupportedPrimitives()); - Set<PointcutPrimitive> q = new HashSet<PointcutPrimitive>(); + Set<PointcutPrimitive> q = new HashSet<>(); q.add(PointcutPrimitive.ARGS); parser = PointcutParser.getPointcutParserSupportingSpecifiedPrimitivesAndUsingSpecifiedClassLoaderForResolution(q, this .getClass().getClassLoader()); diff --git a/weaver/src/test/java/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBackingTestSupport.java b/weaver/src/test/java/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBackingTestSupport.java index 7d1b66407..a6445057b 100644 --- a/weaver/src/test/java/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBackingTestSupport.java +++ b/weaver/src/test/java/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBackingTestSupport.java @@ -137,7 +137,7 @@ public abstract class AsynchronousFileCacheBackingTestSupport return Collections.emptyMap(); } - Map<String, File> files=new TreeMap<String, File>(); + Map<String, File> files= new TreeMap<>(); for (IndexEntry entry : entries) { File file=createDataFile(entry); if (file != null) { diff --git a/weaver/src/test/java/org/aspectj/weaver/tools/cache/FlatFileCacheBackingTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/cache/FlatFileCacheBackingTest.java index 87daff796..3271a1ffa 100644 --- a/weaver/src/test/java/org/aspectj/weaver/tools/cache/FlatFileCacheBackingTest.java +++ b/weaver/src/test/java/org/aspectj/weaver/tools/cache/FlatFileCacheBackingTest.java @@ -74,7 +74,7 @@ public class FlatFileCacheBackingTest extends AsynchronousFileCacheBackingTestSu long newCrc = generateNewBytes(); assertTrue("Bad new CRC", newCrc != (-1L)); - Map<String, File> badFiles = new TreeMap<String, File>(); + Map<String, File> badFiles = new TreeMap<>(); for (IndexEntry entry : entries) { String key = entry.key; if (key.startsWith("badData")) { @@ -116,7 +116,7 @@ public class FlatFileCacheBackingTest extends AsynchronousFileCacheBackingTestSu File indexFile = getIndexFile(); writeIndex(indexFile, entries); - Map<String, File> dataFiles = new TreeMap<String, File>(); + Map<String, File> dataFiles = new TreeMap<>(); for (IndexEntry entry : entries) { String key = entry.key; if (key.startsWith("withData")) { diff --git a/weaver/src/test/java/org/aspectj/weaver/tools/cache/WeavedClassCacheTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/cache/WeavedClassCacheTest.java index a02400eb8..9d256d576 100644 --- a/weaver/src/test/java/org/aspectj/weaver/tools/cache/WeavedClassCacheTest.java +++ b/weaver/src/test/java/org/aspectj/weaver/tools/cache/WeavedClassCacheTest.java @@ -33,11 +33,11 @@ public class WeavedClassCacheTest extends AbstractCacheBackingTestSupport { } public class MemoryCacheBacking implements CacheBacking { - HashMap<String, CachedClassEntry> cache = new HashMap<String, CachedClassEntry>(); + HashMap<String, CachedClassEntry> cache = new HashMap<>(); public String[] getKeys(String regex) { Set<String> keys = cache.keySet(); - List<String> matches = new LinkedList<String>(); + List<String> matches = new LinkedList<>(); for (String key : keys) { if (key.matches(regex)) { matches.add(key); @@ -86,7 +86,7 @@ public class WeavedClassCacheTest extends AbstractCacheBackingTestSupport { public class TestGeneratedClassHandler implements GeneratedClassHandler { public int accepts = 0; - public List<String> classesISaw = new LinkedList<String>(); + public List<String> classesISaw = new LinkedList<>(); public void acceptClass (String name, byte[] originalBytes, byte[] wovenBytes) { accepts++; diff --git a/weaver/src/test/java/org/aspectj/weaver/tools/cache/ZippedFileCacheBackingTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/cache/ZippedFileCacheBackingTest.java index 4c41c1807..eee9aa32b 100644 --- a/weaver/src/test/java/org/aspectj/weaver/tools/cache/ZippedFileCacheBackingTest.java +++ b/weaver/src/test/java/org/aspectj/weaver/tools/cache/ZippedFileCacheBackingTest.java @@ -40,7 +40,7 @@ public class ZippedFileCacheBackingTest extends AsynchronousFileCacheBackingTest File indexFile=getIndexFile(); writeIndex(indexFile, entries); - Map<String,byte[]> entriesMap=new TreeMap<String,byte[]>(); + Map<String,byte[]> entriesMap= new TreeMap<>(); for (IndexEntry ie : entries) { if (ie.ignored) { continue; @@ -73,7 +73,7 @@ public class ZippedFileCacheBackingTest extends AsynchronousFileCacheBackingTest } public void testReadWriteZipClassBytes () throws IOException { - Map<String,byte[]> entriesMap=new TreeMap<String,byte[]>(); + Map<String,byte[]> entriesMap= new TreeMap<>(); for (int index=0; index < Byte.SIZE; index++) { String name="classBytes#" + index; random.nextBytes(bytes); @@ -104,7 +104,7 @@ public class ZippedFileCacheBackingTest extends AsynchronousFileCacheBackingTest long newCrc=generateNewBytes(); assertTrue("Bad new CRC", newCrc != (-1L)); - Map<String,byte[]> entriesMap=new TreeMap<String,byte[]>(); + Map<String,byte[]> entriesMap= new TreeMap<>(); for (IndexEntry ie : entries) { if (ie.ignored) { continue; |