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 /loadtime/src | |
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 'loadtime/src')
4 files changed, 34 insertions, 34 deletions
diff --git a/loadtime/src/main/java/org/aspectj/weaver/loadtime/Aj.java b/loadtime/src/main/java/org/aspectj/weaver/loadtime/Aj.java index abd8ecc87..57db3092f 100644 --- a/loadtime/src/main/java/org/aspectj/weaver/loadtime/Aj.java +++ b/loadtime/src/main/java/org/aspectj/weaver/loadtime/Aj.java @@ -265,7 +265,7 @@ public class Aj implements ClassPreProcessor { if (loadersToSkipProperty != null && loadersToSkip == null) { if (st.hasMoreTokens()) { // System.out.println("aj.weaving.loadersToSkip is set. Skipping loaders: '"+loadersToSkipProperty+"'"); - loadersToSkip = new ArrayList<String>(); + loadersToSkip = new ArrayList<>(); } while (st.hasMoreTokens()) { String nextLoader = st.nextToken(); @@ -283,7 +283,7 @@ public class Aj implements ClassPreProcessor { static class WeaverContainer { final static Map<AdaptorKey,ExplicitlyInitializedClassLoaderWeavingAdaptor> weavingAdaptors = - Collections.synchronizedMap(new HashMap<AdaptorKey,ExplicitlyInitializedClassLoaderWeavingAdaptor>()); + Collections.synchronizedMap(new HashMap<>()); static WeavingAdaptor getWeaver(ClassLoader loader, IWeavingContext weavingContext) { ExplicitlyInitializedClassLoaderWeavingAdaptor adaptor = null; diff --git a/loadtime/src/main/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java b/loadtime/src/main/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java index 5827f2e64..0edd55721 100644 --- a/loadtime/src/main/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java +++ b/loadtime/src/main/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java @@ -69,33 +69,33 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { private boolean initialized; - private List<TypePattern> dumpTypePattern = new ArrayList<TypePattern>(); + private List<TypePattern> dumpTypePattern = new ArrayList<>(); private boolean dumpBefore = false; private boolean dumpDirPerClassloader = false; private boolean hasExcludes = false; - private List<TypePattern> excludeTypePattern = new ArrayList<TypePattern>(); // anything - private List<String> excludeStartsWith = new ArrayList<String>(); // com.foo..* - private List<String> excludeStarDotDotStar = new ArrayList<String>(); // *..*CGLIB* - private List<String> excludeExactName = new ArrayList<String>(); // com.foo.Bar - private List<String> excludeEndsWith = new ArrayList<String>(); // com.foo.Bar - private List<String[]> excludeSpecial = new ArrayList<String[]>(); + private List<TypePattern> excludeTypePattern = new ArrayList<>(); // anything + private List<String> excludeStartsWith = new ArrayList<>(); // com.foo..* + private List<String> excludeStarDotDotStar = new ArrayList<>(); // *..*CGLIB* + private List<String> excludeExactName = new ArrayList<>(); // com.foo.Bar + private List<String> excludeEndsWith = new ArrayList<>(); // com.foo.Bar + private List<String[]> excludeSpecial = new ArrayList<>(); private boolean hasIncludes = false; - private List<TypePattern> includeTypePattern = new ArrayList<TypePattern>(); - private List<String> includeStartsWith = new ArrayList<String>(); - private List<String> includeExactName = new ArrayList<String>(); + private List<TypePattern> includeTypePattern = new ArrayList<>(); + private List<String> includeStartsWith = new ArrayList<>(); + private List<String> includeExactName = new ArrayList<>(); private boolean includeStar = false; - private List<TypePattern> aspectExcludeTypePattern = new ArrayList<TypePattern>(); - private List<String> aspectExcludeStartsWith = new ArrayList<String>(); - private List<TypePattern> aspectIncludeTypePattern = new ArrayList<TypePattern>(); - private List<String> aspectIncludeStartsWith = new ArrayList<String>(); + private List<TypePattern> aspectExcludeTypePattern = new ArrayList<>(); + private List<String> aspectExcludeStartsWith = new ArrayList<>(); + private List<TypePattern> aspectIncludeTypePattern = new ArrayList<>(); + private List<String> aspectIncludeStartsWith = new ArrayList<>(); private StringBuffer namespace; private IWeavingContext weavingContext; - private List<ConcreteAspectCodeGen> concreteAspects = new ArrayList<ConcreteAspectCodeGen>(); + private List<ConcreteAspectCodeGen> concreteAspects = new ArrayList<>(); private static Trace trace = TraceFactory.getTraceFactory().getTrace(ClassLoaderWeavingAdaptor.class); @@ -218,7 +218,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { * @return */ List<String> getAspectClassNames(List<Definition> definitions) { - List<String> aspects = new LinkedList<String>(); + List<String> aspects = new LinkedList<>(); for (Definition def : definitions) { List<String> defAspects = def.getAspectClassNames(); if (defAspects != null) { @@ -238,7 +238,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { trace.enter("parseDefinitions", this); } - List<Definition> definitions = new ArrayList<Definition>(); + List<Definition> definitions = new ArrayList<>(); try { info("register classloader " + getClassLoaderName(loader)); // TODO av underoptimized: we will parse each XML once per CL that see it @@ -277,7 +277,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { Enumeration<URL> xmls = weavingContext.getResources(nextDefinition); // System.out.println("? registerDefinitions: found-aop.xml=" + xmls.hasMoreElements() + ", loader=" + loader); - Set<URL> seenBefore = new HashSet<URL>(); + Set<URL> seenBefore = new HashSet<>(); while (xmls.hasMoreElements()) { URL xml = xmls.nextElement(); if (trace.isTraceEnabled()) { @@ -1002,7 +1002,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { */ public void flushGeneratedClasses() { // System.err.println("? ClassLoaderWeavingAdaptor.flushGeneratedClasses() generatedClasses=" + generatedClasses); - generatedClasses = new HashMap<String, IUnwovenClassFile>(); + generatedClasses = new HashMap<>(); } /** diff --git a/loadtime/src/main/java/org/aspectj/weaver/loadtime/ConcreteAspectCodeGen.java b/loadtime/src/main/java/org/aspectj/weaver/loadtime/ConcreteAspectCodeGen.java index 7f87e40c9..fcc89ac75 100644 --- a/loadtime/src/main/java/org/aspectj/weaver/loadtime/ConcreteAspectCodeGen.java +++ b/loadtime/src/main/java/org/aspectj/weaver/loadtime/ConcreteAspectCodeGen.java @@ -218,7 +218,7 @@ public class ConcreteAspectCodeGen { } // must have all abstractions defined - List<String> elligibleAbstractions = new ArrayList<String>(); + List<String> elligibleAbstractions = new ArrayList<>(); Collection<ResolvedMember> abstractMethods = getOutstandingAbstractMethods(parent); for (ResolvedMember method : abstractMethods) { @@ -254,7 +254,7 @@ public class ConcreteAspectCodeGen { } } } - List<String> pointcutNames = new ArrayList<String>(); + List<String> pointcutNames = new ArrayList<>(); for (Definition.Pointcut abstractPc : concreteAspect.pointcuts) { pointcutNames.add(abstractPc.name); } @@ -283,7 +283,7 @@ public class ConcreteAspectCodeGen { } private Collection<ResolvedMember> getOutstandingAbstractMethods(ResolvedType type) { - Map<String, ResolvedMember> collector = new HashMap<String, ResolvedMember>(); + Map<String, ResolvedMember> collector = new HashMap<>(); // let's get to the top of the hierarchy and then walk down ... // recording abstract methods then removing // them if they get defined further down the hierarchy @@ -411,7 +411,7 @@ public class ConcreteAspectCodeGen { cg.addAnnotation(ag); } else { // List elems = new ArrayList(); - List<NameValuePair> elems = new ArrayList<NameValuePair>(); + List<NameValuePair> elems = new ArrayList<>(); elems.add(new NameValuePair("value", new SimpleElementValue(ElementValue.STRING, cg.getConstantPool(), perclauseString), cg.getConstantPool())); AnnotationGen ag = new AnnotationGen(new ObjectType("org/aspectj/lang/annotation/Aspect"), elems, true, @@ -420,7 +420,7 @@ public class ConcreteAspectCodeGen { } if (concreteAspect.precedence != null) { SimpleElementValue svg = new SimpleElementValue(ElementValue.STRING, cg.getConstantPool(), concreteAspect.precedence); - List<NameValuePair> elems = new ArrayList<NameValuePair>(); + List<NameValuePair> elems = new ArrayList<>(); elems.add(new NameValuePair("value", svg, cg.getConstantPool())); AnnotationGen agprec = new AnnotationGen(new ObjectType("org/aspectj/lang/annotation/DeclarePrecedence"), elems, true, cg.getConstantPool()); @@ -440,7 +440,7 @@ public class ConcreteAspectCodeGen { // TODO AV - respect visibility instead of opening up as public? LazyMethodGen mg = new LazyMethodGen(Modifier.PUBLIC, Type.VOID, abstractPc.name, EMPTY_TYPES, EMPTY_STRINGS, cg); SimpleElementValue svg = new SimpleElementValue(ElementValue.STRING, cg.getConstantPool(), abstractPc.expression); - List<NameValuePair> elems = new ArrayList<NameValuePair>(); + List<NameValuePair> elems = new ArrayList<>(); elems.add(new NameValuePair("value", svg, cg.getConstantPool())); AnnotationGen mag = new AnnotationGen(new ObjectType("org/aspectj/lang/annotation/Pointcut"), elems, true, cg.getConstantPool()); @@ -462,7 +462,7 @@ public class ConcreteAspectCodeGen { FieldGen field = new FieldGen(Modifier.FINAL, ObjectType.STRING, "rule" + (counter++), cg.getConstantPool()); SimpleElementValue svg = new SimpleElementValue(ElementValue.STRING, cg.getConstantPool(), deow.pointcut); - List<NameValuePair> elems = new ArrayList<NameValuePair>(); + List<NameValuePair> elems = new ArrayList<>(); elems.add(new NameValuePair("value", svg, cg.getConstantPool())); AnnotationGen mag = new AnnotationGen(new ObjectType("org/aspectj/lang/annotation/Declare" + (deow.isError ? "Error" : "Warning")), elems, true, cg.getConstantPool()); @@ -601,7 +601,7 @@ public class ConcreteAspectCodeGen { // Discover the name and name/value pairs String name = annotationString.substring(0,paren); // break the rest into pieces based on the commas - List<String> values = new ArrayList<String>(); + List<String> values = new ArrayList<>(); int pos = paren+1; int depth = 0; int len = annotationString.length(); @@ -776,7 +776,7 @@ public class ConcreteAspectCodeGen { reportError("declare is using an annotation type that does not have runtime retention: "+typename); return null; } - List<NameValuePair> elems = new ArrayList<NameValuePair>(); + List<NameValuePair> elems = new ArrayList<>(); return new AnnotationGen(new ObjectType(annoname), elems, true, cp); } @@ -820,8 +820,8 @@ public class ConcreteAspectCodeGen { } // Extract parameter types and names - List<Type> paramTypes = new ArrayList<Type>(); - List<String> paramNames = new ArrayList<String>(); + List<Type> paramTypes = new ArrayList<>(); + List<String> paramNames = new ArrayList<>(); if (signature.charAt(1) != ')') { // there are parameters to convert into a signature StringBuilder convertedSignature = new StringBuilder("("); @@ -968,7 +968,7 @@ public class ConcreteAspectCodeGen { */ private AnnotationAJ buildAdviceAnnotation(LazyClassGen cg, PointcutAndAdvice paa) { SimpleElementValue svg = new SimpleElementValue(ElementValue.STRING, cg.getConstantPool(), paa.pointcut); - List<NameValuePair> elems = new ArrayList<NameValuePair>(); + List<NameValuePair> elems = new ArrayList<>(); elems.add(new NameValuePair("value", svg, cg.getConstantPool())); AnnotationGen mag = new AnnotationGen(new ObjectType("org/aspectj/lang/annotation/" + paa.adviceKind.toString()), elems, true, cg.getConstantPool()); diff --git a/loadtime/src/test/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptorTest.java b/loadtime/src/test/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptorTest.java index 3b2ee51e3..77603e12c 100644 --- a/loadtime/src/test/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptorTest.java +++ b/loadtime/src/test/java/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptorTest.java @@ -686,7 +686,7 @@ public class ClassLoaderWeavingAdaptorTest extends TestCase { static class TestWeavingContext extends DefaultWeavingContext { - List<Definition> testList = new ArrayList<Definition>(); + List<Definition> testList = new ArrayList<>(); public TestWeavingContext(ClassLoader loader) { super(loader); |