diff options
author | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-13 01:01:58 +0200 |
---|---|---|
committer | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-13 01:01:58 +0200 |
commit | e1bff9a5703baf17ec650b173bdfe776bf87125f (patch) | |
tree | 8b4443759c231a6c46cb70c755fe554a4b621e11 /org.aspectj.matcher | |
parent | b6eee2e1052116aa22ebbd3c2baf05c2b709bee5 (diff) | |
download | aspectj-e1bff9a5703baf17ec650b173bdfe776bf87125f.tar.gz aspectj-e1bff9a5703baf17ec650b173bdfe776bf87125f.zip |
Use the diamond operator where possible
Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
Diffstat (limited to 'org.aspectj.matcher')
51 files changed, 197 insertions, 197 deletions
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java index ce3b6aa60..2d969c2f8 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java @@ -112,7 +112,7 @@ public abstract class AbstractReferenceTypeDelegate implements ReferenceTypeDele } protected GenericSignature.FormalTypeParameter[] getFormalTypeParametersFromOuterClass() { - List<GenericSignature.FormalTypeParameter> typeParameters = new ArrayList<GenericSignature.FormalTypeParameter>(); + List<GenericSignature.FormalTypeParameter> typeParameters = new ArrayList<>(); ResolvedType outerClassType = getOuterClass(); if (!(outerClassType instanceof ReferenceType)) { if (outerClassType == null) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembers.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembers.java index b6ddd2e6e..c3f22b0b1 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembers.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembers.java @@ -50,21 +50,21 @@ public class CrosscuttingMembers { private PerClause perClause; - private List<ShadowMunger> shadowMungers = new ArrayList<ShadowMunger>(4); - private List<ConcreteTypeMunger> typeMungers = new ArrayList<ConcreteTypeMunger>(4); - private List<ConcreteTypeMunger> lateTypeMungers = new ArrayList<ConcreteTypeMunger>(0); + private List<ShadowMunger> shadowMungers = new ArrayList<>(4); + private List<ConcreteTypeMunger> typeMungers = new ArrayList<>(4); + private List<ConcreteTypeMunger> lateTypeMungers = new ArrayList<>(0); - private Set<DeclareParents> declareParents = new HashSet<DeclareParents>(); - private Set<DeclareSoft> declareSofts = new HashSet<DeclareSoft>(); - private List<Declare> declareDominates = new ArrayList<Declare>(4); + private Set<DeclareParents> declareParents = new HashSet<>(); + private Set<DeclareSoft> declareSofts = new HashSet<>(); + private List<Declare> declareDominates = new ArrayList<>(4); // These are like declare parents type mungers - private Set<DeclareAnnotation> declareAnnotationsOnType = new LinkedHashSet<DeclareAnnotation>(); - private Set<DeclareAnnotation> declareAnnotationsOnField = new LinkedHashSet<DeclareAnnotation>(); - private Set<DeclareAnnotation> declareAnnotationsOnMethods = new LinkedHashSet<DeclareAnnotation>(); + private Set<DeclareAnnotation> declareAnnotationsOnType = new LinkedHashSet<>(); + private Set<DeclareAnnotation> declareAnnotationsOnField = new LinkedHashSet<>(); + private Set<DeclareAnnotation> declareAnnotationsOnMethods = new LinkedHashSet<>(); // declareAnnotationsOnMethods includes constructors too - private Set<DeclareTypeErrorOrWarning> declareTypeEow = new HashSet<DeclareTypeErrorOrWarning>(); + private Set<DeclareTypeErrorOrWarning> declareTypeEow = new HashSet<>(); private boolean shouldConcretizeIfNeeded = true; @@ -74,8 +74,8 @@ public class CrosscuttingMembers { this.shouldConcretizeIfNeeded = shouldConcretizeIfNeeded; } - private final Hashtable<String, Object> cflowFields = new Hashtable<String, Object>(); - private final Hashtable<String, Object> cflowBelowFields = new Hashtable<String, Object>(); + private final Hashtable<String, Object> cflowFields = new Hashtable<>(); + private final Hashtable<String, Object> cflowBelowFields = new Hashtable<>(); // public void addConcreteShadowMungers(Collection c) { // shadowMungers.addAll(c); @@ -237,7 +237,7 @@ public class CrosscuttingMembers { } public Collection<ShadowMunger> getCflowEntries() { - List<ShadowMunger> ret = new ArrayList<ShadowMunger>(); + List<ShadowMunger> ret = new ArrayList<>(); for (ShadowMunger m : shadowMungers) { if (m instanceof Advice) { Advice a = (Advice) m; @@ -276,8 +276,8 @@ public class CrosscuttingMembers { if (careAboutShadowMungers) { // bug 129163: use set equality rather than list equality - Set<ShadowMunger> theseShadowMungers = new HashSet<ShadowMunger>(); - Set<ShadowMunger> theseInlinedAroundMungers = new HashSet<ShadowMunger>(); + Set<ShadowMunger> theseShadowMungers = new HashSet<>(); + Set<ShadowMunger> theseInlinedAroundMungers = new HashSet<>(); for (ShadowMunger munger : shadowMungers) { if (munger instanceof Advice) { Advice adviceMunger = (Advice) munger; @@ -293,10 +293,10 @@ public class CrosscuttingMembers { theseShadowMungers.add(munger); } } - Set<ShadowMunger> tempSet = new HashSet<ShadowMunger>(); + Set<ShadowMunger> tempSet = new HashSet<>(); tempSet.addAll(other.shadowMungers); - Set<ShadowMunger> otherShadowMungers = new HashSet<ShadowMunger>(); - Set<ShadowMunger> otherInlinedAroundMungers = new HashSet<ShadowMunger>(); + Set<ShadowMunger> otherShadowMungers = new HashSet<>(); + Set<ShadowMunger> otherInlinedAroundMungers = new HashSet<>(); for (ShadowMunger munger : tempSet) { if (munger instanceof Advice) { Advice adviceMunger = (Advice) munger; @@ -341,8 +341,8 @@ public class CrosscuttingMembers { // if we dont care about shadow mungers then ignore those // typeMungers which are created to help with the implementation // of shadowMungers - Set<Object> theseTypeMungers = new HashSet<Object>(); - Set<Object> otherTypeMungers = new HashSet<Object>(); + Set<Object> theseTypeMungers = new HashSet<>(); + Set<Object> otherTypeMungers = new HashSet<>(); if (!careAboutShadowMungers) { for (Object o : typeMungers) { if (o instanceof ConcreteTypeMunger) { @@ -431,13 +431,13 @@ public class CrosscuttingMembers { // the up front comparison if (!careAboutShadowMungers) { // this means we are in front end compilation and if the differences are purely mixin parents, we can continue OK - Set<DeclareParents> trimmedThis = new HashSet<DeclareParents>(); + Set<DeclareParents> trimmedThis = new HashSet<>(); for (DeclareParents decp : declareParents) { if (!decp.isMixin()) { trimmedThis.add(decp); } } - Set<DeclareParents> trimmedOther = new HashSet<DeclareParents>(); + Set<DeclareParents> trimmedOther = new HashSet<>(); for (DeclareParents decp : other.declareParents) { if (!decp.isMixin()) { trimmedOther.add(decp); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembersSet.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembersSet.java index a3d97ea89..79f96e8fa 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembersSet.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/CrosscuttingMembersSet.java @@ -43,7 +43,7 @@ public class CrosscuttingMembersSet { private transient World world; // FIXME AV - ? we may need a sequencedHashMap there to ensure source based precedence for @AJ advice - private final Map<ResolvedType, CrosscuttingMembers> members = new HashMap<ResolvedType, CrosscuttingMembers>(); + private final Map<ResolvedType, CrosscuttingMembers> members = new HashMap<>(); // List of things to be verified once the type system is 'complete' private transient List<IVerificationRequired> verificationList = null; @@ -139,7 +139,7 @@ public class CrosscuttingMembersSet { private boolean addOrReplaceDescendantsOf(ResolvedType aspectType, boolean inWeavePhase) { // System.err.println("Looking at descendants of "+aspectType.getName()); Set<ResolvedType> knownAspects = members.keySet(); - Set<ResolvedType> toBeReplaced = new HashSet<ResolvedType>(); + Set<ResolvedType> toBeReplaced = new HashSet<>(); for (ResolvedType candidateDescendant : knownAspects) { // allowMissing = true - if something is missing, it really probably is not a descendant if ((candidateDescendant != aspectType) && (aspectType.isAssignableFrom(candidateDescendant, true))) { @@ -192,7 +192,7 @@ public class CrosscuttingMembersSet { public List<ShadowMunger> getShadowMungers() { if (shadowMungers == null) { - List<ShadowMunger> ret = new ArrayList<ShadowMunger>(); + List<ShadowMunger> ret = new ArrayList<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getShadowMungers()); } @@ -203,7 +203,7 @@ public class CrosscuttingMembersSet { public List<ConcreteTypeMunger> getTypeMungers() { if (typeMungers == null) { - List<ConcreteTypeMunger> ret = new ArrayList<ConcreteTypeMunger>(); + List<ConcreteTypeMunger> ret = new ArrayList<>(); for (CrosscuttingMembers xmembers : members.values()) { // With 1.6.9 there is a change that enables use of more optimal accessors (accessors for private fields). // Here is where we determine if two aspects are asking for access to the same field. If they are @@ -252,7 +252,7 @@ public class CrosscuttingMembersSet { for (ConcreteTypeMunger typeMunger : typeMungers) { if (typeMunger.getMunger() != null && typeMunger.getMunger().getKind() == kind) { if (collected == null) { - collected = new ArrayList<ConcreteTypeMunger>(); + collected = new ArrayList<>(); } collected.add(typeMunger); } @@ -280,7 +280,7 @@ public class CrosscuttingMembersSet { public List<ConcreteTypeMunger> getLateTypeMungers() { if (lateTypeMungers == null) { - List<ConcreteTypeMunger> ret = new ArrayList<ConcreteTypeMunger>(); + List<ConcreteTypeMunger> ret = new ArrayList<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getLateTypeMungers()); } @@ -291,11 +291,11 @@ public class CrosscuttingMembersSet { public List<DeclareSoft> getDeclareSofts() { if (declareSofts == null) { - Set<DeclareSoft> ret = new HashSet<DeclareSoft>(); + Set<DeclareSoft> ret = new HashSet<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getDeclareSofts()); } - declareSofts = new ArrayList<DeclareSoft>(); + declareSofts = new ArrayList<>(); declareSofts.addAll(ret); } return declareSofts; @@ -303,11 +303,11 @@ public class CrosscuttingMembersSet { public List<DeclareParents> getDeclareParents() { if (declareParents == null) { - Set<DeclareParents> ret = new HashSet<DeclareParents>(); + Set<DeclareParents> ret = new HashSet<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getDeclareParents()); } - declareParents = new ArrayList<DeclareParents>(); + declareParents = new ArrayList<>(); declareParents.addAll(ret); } return declareParents; @@ -318,11 +318,11 @@ public class CrosscuttingMembersSet { */ public List<DeclareAnnotation> getDeclareAnnotationOnTypes() { if (declareAnnotationOnTypes == null) { - Set<DeclareAnnotation> ret = new LinkedHashSet<DeclareAnnotation>(); + Set<DeclareAnnotation> ret = new LinkedHashSet<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getDeclareAnnotationOnTypes()); } - declareAnnotationOnTypes = new ArrayList<DeclareAnnotation>(); + declareAnnotationOnTypes = new ArrayList<>(); declareAnnotationOnTypes.addAll(ret); } return declareAnnotationOnTypes; @@ -333,11 +333,11 @@ public class CrosscuttingMembersSet { */ public List<DeclareAnnotation> getDeclareAnnotationOnFields() { if (declareAnnotationOnFields == null) { - Set<DeclareAnnotation> ret = new LinkedHashSet<DeclareAnnotation>(); + Set<DeclareAnnotation> ret = new LinkedHashSet<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getDeclareAnnotationOnFields()); } - declareAnnotationOnFields = new ArrayList<DeclareAnnotation>(); + declareAnnotationOnFields = new ArrayList<>(); declareAnnotationOnFields.addAll(ret); } return declareAnnotationOnFields; @@ -348,11 +348,11 @@ public class CrosscuttingMembersSet { */ public List<DeclareAnnotation> getDeclareAnnotationOnMethods() { if (declareAnnotationOnMethods == null) { - Set<DeclareAnnotation> ret = new LinkedHashSet<DeclareAnnotation>(); + Set<DeclareAnnotation> ret = new LinkedHashSet<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getDeclareAnnotationOnMethods()); } - declareAnnotationOnMethods = new ArrayList<DeclareAnnotation>(); + declareAnnotationOnMethods = new ArrayList<>(); declareAnnotationOnMethods.addAll(ret); // world.sortDeclareAnnotations(declareAnnotationOnMethods); } @@ -364,11 +364,11 @@ public class CrosscuttingMembersSet { */ public List<DeclareTypeErrorOrWarning> getDeclareTypeEows() { if (declareTypeEows == null) { - Set<DeclareTypeErrorOrWarning> ret = new HashSet<DeclareTypeErrorOrWarning>(); + Set<DeclareTypeErrorOrWarning> ret = new HashSet<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getDeclareTypeErrorOrWarning()); } - declareTypeEows = new ArrayList<DeclareTypeErrorOrWarning>(); + declareTypeEows = new ArrayList<>(); declareTypeEows.addAll(ret); } return declareTypeEows; @@ -376,7 +376,7 @@ public class CrosscuttingMembersSet { public List<Declare> getDeclareDominates() { if (declareDominates == null) { - List<Declare> ret = new ArrayList<Declare>(); + List<Declare> ret = new ArrayList<>(); for (CrosscuttingMembers crosscuttingMembers : members.values()) { ret.addAll(crosscuttingMembers.getDeclareDominates()); } @@ -412,7 +412,7 @@ public class CrosscuttingMembersSet { */ public void recordNecessaryCheck(IVerificationRequired verification) { if (verificationList == null) { - verificationList = new ArrayList<IVerificationRequired>(); + verificationList = new ArrayList<>(); } verificationList.add(verification); } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/IntMap.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/IntMap.java index c0af738ba..fb86ee4f0 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/IntMap.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/IntMap.java @@ -24,7 +24,7 @@ public class IntMap { // XXX begin hack to avoid a signature refactoring in Pointcut private ResolvedType concreteAspect; private ShadowMunger enclosingAdvice; - private List<ResolvedPointcutDefinition> enclosingDefinition = new ArrayList<ResolvedPointcutDefinition>(); + private List<ResolvedPointcutDefinition> enclosingDefinition = new ArrayList<>(); public void pushEnclosingDefinition(ResolvedPointcutDefinition def) { enclosingDefinition.add(def); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Iterators.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Iterators.java index 1a2e82006..576ef9e34 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Iterators.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Iterators.java @@ -46,7 +46,7 @@ public final class Iterators { */ public static <T> Filter<T> dupFilter() { return new Filter<T>() { - final Set<T> seen = new HashSet<T>(); // should have weak ptrs? + final Set<T> seen = new HashSet<>(); // should have weak ptrs? public Iterator<T> filter(final Iterator<T> in) { return new Iterator<T>() { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/JoinPointSignatureIterator.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/JoinPointSignatureIterator.java index 50332c1c0..639e4a080 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/JoinPointSignatureIterator.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/JoinPointSignatureIterator.java @@ -31,12 +31,12 @@ public class JoinPointSignatureIterator implements Iterator<JoinPointSignature> private Member signaturesOfMember; private ResolvedMember firstDefiningMember; private World world; - private List<JoinPointSignature> discoveredSignatures = new ArrayList<JoinPointSignature>(); + private List<JoinPointSignature> discoveredSignatures = new ArrayList<>(); private List<JoinPointSignature> additionalSignatures = Collections.emptyList(); private Iterator<JoinPointSignature> discoveredSignaturesIterator = null; private Iterator<ResolvedType> superTypeIterator = null; private boolean isProxy = false; - private Set<ResolvedType> visitedSuperTypes = new HashSet<ResolvedType>(); + private Set<ResolvedType> visitedSuperTypes = new HashSet<>(); private List<SearchPair> yetToBeProcessedSuperMembers = null; private boolean iteratingOverDiscoveredSignatures = true; @@ -131,7 +131,7 @@ public class JoinPointSignatureIterator implements Iterator<JoinPointSignature> // a common case discoveredSignatures.add(new JoinPointSignature(firstDefiningMember, originalDeclaringType)); } else { - List<ResolvedType> declaringTypes = new ArrayList<ResolvedType>(); + List<ResolvedType> declaringTypes = new ArrayList<>(); accumulateTypesInBetween(originalDeclaringType, firstDefiningType, declaringTypes); for (ResolvedType declaringType : declaringTypes) { discoveredSignatures.add(new JoinPointSignature(firstDefiningMember, declaringType)); @@ -192,7 +192,7 @@ public class JoinPointSignatureIterator implements Iterator<JoinPointSignature> ResolvedMemberImpl foundMember = (ResolvedMemberImpl) superType.lookupResolvedMember(firstDefiningMember, true, isProxy); if (foundMember != null && isVisibleTo(firstDefiningMember, foundMember)) { - List<ResolvedType> declaringTypes = new ArrayList<ResolvedType>(); + List<ResolvedType> declaringTypes = new ArrayList<>(); // declaring type can be unresolved if the member can from an ITD... ResolvedType resolvedDeclaringType = foundMember.getDeclaringType().resolve(world); accumulateTypesInBetween(superType, resolvedDeclaringType, declaringTypes); @@ -206,7 +206,7 @@ public class JoinPointSignatureIterator implements Iterator<JoinPointSignature> member = new JoinPointSignature(foundMember, declaringType); discoveredSignatures.add(member); // for next time we are reset if (additionalSignatures == Collections.EMPTY_LIST) { - additionalSignatures = new ArrayList<JoinPointSignature>(); + additionalSignatures = new ArrayList<>(); } additionalSignatures.add(member); // for this time } @@ -216,12 +216,12 @@ public class JoinPointSignatureIterator implements Iterator<JoinPointSignature> foundMember.declaringType.resolve(world)); discoveredSignatures.add(member); // for next time we are reset if (additionalSignatures == Collections.EMPTY_LIST) { - additionalSignatures = new ArrayList<JoinPointSignature>(); + additionalSignatures = new ArrayList<>(); } additionalSignatures.add(member); // for this time } if (yetToBeProcessedSuperMembers == null) { - yetToBeProcessedSuperMembers = new ArrayList<SearchPair>(); + yetToBeProcessedSuperMembers = new ArrayList<>(); } yetToBeProcessedSuperMembers.add(new SearchPair(foundMember, superType)); return true; diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Lint.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Lint.java index 7307ab93c..216186b26 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Lint.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Lint.java @@ -30,7 +30,7 @@ import org.aspectj.weaver.tools.Trace; import org.aspectj.weaver.tools.TraceFactory; public class Lint { - Map<String, Lint.Kind> kinds = new HashMap<String, Lint.Kind>(); + Map<String, Lint.Kind> kinds = new HashMap<>(); /* private */World world; public final Kind invalidAbsoluteTypeName = new Kind("invalidAbsoluteTypeName", "no match for this type name: {0}"); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MemberImpl.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MemberImpl.java index 9e608c9ad..86caa48c5 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MemberImpl.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MemberImpl.java @@ -155,7 +155,7 @@ public class MemberImpl implements Member { private static Object[] signatureToTypes(String sig) { boolean hasParameters = sig.charAt(1) != ')'; if (hasParameters) { - List<UnresolvedType> l = new ArrayList<UnresolvedType>(); + List<UnresolvedType> l = new ArrayList<>(); int i = 1; boolean hasAnyAnglies = sig.indexOf('<') != -1; while (true) { @@ -442,7 +442,7 @@ public class MemberImpl implements Member { public Collection<ResolvedType> getDeclaringTypes(World world) { ResolvedType myType = getDeclaringType().resolve(world); - Collection<ResolvedType> ret = new HashSet<ResolvedType>(); + Collection<ResolvedType> ret = new HashSet<>(); if (kind == CONSTRUCTOR) { // this is wrong if the member doesn't exist, but that doesn't // matter diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ReferenceType.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ReferenceType.java index aad9a1dbe..c40bf9f43 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ReferenceType.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ReferenceType.java @@ -42,7 +42,7 @@ public class ReferenceType extends ResolvedType { * swapped during incremental compilation, the delegate of the derivatives * is swapped also. */ - private final List<WeakReference<ReferenceType>> derivativeTypes = new ArrayList<WeakReference<ReferenceType>>(); + private final List<WeakReference<ReferenceType>> derivativeTypes = new ArrayList<>(); /** * For parameterized types (or the raw type) - this field points to the @@ -62,7 +62,7 @@ public class ReferenceType extends ResolvedType { ResolvedMember[] parameterizedMethods = null; ResolvedMember[] parameterizedFields = null; ResolvedMember[] parameterizedPointcuts = null; - WeakReference<ResolvedType[]> parameterizedInterfaces = new WeakReference<ResolvedType[]>( + WeakReference<ResolvedType[]> parameterizedInterfaces = new WeakReference<>( null); Collection<Declare> parameterizedDeclares = null; // Collection parameterizedTypeMungers = null; @@ -116,13 +116,13 @@ public class ReferenceType extends ResolvedType { // checkDuplicates(dependent); synchronized (derivativeTypes) { this.derivativeTypes - .add(new WeakReference<ReferenceType>(dependent)); + .add(new WeakReference<>(dependent)); } } public void checkDuplicates(ReferenceType newRt) { synchronized (derivativeTypes) { - List<WeakReference<ReferenceType>> forRemoval = new ArrayList<WeakReference<ReferenceType>>(); + List<WeakReference<ReferenceType>> forRemoval = new ArrayList<>(); for (WeakReference<ReferenceType> derivativeTypeReference : derivativeTypes) { ReferenceType derivativeType = derivativeTypeReference.get(); if (derivativeType == null) { @@ -756,7 +756,7 @@ public class ReferenceType extends ResolvedType { interfaces[i] = delegateInterfaces[i]; } } - parameterizedInterfaces = new WeakReference<ResolvedType[]>( + parameterizedInterfaces = new WeakReference<>( interfaces); return interfaces; } else if (isRawType()) { @@ -778,12 +778,12 @@ public class ReferenceType extends ResolvedType { .parameterizedWith(toUseForParameterization); } } - parameterizedInterfaces = new WeakReference<ResolvedType[]>( + parameterizedInterfaces = new WeakReference<>( interfaces); return interfaces; } if (getDelegate().isCacheable()) { - parameterizedInterfaces = new WeakReference<ResolvedType[]>( + parameterizedInterfaces = new WeakReference<>( delegateInterfaces); } return delegateInterfaces; @@ -937,7 +937,7 @@ public class ReferenceType extends ResolvedType { Collection<Declare> declares = null; if (ajMembersNeedParameterization()) { Collection<Declare> genericDeclares = getDelegate().getDeclares(); - parameterizedDeclares = new ArrayList<Declare>(); + parameterizedDeclares = new ArrayList<>(); Map<String, UnresolvedType> parameterizationMap = getAjMemberParameterizationMap(); for (Declare declareStatement : genericDeclares) { parameterizedDeclares.add(declareStatement.parameterizeWith( @@ -968,7 +968,7 @@ public class ReferenceType extends ResolvedType { return getDelegate().getModifiers(); } - WeakReference<ResolvedType> superclassReference = new WeakReference<ResolvedType>( + WeakReference<ResolvedType> superclassReference = new WeakReference<>( null); @Override @@ -984,7 +984,7 @@ public class ReferenceType extends ResolvedType { getMemberParameterizationMap()).resolve(getWorld()); } if (getDelegate().isCacheable()) { - superclassReference = new WeakReference<ResolvedType>(ret); + superclassReference = new WeakReference<>(ret); } return newSuperclass; } @@ -999,7 +999,7 @@ public class ReferenceType extends ResolvedType { getWorld()); } if (getDelegate().isCacheable()) { - superclassReference = new WeakReference<ResolvedType>(ret); + superclassReference = new WeakReference<>(ret); } return ret; } @@ -1019,7 +1019,7 @@ public class ReferenceType extends ResolvedType { } this.delegate = delegate; synchronized (derivativeTypes) { - List<WeakReference<ReferenceType>> forRemoval = new ArrayList<WeakReference<ReferenceType>>(); + List<WeakReference<ReferenceType>> forRemoval = new ArrayList<>(); for (WeakReference<ReferenceType> derivativeRef : derivativeTypes) { ReferenceType derivative = derivativeRef.get(); if (derivative != null) { @@ -1048,7 +1048,7 @@ public class ReferenceType extends ResolvedType { parameterizedInterfaces.clear(); parameterizedMethods = null; parameterizedPointcuts = null; - superclassReference = new WeakReference<ResolvedType>(null); + superclassReference = new WeakReference<>(null); } public int getEndPos() { @@ -1171,7 +1171,7 @@ public class ReferenceType extends ResolvedType { newInterfaces = null; typeVariables = null; parameterizedInterfaces.clear(); - superclassReference = new WeakReference<ResolvedType>(null); + superclassReference = new WeakReference<>(null); if (getDelegate() != null) { delegate.ensureConsistent(); } @@ -1192,7 +1192,7 @@ public class ReferenceType extends ResolvedType { } if (newParent.isClass()) { newSuperclass = newParent; - superclassReference = new WeakReference<ResolvedType>(null); + superclassReference = new WeakReference<>(null); } else { if (newInterfaces == null) { newInterfaces = new ResolvedType[1]; @@ -1253,7 +1253,7 @@ public class ReferenceType extends ResolvedType { */ public ReferenceType findDerivativeType(ResolvedType[] typeParameters) { synchronized (derivativeTypes) { - List<WeakReference<ReferenceType>> forRemoval = new ArrayList<WeakReference<ReferenceType>>(); + List<WeakReference<ReferenceType>> forRemoval = new ArrayList<>(); for (WeakReference<ReferenceType> derivativeTypeRef : derivativeTypes) { ReferenceType derivativeType = derivativeTypeRef.get(); if (derivativeType == null) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedMemberImpl.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedMemberImpl.java index bb609f104..6a12cdd11 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedMemberImpl.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedMemberImpl.java @@ -123,9 +123,9 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Reso // } } - List<ResolvedType> declaringTypes = new ArrayList<ResolvedType>(); + List<ResolvedType> declaringTypes = new ArrayList<>(); accumulateTypesInBetween(originalDeclaringType, firstDefiningType, declaringTypes); - Set<ResolvedMember> memberSignatures = new LinkedHashSet<ResolvedMember>(); + Set<ResolvedMember> memberSignatures = new LinkedHashSet<>(); for (ResolvedType declaringType : declaringTypes) { memberSignatures.add(new JoinPointSignature(firstDefiningMember, declaringType)); } @@ -136,7 +136,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Reso // every type between the firstDefiningMember and the root defining // member. Iterator<ResolvedType> superTypeIterator = firstDefiningType.getDirectSupertypes(); - List<ResolvedType> typesAlreadyVisited = new ArrayList<ResolvedType>(); + List<ResolvedType> typesAlreadyVisited = new ArrayList<>(); accumulateMembersMatching(firstDefiningMember, superTypeIterator, typesAlreadyVisited, memberSignatures, false); } @@ -188,7 +188,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Reso ResolvedMemberImpl foundMember = (ResolvedMemberImpl) toLookIn.lookupResolvedMember(memberToMatch, true, ignoreGenerics); if (foundMember != null && isVisibleTo(memberToMatch, foundMember)) { - List<ResolvedType> declaringTypes = new ArrayList<ResolvedType>(); + List<ResolvedType> declaringTypes = new ArrayList<>(); // declaring type can be unresolved if the member can from // an ITD... ResolvedType resolvedDeclaringType = foundMember.getDeclaringType().resolve(toLookIn.getWorld()); @@ -763,7 +763,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Reso if (isParameterized && (typeVariables.length != typeParameters.length)) { throw new IllegalStateException("Wrong number of type parameters supplied"); } - Map<String, UnresolvedType> typeMap = new HashMap<String, UnresolvedType>(); + Map<String, UnresolvedType> typeMap = new HashMap<>(); boolean typeParametersSupplied = typeParameters != null && typeParameters.length > 0; if (typeVariables != null) { // If no 'replacements' were supplied in the typeParameters array @@ -1058,7 +1058,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Reso StringBuffer sig = new StringBuffer(); UnresolvedType[] myParameterTypes = getGenericParameterTypes(); for (UnresolvedType myParameterType : myParameterTypes) { - appendSigWithTypeVarBoundsRemoved(myParameterType, sig, new HashSet<UnresolvedType>()); + appendSigWithTypeVarBoundsRemoved(myParameterType, sig, new HashSet<>()); } myParameterSignatureWithBoundsRemoved = sig.toString(); return myParameterSignatureWithBoundsRemoved; diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedType.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedType.java index 8e48b02d4..3d88279af 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedType.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedType.java @@ -156,7 +156,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl // This set contains pairs of types whose signatures are concatenated // together, this means with a fast lookup we can tell if two types // are equivalent. - protected static Set<String> validBoxing = new HashSet<String>(); + protected static Set<String> validBoxing = new HashSet<>(); static { validBoxing.add("Ljava/lang/Byte;B"); @@ -327,7 +327,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl public Iterator<ResolvedType> getHierarchy(final boolean wantGenerics, final boolean wantDeclaredParents) { final Iterators.Getter<ResolvedType, ResolvedType> interfaceGetter = new Iterators.Getter<ResolvedType, ResolvedType>() { - List<String> alreadySeen = new ArrayList<String>(); // Strings are signatures (ResolvedType.getSignature()) + List<String> alreadySeen = new ArrayList<>(); // Strings are signatures (ResolvedType.getSignature()) @Override public Iterator<ResolvedType> get(ResolvedType type) { @@ -337,7 +337,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl // relatively expensive but hopefully uncommon if (!wantDeclaredParents && type.hasNewParentMungers()) { // Throw away interfaces from that array if they were decp'd onto here - List<Integer> forRemoval = new ArrayList<Integer>(); + List<Integer> forRemoval = new ArrayList<>(); for (ConcreteTypeMunger munger : type.interTypeMungers) { if (munger.getMunger() != null) { ResolvedTypeMunger m = munger.getMunger(); @@ -391,8 +391,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl * declared on the superinterfaces. This is expensive - use the getMethods() method if you can! */ public List<ResolvedMember> getMethodsWithoutIterator(boolean includeITDs, boolean allowMissing, boolean genericsAware) { - List<ResolvedMember> methods = new ArrayList<ResolvedMember>(); - Set<String> knowninterfaces = new HashSet<String>(); + List<ResolvedMember> methods = new ArrayList<>(); + Set<String> knowninterfaces = new HashSet<>(); addAndRecurse(knowninterfaces, methods, this, includeITDs, allowMissing, genericsAware); return methods; } @@ -405,8 +405,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl * @return list of resolvedtypes in this types hierarchy, including this type first */ public List<ResolvedType> getHierarchyWithoutIterator(boolean includeITDs, boolean allowMissing, boolean genericsAware) { - List<ResolvedType> types = new ArrayList<ResolvedType>(); - Set<String> visited = new HashSet<String>(); + List<ResolvedType> types = new ArrayList<>(); + Set<String> visited = new HashSet<>(); recurseHierarchy(visited, types, this, includeITDs, allowMissing, genericsAware); return types; } @@ -554,7 +554,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl * process interfaces multiple times. */ public ResolvedMember lookupMethod(Member m) { - List<ResolvedType> typesTolookat = new ArrayList<ResolvedType>(); + List<ResolvedType> typesTolookat = new ArrayList<>(); typesTolookat.add(this); int pos = 0; while (pos < typesTolookat.size()) { @@ -807,7 +807,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl return Collections.emptyList(); } - List<Declare> ret = new ArrayList<Declare>(); + List<Declare> ret = new ArrayList<>(); // if (this.isAbstract()) { // for (Iterator i = getDeclares().iterator(); i.hasNext();) { // Declare dec = (Declare) i.next(); @@ -850,7 +850,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl return Collections.emptyList(); } - List<ShadowMunger> acc = new ArrayList<ShadowMunger>(); + List<ShadowMunger> acc = new ArrayList<>(); final Iterators.Filter<ResolvedType> dupFilter = Iterators.dupFilter(); Iterators.Getter<ResolvedType, ResolvedType> typeGetter = new Iterators.Getter<ResolvedType, ResolvedType>() { @Override @@ -987,7 +987,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl return Collections.emptyMap(); } TypeVariable[] tvs = getGenericType().getTypeVariables(); - Map<String, UnresolvedType> parameterizationMap = new HashMap<String, UnresolvedType>(); + Map<String, UnresolvedType> parameterizationMap = new HashMap<>(); if (tvs.length != typeParameters.length) { world.getMessageHandler() .handleMessage( @@ -1021,7 +1021,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl } public List<ShadowMunger> getDeclaredAdvice() { - List<ShadowMunger> l = new ArrayList<ShadowMunger>(); + List<ShadowMunger> l = new ArrayList<>(); ResolvedMember[] methods = getDeclaredMethods(); if (isParameterizedType()) { methods = getGenericType().getDeclaredMethods(); @@ -1076,7 +1076,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl } private ResolvedMember[] filterInJavaVisible(ResolvedMember[] ms) { - List<ResolvedMember> l = new ArrayList<ResolvedMember>(); + List<ResolvedMember> l = new ArrayList<>(); for (ResolvedMember m : ms) { if (!m.isAjSynthetic() && m.getAssociatedShadowMunger() == null) { l.add(m); @@ -1405,14 +1405,14 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl return ret; } - protected List<ConcreteTypeMunger> interTypeMungers = new ArrayList<ConcreteTypeMunger>(); + protected List<ConcreteTypeMunger> interTypeMungers = new ArrayList<>(); public List<ConcreteTypeMunger> getInterTypeMungers() { return interTypeMungers; } public List<ConcreteTypeMunger> getInterTypeParentMungers() { - List<ConcreteTypeMunger> l = new ArrayList<ConcreteTypeMunger>(); + List<ConcreteTypeMunger> l = new ArrayList<>(); for (ConcreteTypeMunger element : interTypeMungers) { if (element.getMunger() instanceof NewParentTypeMunger) { l.add(element); @@ -1425,13 +1425,13 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl * ??? This method is O(N*M) where N = number of methods and M is number of inter-type declarations in my super */ public List<ConcreteTypeMunger> getInterTypeMungersIncludingSupers() { - ArrayList<ConcreteTypeMunger> ret = new ArrayList<ConcreteTypeMunger>(); + ArrayList<ConcreteTypeMunger> ret = new ArrayList<>(); collectInterTypeMungers(ret); return ret; } public List<ConcreteTypeMunger> getInterTypeParentMungersIncludingSupers() { - ArrayList<ConcreteTypeMunger> ret = new ArrayList<ConcreteTypeMunger>(); + ArrayList<ConcreteTypeMunger> ret = new ArrayList<>(); collectInterTypeParentMungers(ret); return ret; } @@ -2311,8 +2311,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl private Getter<ResolvedType, ResolvedType> ifaceGetter; Iterator<ResolvedType> delegate = null; - public Queue<ResolvedType> toPersue = new LinkedList<ResolvedType>(); - public Set<ResolvedType> visited = new HashSet<ResolvedType>(); + public Queue<ResolvedType> toPersue = new LinkedList<>(); + public Set<ResolvedType> visited = new HashSet<>(); SuperInterfaceWalker(Iterators.Getter<ResolvedType, ResolvedType> ifaceGetter) { this.ifaceGetter = ifaceGetter; @@ -2373,7 +2373,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl } // interTypeMungers.clear(); // BUG? Why can't this be clear() instead: 293620 c6 - interTypeMungers = new ArrayList<ConcreteTypeMunger>(); + interTypeMungers = new ArrayList<>(); } public boolean isTopmostImplementor(ResolvedType interfaceType) { @@ -2410,7 +2410,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl } public List<ResolvedMember> getExposedPointcuts() { - List<ResolvedMember> ret = new ArrayList<ResolvedMember>(); + List<ResolvedMember> ret = new ArrayList<>(); if (getSuperclass() != null) { ret.addAll(getSuperclass().getExposedPointcuts()); } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedTypeMunger.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedTypeMunger.java index 86e06e767..c5b5645fe 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedTypeMunger.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedTypeMunger.java @@ -168,7 +168,7 @@ public abstract class ResolvedTypeMunger { } protected static Set<ResolvedMember> readSuperMethodsCalled(VersionedDataInputStream s) throws IOException { - Set<ResolvedMember> ret = new HashSet<ResolvedMember>(); + Set<ResolvedMember> ret = new HashSet<>(); int n = -1; if (s.isAtLeast169()) { n = s.readByte(); @@ -189,7 +189,7 @@ public abstract class ResolvedTypeMunger { s.writeByte(0); return; } - List<ResolvedMember> ret = new ArrayList<ResolvedMember>(superMethodsCalled); + List<ResolvedMember> ret = new ArrayList<>(superMethodsCalled); Collections.sort(ret); int n = ret.size(); s.writeByte(n); @@ -378,7 +378,7 @@ public abstract class ResolvedTypeMunger { count = s.readInt(); } if (count != 0) { - List<String> aliases = new ArrayList<String>(); + List<String> aliases = new ArrayList<>(); for (int i = 0; i < count; i++) { aliases.add(s.readUTF()); } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java index 1892e8940..b48b87489 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Shadow.java @@ -533,7 +533,7 @@ public abstract class Shadow { public void addMunger(ShadowMunger munger) { if (checkMunger(munger)) { if (mungers == Collections.EMPTY_LIST) { - mungers = new ArrayList<ShadowMunger>(); + mungers = new ArrayList<>(); } this.mungers.add(munger); } @@ -571,7 +571,7 @@ public abstract class Shadow { // Stores a set of strings of the form 'aspect1:aspect2' which indicates there is no // precedence specified between the two aspects at this shadow. - Set<String> clashingAspects = new HashSet<String>(); + Set<String> clashingAspects = new HashSet<>(); int max = mungers.size(); // Compare every pair of advice mungers @@ -688,7 +688,7 @@ public abstract class Shadow { * manipulation! */ public static Set<Kind> toSet(int i) { - Set<Kind> results = new HashSet<Kind>(); + Set<Kind> results = new HashSet<>(); for (int j = 0; j < Shadow.SHADOW_KINDS.length; j++) { Kind k = Shadow.SHADOW_KINDS[j]; if (k.isSet(i)) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ShadowMunger.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ShadowMunger.java index 809cc58de..3a2a3a740 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ShadowMunger.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ShadowMunger.java @@ -93,7 +93,7 @@ public abstract class ShadowMunger implements PartialOrder.PartialComparable, IH + "' due to scope exclusion in XML definition")); } if (excludedTypes == null) { - excludedTypes = new HashSet<ResolvedType>(); + excludedTypes = new HashSet<>(); excludedTypes.add(type); world.getExclusionMap().put(declaringType, excludedTypes); } else { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/StandardAnnotation.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/StandardAnnotation.java index 5c898552d..4ec4c14c3 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/StandardAnnotation.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/StandardAnnotation.java @@ -116,7 +116,7 @@ public class StandardAnnotation extends AbstractAnnotationAJ { AnnotationNameValuePair nvp = nvPairs.get(0); ArrayAnnotationValue aav = (ArrayAnnotationValue) nvp.getValue(); AnnotationValue[] avs = aav.getValues(); - Set<String> targets = new HashSet<String>(); + Set<String> targets = new HashSet<>(); for (AnnotationValue av : avs) { EnumAnnotationValue value = (EnumAnnotationValue) av; targets.add(value.getValue()); @@ -134,7 +134,7 @@ public class StandardAnnotation extends AbstractAnnotationAJ { public void addNameValuePair(AnnotationNameValuePair pair) { if (nvPairs == null) { - nvPairs = new ArrayList<AnnotationNameValuePair>(); + nvPairs = new ArrayList<>(); } nvPairs.add(pair); } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeFactory.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeFactory.java index 2a578e392..72163e024 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeFactory.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/TypeFactory.java @@ -289,7 +289,7 @@ public class TypeFactory { private static UnresolvedType[] createTypeParams(String typeParameterSpecification) { String remainingToProcess = typeParameterSpecification; - List<UnresolvedType> types = new ArrayList<UnresolvedType>(); + List<UnresolvedType> types = new ArrayList<>(); while (remainingToProcess.length() != 0) { int endOfSig = 0; int anglies = 0; diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/WeaverStateInfo.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/WeaverStateInfo.java index f0dcbf270..62158cb9a 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/WeaverStateInfo.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/WeaverStateInfo.java @@ -89,7 +89,7 @@ public class WeaverStateInfo { } public WeaverStateInfo(boolean reweavable) { - this(new ArrayList<Entry>(), false, reweavable, reweavableCompressedModeDefault, reweavableDiffModeDefault); + this(new ArrayList<>(), false, reweavable, reweavableCompressedModeDefault, reweavableDiffModeDefault); } private WeaverStateInfo(List<Entry> typeMungers, boolean oldStyle, boolean reweavableMode, boolean reweavableCompressedMode, @@ -99,7 +99,7 @@ public class WeaverStateInfo { this.reweavable = reweavableMode; this.reweavableCompressedMode = reweavableCompressedMode; this.reweavableDiffMode = reweavableMode ? reweavableDiffMode : false; - this.aspectsAffectingType = new HashSet<String>(); + this.aspectsAffectingType = new HashSet<>(); this.unwovenClassFile = null; } @@ -147,7 +147,7 @@ public class WeaverStateInfo { } int n = s.readShort(); - List<Entry> l = new ArrayList<Entry>(); + List<Entry> l = new ArrayList<>(); for (int i = 0; i < n; i++) { // conditional on version UnresolvedType aspectType = null; @@ -257,7 +257,7 @@ public class WeaverStateInfo { public List<ConcreteTypeMunger> getTypeMungers(ResolvedType onType) { World world = onType.getWorld(); - List<ConcreteTypeMunger> ret = new ArrayList<ConcreteTypeMunger>(); + List<ConcreteTypeMunger> ret = new ArrayList<>(); for (Entry entry : typeMungers) { ResolvedType aspectType = world.resolve(entry.aspectType, true); if (aspectType.isMissing()) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/World.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/World.java index b2af422ff..671693e30 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/World.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/World.java @@ -378,7 +378,7 @@ public abstract class World implements Dump.INode { // MessageUtil.error(messageHandler, // WeaverMessages.format(WeaverMessages.CANT_FIND_TYPE,ty.getName())); if (dumpState_cantFindTypeExceptions == null) { - dumpState_cantFindTypeExceptions = new ArrayList<RuntimeException>(); + dumpState_cantFindTypeExceptions = new ArrayList<>(); } if (dumpState_cantFindTypeExceptions.size() < 100) { // limit growth dumpState_cantFindTypeExceptions.add(new RuntimeException("Can't find type " + ty.getName())); @@ -1045,11 +1045,11 @@ public abstract class World implements Dump.INode { public int policy = USE_WEAK_REFS; // Map of types that never get thrown away - final Map<String, ResolvedType> tMap = new HashMap<String, ResolvedType>(); + final Map<String, ResolvedType> tMap = new HashMap<>(); // Map of types that may be ejected from the cache if we need space final Map<String, Reference<ResolvedType>> expendableMap = Collections - .synchronizedMap(new WeakHashMap<String, Reference<ResolvedType>>()); + .synchronizedMap(new WeakHashMap<>()); private final World w; @@ -1057,13 +1057,13 @@ public abstract class World implements Dump.INode { private boolean memoryProfiling = false; private int maxExpendableMapSize = -1; private int collectedTypes = 0; - private final ReferenceQueue<ResolvedType> rq = new ReferenceQueue<ResolvedType>(); + private final ReferenceQueue<ResolvedType> rq = new ReferenceQueue<>(); TypeMap(World w) { // Demotion activated when switched on and loadtime weaving or in AJDT demotionSystemActive = w.isDemotionActive() && (w.isLoadtimeWeaving() || w.couldIncrementalCompileFollow()); - addedSinceLastDemote = new ArrayList<String>(); - writtenClasses = new ArrayList<String>(); + addedSinceLastDemote = new ArrayList<>(); + writtenClasses = new ArrayList<>(); this.w = w; memoryProfiling = false;// !w.getMessageHandler().isIgnoring(Message.INFO); } @@ -1115,7 +1115,7 @@ public abstract class World implements Dump.INode { addedSinceLastDemote.clear(); } else { // Compile time demotion strategy - List<String> forRemoval = new ArrayList<String>(); + List<String> forRemoval = new ArrayList<>(); for (String key : addedSinceLastDemote) { ResolvedType type = tMap.get(key); if (type == null) { @@ -1189,9 +1189,9 @@ public abstract class World implements Dump.INode { // might be GC'd independently. expendableMap.remove(key); if (policy == USE_SOFT_REFS) { - expendableMap.put(key, new SoftReference<ResolvedType>(type)); + expendableMap.put(key, new SoftReference<>(type)); } else { - expendableMap.put(key, new WeakReference<ResolvedType>(type)); + expendableMap.put(key, new WeakReference<>(type)); } } } @@ -1265,15 +1265,15 @@ public abstract class World implements Dump.INode { // Dont use reference queue for tracking if not profiling... if (policy == USE_WEAK_REFS) { if (memoryProfiling) { - expendableMap.put(key, new WeakReference<ResolvedType>(type, rq)); + expendableMap.put(key, new WeakReference<>(type, rq)); } else { - expendableMap.put(key, new WeakReference<ResolvedType>(type)); + expendableMap.put(key, new WeakReference<>(type)); } } else if (policy == USE_SOFT_REFS) { if (memoryProfiling) { - expendableMap.put(key, new SoftReference<ResolvedType>(type, rq)); + expendableMap.put(key, new SoftReference<>(type, rq)); } else { - expendableMap.put(key, new SoftReference<ResolvedType>(type)); + expendableMap.put(key, new SoftReference<>(type)); } // } else { // expendableMap.put(key, type); @@ -1418,7 +1418,7 @@ public abstract class World implements Dump.INode { public AspectPrecedenceCalculator(World forSomeWorld) { world = forSomeWorld; - cachedResults = new HashMap<PrecedenceCacheKey, Integer>(); + cachedResults = new HashMap<>(); } /** @@ -1521,7 +1521,7 @@ public abstract class World implements Dump.INode { // --- I would rather stash this against a reference type - but we don't // guarantee referencetypes are unique for // so we can't :( - private final Map<Class<?>, TypeVariable[]> workInProgress1 = new HashMap<Class<?>, TypeVariable[]>(); + private final Map<Class<?>, TypeVariable[]> workInProgress1 = new HashMap<>(); public TypeVariable[] getTypeVariablesCurrentlyBeingProcessed(Class<?> baseClass) { return workInProgress1.get(baseClass); @@ -1756,7 +1756,7 @@ public abstract class World implements Dump.INode { */ public void registerPointcutHandler(PointcutDesignatorHandler designatorHandler) { if (pointcutDesignators == null) { - pointcutDesignators = new HashSet<PointcutDesignatorHandler>(); + pointcutDesignators = new HashSet<>(); } pointcutDesignators.add(designatorHandler); } @@ -1841,7 +1841,7 @@ public abstract class World implements Dump.INode { // map from aspect > excluded types // memory issue here? - private Map<ResolvedType, Set<ResolvedType>> exclusionMap = new HashMap<ResolvedType, Set<ResolvedType>>(); + private Map<ResolvedType, Set<ResolvedType>> exclusionMap = new HashMap<>(); public Map<ResolvedType, Set<ResolvedType>> getExclusionMap() { return exclusionMap; @@ -1886,10 +1886,10 @@ public abstract class World implements Dump.INode { long typeCount; long perJoinpointCount; long perTypes; - Map<String, Long> joinpointsPerPointcut = new HashMap<String, Long>(); - Map<String, Long> timePerPointcut = new HashMap<String, Long>(); - Map<String, Long> fastMatchTimesPerPointcut = new HashMap<String, Long>(); - Map<String, Long> fastMatchTypesPerPointcut = new HashMap<String, Long>(); + Map<String, Long> joinpointsPerPointcut = new HashMap<>(); + Map<String, Long> timePerPointcut = new HashMap<>(); + Map<String, Long> fastMatchTimesPerPointcut = new HashMap<>(); + Map<String, Long> fastMatchTypesPerPointcut = new HashMap<>(); TimeCollector(World world) { this.perJoinpointCount = world.timersPerJoinpoint; @@ -1897,8 +1897,8 @@ public abstract class World implements Dump.INode { this.world = world; this.joinpointCount = 0; this.typeCount = 0; - this.joinpointsPerPointcut = new HashMap<String, Long>(); - this.timePerPointcut = new HashMap<String, Long>(); + this.joinpointsPerPointcut = new HashMap<>(); + this.timePerPointcut = new HashMap<>(); } public void report() { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AndSignaturePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AndSignaturePattern.java index c05995377..b374eea5a 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AndSignaturePattern.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AndSignaturePattern.java @@ -46,7 +46,7 @@ public class AndSignaturePattern extends AbstractSignaturePattern { public List<ExactTypePattern> getExactDeclaringTypes() { if (exactDeclaringTypes == null) { - exactDeclaringTypes = new ArrayList<ExactTypePattern>(); + exactDeclaringTypes = new ArrayList<>(); exactDeclaringTypes.addAll(leftSp.getExactDeclaringTypes()); exactDeclaringTypes.addAll(rightSp.getExactDeclaringTypes()); } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPointcut.java index 2f70523cd..7f7abd1e9 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPointcut.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPointcut.java @@ -263,7 +263,7 @@ public class AnnotationPointcut extends NameBindingPointcut { @Override public List<BindingPattern> getBindingAnnotationTypePatterns() { if (annotationTypePattern instanceof BindingPattern) { // BindingAnnotationTypePattern) { - List<BindingPattern> l = new ArrayList<BindingPattern>(); + List<BindingPattern> l = new ArrayList<>(); l.add((BindingPattern)annotationTypePattern); return l; } else { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java index f7351b5d7..349ebef79 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java @@ -180,7 +180,7 @@ public class ArgsAnnotationPointcut extends NameBindingPointcut { } public List<BindingPattern> getBindingAnnotationTypePatterns() { - List<BindingPattern> l = new ArrayList<BindingPattern>(); + List<BindingPattern> l = new ArrayList<>(); AnnotationTypePattern[] pats = arguments.getAnnotationPatterns(); for (AnnotationTypePattern pat : pats) { if (pat instanceof BindingAnnotationTypePattern) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsPointcut.java index 98c78d54d..0522bb13c 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsPointcut.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ArgsPointcut.java @@ -122,7 +122,7 @@ public class ArgsPointcut extends NameBindingPointcut { } public List<BindingTypePattern> getBindingTypePatterns() { - List<BindingTypePattern> l = new ArrayList<BindingTypePattern>(); + List<BindingTypePattern> l = new ArrayList<>(); TypePattern[] pats = arguments.getTypePatterns(); for (TypePattern pat : pats) { if (pat instanceof BindingTypePattern) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/BasicTokenSource.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/BasicTokenSource.java index 0a099529b..ef537d807 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/BasicTokenSource.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/BasicTokenSource.java @@ -84,7 +84,7 @@ public class BasicTokenSource implements ITokenSource { char[] chars = input.toCharArray(); int i = 0; - List<BasicToken> tokens = new ArrayList<BasicToken>(); + List<BasicToken> tokens = new ArrayList<>(); while (i < chars.length) { char ch = chars[i++]; diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/CflowPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/CflowPointcut.java index a83236e5c..b283a845f 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/CflowPointcut.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/CflowPointcut.java @@ -194,7 +194,7 @@ public class CflowPointcut extends Pointcut { entryBindings.popEnclosingDefinitition(); } - List<ShadowMunger> innerCflowEntries = new ArrayList<ShadowMunger>(xcut.getCflowEntries()); + List<ShadowMunger> innerCflowEntries = new ArrayList<>(xcut.getCflowEntries()); innerCflowEntries.removeAll(previousCflowEntries); // Four routes of interest through this code (did I hear someone say @@ -248,7 +248,7 @@ public class CflowPointcut extends Pointcut { return ret; } else { - List<Slot> slots = new ArrayList<Slot>(); + List<Slot> slots = new ArrayList<>(); for (int i = 0, len = freeVars.length; i < len; i++) { int freeVar = freeVars[i]; diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/DeclareAnnotation.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/DeclareAnnotation.java index ba1d29415..8f7b26648 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/DeclareAnnotation.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/DeclareAnnotation.java @@ -77,9 +77,9 @@ public class DeclareAnnotation extends Declare { } private void init() { - this.annotationMethods = new ArrayList<String>(); + this.annotationMethods = new ArrayList<>(); annotationMethods.add("unknown"); - this.annotationStrings = new ArrayList<String>(); + this.annotationStrings = new ArrayList<>(); annotationStrings.add("@<annotation>"); } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/DeclareParents.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/DeclareParents.java index 53553afb3..440a9ce5d 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/DeclareParents.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/DeclareParents.java @@ -342,7 +342,7 @@ public class DeclareParents extends Declare { return Collections.emptyList(); } - List<ResolvedType> ret = new ArrayList<ResolvedType>(); + List<ResolvedType> ret = new ArrayList<>(); for (int i = 0; i < parents.size(); i++) { ResolvedType t = maybeGetNewParent(onType, parents.get(i), onType.getWorld(), reportErrors); if (t != null) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java index 8105a4f1d..6903b9b83 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactAnnotationTypePattern.java @@ -411,7 +411,7 @@ public class ExactAnnotationTypePattern extends AnnotationTypePattern { if (s.getMajorVersion() >= WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ160M2) { int annotationValueCount = s.readInt(); if (annotationValueCount > 0) { - Map<String, String> aValues = new HashMap<String, String>(); + Map<String, String> aValues = new HashMap<>(); for (int i = 0; i < annotationValueCount; i++) { String key = s.readUTF(); String val = s.readUTF(); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactTypePattern.java index d54ad29ab..b439de277 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactTypePattern.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ExactTypePattern.java @@ -40,7 +40,7 @@ public class ExactTypePattern extends TypePattern { private static final Map<String, Class<?>> boxedTypesMap; static { - primitiveTypesMap = new HashMap<String, Class<?>>(); + primitiveTypesMap = new HashMap<>(); primitiveTypesMap.put("int", int.class); primitiveTypesMap.put("short", short.class); primitiveTypesMap.put("long", long.class); @@ -49,7 +49,7 @@ public class ExactTypePattern extends TypePattern { primitiveTypesMap.put("float", float.class); primitiveTypesMap.put("double", double.class); - boxedPrimitivesMap = new HashMap<String, Class<?>>(); + boxedPrimitivesMap = new HashMap<>(); boxedPrimitivesMap.put("java.lang.Integer", Integer.class); boxedPrimitivesMap.put("java.lang.Short", Short.class); boxedPrimitivesMap.put("java.lang.Long", Long.class); @@ -58,7 +58,7 @@ public class ExactTypePattern extends TypePattern { boxedPrimitivesMap.put("java.lang.Float", Float.class); boxedPrimitivesMap.put("java.lang.Double", Double.class); - boxedTypesMap = new HashMap<String, Class<?>>(); + boxedTypesMap = new HashMap<>(); boxedTypesMap.put("int", Integer.class); boxedTypesMap.put("short", Short.class); boxedTypesMap.put("long", Long.class); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/IfPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/IfPointcut.java index a845153f9..8c2cb36b9 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/IfPointcut.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/IfPointcut.java @@ -191,7 +191,7 @@ public class IfPointcut extends Pointcut { } Test ret = Literal.TRUE; - List<Var> args = new ArrayList<Var>(); + List<Var> args = new ArrayList<>(); // code style if (extraParameterFlags >= 0) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ModifiersPattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ModifiersPattern.java index d4b747af3..259edfab1 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ModifiersPattern.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ModifiersPattern.java @@ -29,7 +29,7 @@ public class ModifiersPattern extends PatternNode { private static Map<String, Integer> modifierFlags = null; static { - modifierFlags = new HashMap<String, Integer>(); + modifierFlags = new HashMap<>(); int flag = 1; while (flag <= Modifier.STRICT) { String flagName = Modifier.toString(flag); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/OrSignaturePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/OrSignaturePattern.java index 67346f444..13244f70e 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/OrSignaturePattern.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/OrSignaturePattern.java @@ -46,7 +46,7 @@ public class OrSignaturePattern extends AbstractSignaturePattern { public List<ExactTypePattern> getExactDeclaringTypes() { if (exactDeclaringTypes == null) { - exactDeclaringTypes = new ArrayList<ExactTypePattern>(); + exactDeclaringTypes = new ArrayList<>(); exactDeclaringTypes.addAll(leftSp.getExactDeclaringTypes()); exactDeclaringTypes.addAll(rightSp.getExactDeclaringTypes()); } diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PatternParser.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PatternParser.java index effecfeaf..c329ba88e 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PatternParser.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PatternParser.java @@ -259,7 +259,7 @@ public class PatternParser { } public DeclarePrecedence parseDominates() { - List<TypePattern> l = new ArrayList<TypePattern>(); + List<TypePattern> l = new ArrayList<>(); do { l.add(parseTypePattern()); } while (maybeEat(",")); @@ -282,7 +282,7 @@ public class PatternParser { } boolean isExtends = t.getString().equals("extends"); - List<TypePattern> l = new ArrayList<TypePattern>(); + List<TypePattern> l = new ArrayList<>(); do { l.add(parseTypePattern()); } while (maybeEat(",")); @@ -679,7 +679,7 @@ public class PatternParser { } public List<String> parseDottedIdentifier() { - List<String> ret = new ArrayList<String>(); + List<String> ret = new ArrayList<>(); ret.add(parseIdentifier()); while (maybeEat(".")) { ret.add(parseIdentifier()); @@ -915,7 +915,7 @@ public class PatternParser { // Parse annotation values. In an expression in @A(a=b,c=d) this method will be // parsing the a=b,c=d.) public Map<String, String> parseAnnotationValues() { - Map<String, String> values = new HashMap<String, String>(); + Map<String, String> values = new HashMap<>(); boolean seenDefaultValue = false; do { String possibleKeyString = parseAnnotationNameValuePattern(); @@ -1133,7 +1133,7 @@ public class PatternParser { } public TypePattern parseGenericsWildcardTypePattern() { - List<NamePattern> names = new ArrayList<NamePattern>(); + List<NamePattern> names = new ArrayList<>(); names.add(new NamePattern("?")); TypePattern upperBound = null; TypePattern[] additionalInterfaceBounds = new TypePattern[0]; @@ -1242,7 +1242,7 @@ public class PatternParser { // } public List<NamePattern> parseDottedNamePattern() { - List<NamePattern> names = new ArrayList<NamePattern>(); + List<NamePattern> names = new ArrayList<>(); StringBuffer buf = new StringBuffer(); IToken previous = null; boolean justProcessedEllipsis = false; // Remember if we just dealt with an ellipsis (PR61536) @@ -1464,7 +1464,7 @@ public class PatternParser { } public TypePatternList parseArgumentsPattern(boolean parameterAnnotationsPossible) { - List<TypePattern> patterns = new ArrayList<TypePattern>(); + List<TypePattern> patterns = new ArrayList<>(); eat("("); // () @@ -1485,7 +1485,7 @@ public class PatternParser { } public AnnotationPatternList parseArgumentsAnnotationPattern() { - List<AnnotationTypePattern> patterns = new ArrayList<AnnotationTypePattern>(); + List<AnnotationTypePattern> patterns = new ArrayList<>(); eat("("); if (maybeEat(")")) { return new AnnotationPatternList(); @@ -1509,8 +1509,8 @@ public class PatternParser { IToken t = tokenSource.peek(); if (t.isIdentifier() && t.getString().equals("throws")) { tokenSource.next(); - List<TypePattern> required = new ArrayList<TypePattern>(); - List<TypePattern> forbidden = new ArrayList<TypePattern>(); + List<TypePattern> required = new ArrayList<>(); + List<TypePattern> forbidden = new ArrayList<>(); do { boolean isForbidden = maybeEat("!"); // ???might want an error for a second ! without a paren @@ -1694,7 +1694,7 @@ public class PatternParser { if (!maybeEat("<")) { return null; } - List<TypeVariablePattern> typeVars = new ArrayList<TypeVariablePattern>(); + List<TypeVariablePattern> typeVars = new ArrayList<>(); TypeVariablePattern t = parseTypeVariable(); typeVars.add(t); while (maybeEat(",")) { @@ -1712,7 +1712,7 @@ public class PatternParser { if (!maybeEat("<")) { return null; } - List<String> typeVarNames = new ArrayList<String>(); + List<String> typeVarNames = new ArrayList<>(); do { typeVarNames.add(parseIdentifier()); } while (maybeEat(",")); @@ -1726,7 +1726,7 @@ public class PatternParser { if (!maybeEat("<")) { return null; } - List<TypePattern> typePats = new ArrayList<TypePattern>(); + List<TypePattern> typePats = new ArrayList<>(); do { TypePattern tp = parseTypePattern(true, false); typePats.add(tp); @@ -1752,7 +1752,7 @@ public class PatternParser { } private TypePattern[] maybeParseAdditionalInterfaceBounds() { - List<TypePattern> boundsList = new ArrayList<TypePattern>(); + List<TypePattern> boundsList = new ArrayList<>(); while (maybeEat("&")) { TypePattern tp = parseTypePattern(); boundsList.add(tp); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PerCflow.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PerCflow.java index 1ad834e06..31975df77 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PerCflow.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PerCflow.java @@ -101,7 +101,7 @@ public class PerCflow extends PerClause { // EMPTY // ) // ; - List<ShadowMunger> innerCflowEntries = new ArrayList<ShadowMunger>(xcut.getCflowEntries()); + List<ShadowMunger> innerCflowEntries = new ArrayList<>(xcut.getCflowEntries()); innerCflowEntries.removeAll(previousCflowEntries); xcut.addConcreteShadowMunger(Advice.makePerCflowEntry(world, concreteEntry, isBelow, cflowStackField, inAspect, diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PointcutRewriter.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PointcutRewriter.java index 72e552ab4..4e1ef74df 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PointcutRewriter.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PointcutRewriter.java @@ -327,7 +327,7 @@ public class PointcutRewriter { } private Pointcut simplifyAnd(AndPointcut apc) { - SortedSet<Pointcut> nodes = new TreeSet<Pointcut>(new PointcutEvaluationExpenseComparator()); + SortedSet<Pointcut> nodes = new TreeSet<>(new PointcutEvaluationExpenseComparator()); collectAndNodes(apc, nodes); // look for A and !A, or IfFalse for (Pointcut element : nodes) { @@ -361,7 +361,7 @@ public class PointcutRewriter { } private Pointcut sortOrs(Pointcut pc) { - SortedSet<Pointcut> nodes = new TreeSet<Pointcut>(new PointcutEvaluationExpenseComparator()); + SortedSet<Pointcut> nodes = new TreeSet<>(new PointcutEvaluationExpenseComparator()); collectOrNodes(pc, nodes); // write out with cheapest on left Iterator<Pointcut> iter = nodes.iterator(); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ReferencePointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ReferencePointcut.java index 6e74a1a2f..6a234d04c 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ReferencePointcut.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ReferencePointcut.java @@ -197,7 +197,7 @@ public class ReferencePointcut extends Pointcut { if (onType.isParameterizedType()) { // build a type map mapping type variable names in the generic type to // the type parameters presented - typeVariableMap = new HashMap<String, UnresolvedType>(); + typeVariableMap = new HashMap<>(); ResolvedType underlyingGenericType = ((ResolvedType) onType).getGenericType(); TypeVariable[] tVars = underlyingGenericType.getTypeVariables(); ResolvedType[] typeParams = ((ResolvedType) onType).getResolvedTypeParameters(); @@ -344,7 +344,7 @@ public class ReferencePointcut extends Pointcut { if (searchStart.isParameterizedType()) { // build a type map mapping type variable names in the generic type to // the type parameters presented - typeVariableMap = new HashMap<String, UnresolvedType>(); + typeVariableMap = new HashMap<>(); ResolvedType underlyingGenericType = searchStart.getGenericType(); TypeVariable[] tVars = underlyingGenericType.getTypeVariables(); ResolvedType[] typeParams = searchStart.getResolvedTypeParameters(); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/SignaturePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/SignaturePattern.java index 4541d1579..e1a52f8c8 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/SignaturePattern.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/SignaturePattern.java @@ -174,7 +174,7 @@ public class SignaturePattern extends PatternNode implements ISignaturePattern { private class TypePatternVisitor extends AbstractPatternNodeVisitor { private IScope scope; - private Map<ExactAnnotationTypePattern, AnnotationTargetKind[]> incorrectTargetKinds = new HashMap<ExactAnnotationTypePattern, AnnotationTargetKind[]>(); + private Map<ExactAnnotationTypePattern, AnnotationTargetKind[]> incorrectTargetKinds = new HashMap<>(); private boolean targetsOtherThanTypeAllowed; private boolean parameterTargettingAnnotationsAllowed; @@ -206,7 +206,7 @@ public class SignaturePattern extends PatternNode implements ISignaturePattern { if (targetKinds == null) { return data; } - List<AnnotationTargetKind> incorrectTargets = new ArrayList<AnnotationTargetKind>(); + List<AnnotationTargetKind> incorrectTargets = new ArrayList<>(); for (AnnotationTargetKind targetKind : targetKinds) { if (targetKind.getName().equals(kind.getName()) || (targetKind.getName().equals("PARAMETER") && node.isForParameterAnnotationMatch())) { @@ -990,7 +990,7 @@ public class SignaturePattern extends PatternNode implements ISignaturePattern { @Override public List<ExactTypePattern> getExactDeclaringTypes() { if (declaringType instanceof ExactTypePattern) { - List<ExactTypePattern> l = new ArrayList<ExactTypePattern>(); + List<ExactTypePattern> l = new ArrayList<>(); l.add((ExactTypePattern) declaringType); return l; } else { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java index dfb509195..17b511f71 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java @@ -248,7 +248,7 @@ public class ThisOrTargetAnnotationPointcut extends NameBindingPointcut { @Override public List<BindingPattern> getBindingAnnotationTypePatterns() { if (annotationTypePattern instanceof BindingAnnotationTypePattern) { - List<BindingPattern> l = new ArrayList<BindingPattern>(); + List<BindingPattern> l = new ArrayList<>(); l.add((BindingPattern)annotationTypePattern); return l; } else { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java index a278e76c6..b4950975f 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java @@ -165,7 +165,7 @@ public class ThisOrTargetPointcut extends NameBindingPointcut { @Override public List<BindingTypePattern> getBindingTypePatterns() { if (typePattern instanceof BindingTypePattern) { - List<BindingTypePattern> l = new ArrayList<BindingTypePattern>(); + List<BindingTypePattern> l = new ArrayList<>(); l.add((BindingTypePattern)typePattern); return l; } else { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternList.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternList.java index 040d6dbe2..2b17520a2 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternList.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternList.java @@ -531,7 +531,7 @@ public class TypePatternList extends PatternNode { } public List<UnresolvedType> getExactTypes() { - List<UnresolvedType> ret = new ArrayList<UnresolvedType>(); + List<UnresolvedType> ret = new ArrayList<>(); for (TypePattern typePattern : typePatterns) { UnresolvedType t = typePattern.getExactType(); if (!ResolvedType.isMissing(t)) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternQuestions.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternQuestions.java index 8289d306e..162665c2c 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternQuestions.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/TypePatternQuestions.java @@ -22,7 +22,7 @@ import org.aspectj.weaver.ResolvedType; public class TypePatternQuestions { - private Map<Question,FuzzyBoolean> questionsAndAnswers = new HashMap<Question,FuzzyBoolean>(); + private Map<Question,FuzzyBoolean> questionsAndAnswers = new HashMap<>(); public FuzzyBoolean askQuestion(TypePattern pattern, ResolvedType type, TypePattern.MatchKind kind) diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java index 531b3d09f..dd95d4c77 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildAnnotationTypePattern.java @@ -82,7 +82,7 @@ public class WildAnnotationTypePattern extends AnnotationTypePattern { // - the value names are for valid annotation fields // - the specified values are of the correct type // - for enums, check the specified values can be resolved in the specified scope - Map<String,String> replacementValues = new HashMap<String,String>(); + Map<String,String> replacementValues = new HashMap<>(); Set<String> keys = annotationValues.keySet(); ResolvedMember[] ms = annotationType.getDeclaredMethods(); for (String k: keys) { @@ -391,7 +391,7 @@ public class WildAnnotationTypePattern extends AnnotationTypePattern { if (s.getMajorVersion() >= WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ160M2) { int annotationValueCount = s.readInt(); if (annotationValueCount > 0) { - Map<String, String> aValues = new HashMap<String, String>(); + Map<String, String> aValues = new HashMap<>(); for (int i = 0; i < annotationValueCount; i++) { String key = s.readUTF(); String val = s.readUTF(); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java index c766d30ba..b8e58c342 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java @@ -199,7 +199,7 @@ public class WildTypePattern extends TypePattern { // part of the declared type name (generated code often uses $s in type // names). More work required on our part to get this right... public static char[][] splitNames(String s, boolean convertDollar) { - List<char[]> ret = new ArrayList<char[]>(); + List<char[]> ret = new ArrayList<>(); int startIndex = 0; while (true) { int breakIndex = s.indexOf('.', startIndex); // what about / @@ -387,7 +387,7 @@ public class WildTypePattern extends TypePattern { private boolean innerMatchesExactly(String s, boolean isAnonymous, boolean convertDollar /* isNested */) { - List<char[]> ret = new ArrayList<char[]>(); + List<char[]> ret = new ArrayList<>(); int startIndex = 0; while (true) { int breakIndex = s.indexOf('.', startIndex); // what about / @@ -1157,7 +1157,7 @@ public class WildTypePattern extends TypePattern { private String[] preMatch(String[] possibleMatches) { // if (namePatterns.length != 1) return CollectionUtil.NO_STRINGS; - List<String> ret = new ArrayList<String>(); + List<String> ret = new ArrayList<>(); for (String possibleMatch : possibleMatches) { char[][] names = splitNames(possibleMatch, true); // ??? not most efficient if (namePatterns[0].matches(names[names.length - 1])) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java index 42ec11dc2..777191f88 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java @@ -164,7 +164,7 @@ public class WithinAnnotationPointcut extends NameBindingPointcut { @Override public List<BindingPattern> getBindingAnnotationTypePatterns() { if (annotationTypePattern instanceof BindingAnnotationTypePattern) { - List<BindingPattern> l = new ArrayList<BindingPattern>(); + List<BindingPattern> l = new ArrayList<>(); l.add((BindingPattern)annotationTypePattern); return l; } else { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java index 408c829f5..69cc9b7ac 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java @@ -172,7 +172,7 @@ public class WithinCodeAnnotationPointcut extends NameBindingPointcut { public List<BindingPattern> getBindingAnnotationTypePatterns() { if (annotationTypePattern instanceof BindingAnnotationTypePattern) { - List<BindingPattern> l = new ArrayList<BindingPattern>(); + List<BindingPattern> l = new ArrayList<>(); l.add((BindingPattern)annotationTypePattern); return l; } else { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java index c784ff288..c4bcb3665 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionWorld.java @@ -35,12 +35,12 @@ import org.aspectj.weaver.World; */ public class ReflectionWorld extends World implements IReflectionWorld { - private static Map<WeakClassLoaderReference, ReflectionWorld> rworlds = Collections.synchronizedMap(new HashMap<WeakClassLoaderReference, ReflectionWorld>()); + private static Map<WeakClassLoaderReference, ReflectionWorld> rworlds = Collections.synchronizedMap(new HashMap<>()); private WeakClassLoaderReference classLoaderReference; private AnnotationFinder annotationFinder; private boolean mustUseOneFourDelegates = false; // for testing - private Map<String,Class<?>> inProgressResolutionClasses = new HashMap<String,Class<?>>(); + private Map<String,Class<?>> inProgressResolutionClasses = new HashMap<>(); public static ReflectionWorld getReflectionWorldFor(WeakClassLoaderReference classLoaderReference) { diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/PointcutParser.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/PointcutParser.java index ca0fa3aca..5c4a4d27d 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/PointcutParser.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/PointcutParser.java @@ -60,14 +60,14 @@ public class PointcutParser { private ReflectionWorld world; private WeakClassLoaderReference classLoaderReference; private final Set<PointcutPrimitive> supportedPrimitives; - private final Set<PointcutDesignatorHandler> pointcutDesignators = new HashSet<PointcutDesignatorHandler>(); + private final Set<PointcutDesignatorHandler> pointcutDesignators = new HashSet<>(); /** * @return a Set containing every PointcutPrimitive except if, cflow, and cflowbelow (useful for passing to PointcutParser * constructor). */ public static Set<PointcutPrimitive> getAllSupportedPointcutPrimitives() { - Set<PointcutPrimitive> primitives = new HashSet<PointcutPrimitive>(); + Set<PointcutPrimitive> primitives = new HashSet<>(); primitives.add(PointcutPrimitive.ADVICE_EXECUTION); primitives.add(PointcutPrimitive.ARGS); primitives.add(PointcutPrimitive.CALL); diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/StandardPointcutParser.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/StandardPointcutParser.java index afc14188d..65de08759 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/StandardPointcutParser.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/tools/StandardPointcutParser.java @@ -53,14 +53,14 @@ public class StandardPointcutParser { private World world; private final Set<PointcutPrimitive> supportedPrimitives; - private final Set<PointcutDesignatorHandler> pointcutDesignators = new HashSet<PointcutDesignatorHandler>(); + private final Set<PointcutDesignatorHandler> pointcutDesignators = new HashSet<>(); /** * @return a Set containing every PointcutPrimitive except if, cflow, and cflowbelow (useful for passing to PointcutParser * constructor). */ public static Set<PointcutPrimitive> getAllSupportedPointcutPrimitives() { - Set<PointcutPrimitive> primitives = new HashSet<PointcutPrimitive>(); + Set<PointcutPrimitive> primitives = new HashSet<>(); primitives.add(PointcutPrimitive.ADVICE_EXECUTION); primitives.add(PointcutPrimitive.ARGS); primitives.add(PointcutPrimitive.CALL); diff --git a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/CommonWorldTests.java b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/CommonWorldTests.java index 8998904a6..9389fff8b 100644 --- a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/CommonWorldTests.java +++ b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/CommonWorldTests.java @@ -92,10 +92,10 @@ public abstract class CommonWorldTests extends TestCase { ResolvedType ty = world.resolve(tx, true); assertTrue("Couldnt find type " + tx, !ty.isMissing()); ResolvedType[] lowerTyArray = world.resolve(UnresolvedType.forSignatures(lowers)); - List<ResolvedType> lowerTys = new ArrayList<ResolvedType>(Arrays.asList(lowerTyArray)); + List<ResolvedType> lowerTys = new ArrayList<>(Arrays.asList(lowerTyArray)); lowerTys.add(ty); - Set<ResolvedType> allLowerTys = new HashSet<ResolvedType>(lowerTys); - Set<ResolvedType> allUpperTys = new HashSet<ResolvedType>(Arrays.asList(primitives)); + Set<ResolvedType> allLowerTys = new HashSet<>(lowerTys); + Set<ResolvedType> allUpperTys = new HashSet<>(Arrays.asList(primitives)); allUpperTys.removeAll(allLowerTys); for (ResolvedType other : allLowerTys) { diff --git a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/TestUtils.java b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/TestUtils.java index ac4c46cb7..9f7daa756 100644 --- a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/TestUtils.java +++ b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/TestUtils.java @@ -287,7 +287,7 @@ public class TestUtils { public static String[] parseIds(String str) { if (str.length() == 0) return ZERO_STRINGS; - List<String> l = new ArrayList<String>(); + List<String> l = new ArrayList<>(); int start = 0; while (true) { int i = str.indexOf(',', start); diff --git a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ConstantPoolSimulator.java b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ConstantPoolSimulator.java index 57f971665..1583900f4 100644 --- a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ConstantPoolSimulator.java +++ b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ConstantPoolSimulator.java @@ -17,7 +17,7 @@ import org.aspectj.weaver.ConstantPoolReader; import org.aspectj.weaver.ConstantPoolWriter; public class ConstantPoolSimulator implements ConstantPoolWriter, ConstantPoolReader { - List<String> list = new ArrayList<String>(); + List<String> list = new ArrayList<>(); public int writeUtf8(String string) { int i = list.indexOf(string); diff --git a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ParserTestCase.java b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ParserTestCase.java index 7ffad81d5..9f524d836 100644 --- a/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ParserTestCase.java +++ b/org.aspectj.matcher/src/test/java/org/aspectj/weaver/patterns/ParserTestCase.java @@ -700,7 +700,7 @@ public class ParserTestCase extends PatternsTestCase { WildAnnotationTypePattern watp = (WildAnnotationTypePattern) atp; Map<String,String> m = watp.annotationValues; Set<String> keys = m.keySet(); - List<String> orderedKeys = new ArrayList<String>(); + List<String> orderedKeys = new ArrayList<>(); orderedKeys.addAll(keys); Collections.sort(orderedKeys); StringBuffer sb = new StringBuffer(); |