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 /runtime | |
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 'runtime')
3 files changed, 27 insertions, 27 deletions
diff --git a/runtime/src/main/java/org/aspectj/internal/lang/reflect/AjTypeImpl.java b/runtime/src/main/java/org/aspectj/internal/lang/reflect/AjTypeImpl.java index 542aeb182..2aacae7bf 100644 --- a/runtime/src/main/java/org/aspectj/internal/lang/reflect/AjTypeImpl.java +++ b/runtime/src/main/java/org/aspectj/internal/lang/reflect/AjTypeImpl.java @@ -270,7 +270,7 @@ public class AjTypeImpl<T> implements AjType<T> { */ public Field[] getDeclaredFields() { Field[] fields = clazz.getDeclaredFields(); - List<Field> filteredFields = new ArrayList<Field>(); + List<Field> filteredFields = new ArrayList<>(); for (Field field : fields) if (!field.getName().startsWith(ajcMagic) && !field.isAnnotationPresent(DeclareWarning.class) @@ -296,7 +296,7 @@ public class AjTypeImpl<T> implements AjType<T> { */ public Field[] getFields() { Field[] fields = clazz.getFields(); - List<Field> filteredFields = new ArrayList<Field>(); + List<Field> filteredFields = new ArrayList<>(); for (Field field : fields) if (!field.getName().startsWith(ajcMagic) && !field.isAnnotationPresent(DeclareWarning.class) @@ -331,7 +331,7 @@ public class AjTypeImpl<T> implements AjType<T> { */ public Method[] getDeclaredMethods() { Method[] methods = clazz.getDeclaredMethods(); - List<Method> filteredMethods = new ArrayList<Method>(); + List<Method> filteredMethods = new ArrayList<>(); for (Method method : methods) { if (isReallyAMethod(method)) filteredMethods.add(method); } @@ -345,7 +345,7 @@ public class AjTypeImpl<T> implements AjType<T> { */ public Method[] getMethods() { Method[] methods = clazz.getMethods(); - List<Method> filteredMethods = new ArrayList<Method>(); + List<Method> filteredMethods = new ArrayList<>(); for (Method method : methods) { if (isReallyAMethod(method)) filteredMethods.add(method); } @@ -391,7 +391,7 @@ public class AjTypeImpl<T> implements AjType<T> { */ public Pointcut[] getDeclaredPointcuts() { if (declaredPointcuts != null) return declaredPointcuts; - List<Pointcut> pointcuts = new ArrayList<Pointcut>(); + List<Pointcut> pointcuts = new ArrayList<>(); Method[] methods = clazz.getDeclaredMethods(); for (Method method : methods) { Pointcut pc = asPointcut(method); @@ -408,7 +408,7 @@ public class AjTypeImpl<T> implements AjType<T> { */ public Pointcut[] getPointcuts() { if (pointcuts != null) return pointcuts; - List<Pointcut> pcuts = new ArrayList<Pointcut>(); + List<Pointcut> pcuts = new ArrayList<>(); Method[] methods = clazz.getMethods(); for (Method method : methods) { Pointcut pc = asPointcut(method); @@ -465,7 +465,7 @@ public class AjTypeImpl<T> implements AjType<T> { */ private Advice[] getDeclaredAdvice(Set ofAdviceTypes) { if (declaredAdvice == null) initDeclaredAdvice(); - List<Advice> adviceList = new ArrayList<Advice>(); + List<Advice> adviceList = new ArrayList<>(); for (Advice a : declaredAdvice) { if (ofAdviceTypes.contains(a.getKind())) adviceList.add(a); } @@ -476,7 +476,7 @@ public class AjTypeImpl<T> implements AjType<T> { private void initDeclaredAdvice() { Method[] methods = clazz.getDeclaredMethods(); - List<Advice> adviceList = new ArrayList<Advice>(); + List<Advice> adviceList = new ArrayList<>(); for (Method method : methods) { Advice advice = asAdvice(method); if (advice != null) adviceList.add(advice); @@ -490,7 +490,7 @@ public class AjTypeImpl<T> implements AjType<T> { */ private Advice[] getAdvice(Set ofAdviceTypes) { if (advice == null) initAdvice(); - List<Advice> adviceList = new ArrayList<Advice>(); + List<Advice> adviceList = new ArrayList<>(); for (Advice a : advice) { if (ofAdviceTypes.contains(a.getKind())) adviceList.add(a); } @@ -501,7 +501,7 @@ public class AjTypeImpl<T> implements AjType<T> { private void initAdvice() { Method[] methods = clazz.getMethods(); - List<Advice> adviceList = new ArrayList<Advice>(); + List<Advice> adviceList = new ArrayList<>(); for (Method method : methods) { Advice advice = asAdvice(method); if (advice != null) adviceList.add(advice); @@ -584,7 +584,7 @@ public class AjTypeImpl<T> implements AjType<T> { */ public InterTypeMethodDeclaration[] getDeclaredITDMethods() { if (this.declaredITDMethods == null) { - List<InterTypeMethodDeclaration> itdms = new ArrayList<InterTypeMethodDeclaration>(); + List<InterTypeMethodDeclaration> itdms = new ArrayList<>(); Method[] baseMethods = clazz.getDeclaredMethods(); for (Method m : baseMethods) { if (!m.getName().contains("ajc$interMethodDispatch1$")) continue; @@ -631,7 +631,7 @@ public class AjTypeImpl<T> implements AjType<T> { public InterTypeMethodDeclaration[] getITDMethods() { if (this.itdMethods == null) { - List<InterTypeMethodDeclaration> itdms = new ArrayList<InterTypeMethodDeclaration>(); + List<InterTypeMethodDeclaration> itdms = new ArrayList<>(); Method[] baseMethods = clazz.getDeclaredMethods(); for (Method m : baseMethods) { if (!m.getName().contains("ajc$interMethod$")) continue; @@ -704,7 +704,7 @@ public class AjTypeImpl<T> implements AjType<T> { public InterTypeConstructorDeclaration[] getDeclaredITDConstructors() { if (this.declaredITDCons == null) { - List<InterTypeConstructorDeclaration> itdcs = new ArrayList<InterTypeConstructorDeclaration>(); + List<InterTypeConstructorDeclaration> itdcs = new ArrayList<>(); Method[] baseMethods = clazz.getDeclaredMethods(); for (Method m : baseMethods) { if (!m.getName().contains("ajc$postInterConstructor")) continue; @@ -746,7 +746,7 @@ public class AjTypeImpl<T> implements AjType<T> { public InterTypeConstructorDeclaration[] getITDConstructors() { if (this.itdCons == null) { - List<InterTypeConstructorDeclaration> itdcs = new ArrayList<InterTypeConstructorDeclaration>(); + List<InterTypeConstructorDeclaration> itdcs = new ArrayList<>(); Method[] baseMethods = clazz.getMethods(); for (Method m : baseMethods) { if (!m.getName().contains("ajc$postInterConstructor")) continue; @@ -780,7 +780,7 @@ public class AjTypeImpl<T> implements AjType<T> { } public InterTypeFieldDeclaration[] getDeclaredITDFields() { - List<InterTypeFieldDeclaration> itdfs = new ArrayList<InterTypeFieldDeclaration>(); + List<InterTypeFieldDeclaration> itdfs = new ArrayList<>(); if (this.declaredITDFields == null) { Method[] baseMethods = clazz.getDeclaredMethods(); for(Method m : baseMethods) { @@ -826,7 +826,7 @@ public class AjTypeImpl<T> implements AjType<T> { } public InterTypeFieldDeclaration[] getITDFields() { - List<InterTypeFieldDeclaration> itdfs = new ArrayList<InterTypeFieldDeclaration>(); + List<InterTypeFieldDeclaration> itdfs = new ArrayList<>(); if (this.itdFields == null) { Method[] baseMethods = clazz.getMethods(); for(Method m : baseMethods) { @@ -857,7 +857,7 @@ public class AjTypeImpl<T> implements AjType<T> { } public DeclareErrorOrWarning[] getDeclareErrorOrWarnings() { - List<DeclareErrorOrWarning> deows = new ArrayList<DeclareErrorOrWarning>(); + List<DeclareErrorOrWarning> deows = new ArrayList<>(); for (Field field : clazz.getDeclaredFields()) { try { if (field.isAnnotationPresent(DeclareWarning.class)) { @@ -894,7 +894,7 @@ public class AjTypeImpl<T> implements AjType<T> { } public DeclareParents[] getDeclareParents() { - List<DeclareParents> decps = new ArrayList<DeclareParents>(); + List<DeclareParents> decps = new ArrayList<>(); for (Method method : clazz.getDeclaredMethods()) { if (method.isAnnotationPresent(ajcDeclareParents.class)) { ajcDeclareParents decPAnn = method.getAnnotation(ajcDeclareParents.class); @@ -934,7 +934,7 @@ public class AjTypeImpl<T> implements AjType<T> { } public DeclareSoft[] getDeclareSofts() { - List<DeclareSoft> decs = new ArrayList<DeclareSoft>(); + List<DeclareSoft> decs = new ArrayList<>(); for (Method method : clazz.getDeclaredMethods()) { if (method.isAnnotationPresent(ajcDeclareSoft.class)) { ajcDeclareSoft decSAnn = method.getAnnotation(ajcDeclareSoft.class); @@ -955,7 +955,7 @@ public class AjTypeImpl<T> implements AjType<T> { } public DeclareAnnotation[] getDeclareAnnotations() { - List<DeclareAnnotation> decAs = new ArrayList<DeclareAnnotation>(); + List<DeclareAnnotation> decAs = new ArrayList<>(); for (Method method : clazz.getDeclaredMethods()) { if (method.isAnnotationPresent(ajcDeclareAnnotation.class)) { ajcDeclareAnnotation decAnn = method.getAnnotation(ajcDeclareAnnotation.class); @@ -988,7 +988,7 @@ public class AjTypeImpl<T> implements AjType<T> { } public DeclarePrecedence[] getDeclarePrecedence() { - List<DeclarePrecedence> decps = new ArrayList<DeclarePrecedence>(); + List<DeclarePrecedence> decps = new ArrayList<>(); // @AspectJ Style if (clazz.isAnnotationPresent(org.aspectj.lang.annotation.DeclarePrecedence.class)) { diff --git a/runtime/src/main/java/org/aspectj/lang/reflect/AjTypeSystem.java b/runtime/src/main/java/org/aspectj/lang/reflect/AjTypeSystem.java index 6e525dc0b..2f21ba2ff 100644 --- a/runtime/src/main/java/org/aspectj/lang/reflect/AjTypeSystem.java +++ b/runtime/src/main/java/org/aspectj/lang/reflect/AjTypeSystem.java @@ -26,7 +26,7 @@ import org.aspectj.internal.lang.reflect.AjTypeImpl; public class AjTypeSystem { private static Map<Class, WeakReference<AjType>> ajTypes = - Collections.synchronizedMap(new WeakHashMap<Class,WeakReference<AjType>>()); + Collections.synchronizedMap(new WeakHashMap<>()); /** * Return the AspectJ runtime type representation of the given Java type. @@ -45,14 +45,14 @@ public class AjTypeSystem { if (theAjType != null) { return theAjType; } else { - theAjType = new AjTypeImpl<T>(fromClass); - ajTypes.put(fromClass, new WeakReference<AjType>(theAjType)); + theAjType = new AjTypeImpl<>(fromClass); + ajTypes.put(fromClass, new WeakReference<>(theAjType)); return theAjType; } } // neither key nor value was found - AjType<T> theAjType = new AjTypeImpl<T>(fromClass); - ajTypes.put(fromClass, new WeakReference<AjType>(theAjType)); + AjType<T> theAjType = new AjTypeImpl<>(fromClass); + ajTypes.put(fromClass, new WeakReference<>(theAjType)); return theAjType; } } diff --git a/runtime/src/main/java/org/aspectj/runtime/reflect/JoinPointImpl.java b/runtime/src/main/java/org/aspectj/runtime/reflect/JoinPointImpl.java index 0263ee841..2183a5706 100644 --- a/runtime/src/main/java/org/aspectj/runtime/reflect/JoinPointImpl.java +++ b/runtime/src/main/java/org/aspectj/runtime/reflect/JoinPointImpl.java @@ -149,7 +149,7 @@ class JoinPointImpl implements ProceedingJoinPoint { public void stack$AroundClosure(AroundClosure arc) { // If input parameter arc is null this is the 'unlink' call from AroundClosure if (arcs == null) { - arcs = new Stack<AroundClosure>(); + arcs = new Stack<>(); } if (arc==null) { this.arcs.pop(); |