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 /asm | |
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 'asm')
5 files changed, 34 insertions, 34 deletions
diff --git a/asm/src/main/java/org/aspectj/asm/AsmManager.java b/asm/src/main/java/org/aspectj/asm/AsmManager.java index b8a8989cb..dc766eb7f 100644 --- a/asm/src/main/java/org/aspectj/asm/AsmManager.java +++ b/asm/src/main/java/org/aspectj/asm/AsmManager.java @@ -73,7 +73,7 @@ public class AsmManager implements IStructureModel { private static boolean completingTypeBindings = false; - private final List<IHierarchyListener> structureListeners = new ArrayList<IHierarchyListener>(); + private final List<IHierarchyListener> structureListeners = new ArrayList<>(); // The model is 'manipulated' by the AjBuildManager.setupModel() code which // trashes all the @@ -95,10 +95,10 @@ public class AsmManager implements IStructureModel { private final CanonicalFilePathMap canonicalFilePathMap = new CanonicalFilePathMap(); // Record the Set<File> for which the model has been modified during the // last incremental build - private final Set<File> lastBuildChanges = new HashSet<File>(); + private final Set<File> lastBuildChanges = new HashSet<>(); // Record the Set<File> of aspects that wove the files listed in lastBuildChanges - final Set<File> aspectsWeavingInLastBuild = new HashSet<File>(); + final Set<File> aspectsWeavingInLastBuild = new HashSet<>(); // static { // setReporting("c:/model.nfo",true,true,true,true); @@ -149,16 +149,16 @@ public class AsmManager implements IStructureModel { return null; } - HashMap<Integer, List<IProgramElement>> annotations = new HashMap<Integer, List<IProgramElement>>(); + HashMap<Integer, List<IProgramElement>> annotations = new HashMap<>(); IProgramElement node = hierarchy.findElementForSourceFile(sourceFile); if (node == IHierarchy.NO_STRUCTURE) { return null; } else { IProgramElement fileNode = node; - ArrayList<IProgramElement> peNodes = new ArrayList<IProgramElement>(); + ArrayList<IProgramElement> peNodes = new ArrayList<>(); getAllStructureChildren(fileNode, peNodes, showSubMember, showMemberAndType); for (IProgramElement peNode : peNodes) { - List<IProgramElement> entries = new ArrayList<IProgramElement>(); + List<IProgramElement> entries = new ArrayList<>(); entries.add(peNode); ISourceLocation sourceLoc = peNode.getSourceLocation(); if (null != sourceLoc) { @@ -296,7 +296,7 @@ public class AsmManager implements IStructureModel { private static class CanonicalFilePathMap { private static final int MAX_SIZE = 4000; - private final Map<String, String> pathMap = new HashMap<String, String>(20); + private final Map<String, String> pathMap = new HashMap<>(20); // // guards to ensure correctness and liveness // private boolean cacheInUse = false; @@ -549,7 +549,7 @@ public class AsmManager implements IStructureModel { boolean modelModified = false; - Set<String> deletedNodes = new HashSet<String>(); + Set<String> deletedNodes = new HashSet<>(); for (File fileForCompilation : files) { String correctedPath = getCanonicalFilePath(fileForCompilation); IProgramElement progElem = (IProgramElement) hierarchy.findInFileMap(correctedPath); @@ -690,15 +690,15 @@ public class AsmManager implements IStructureModel { return; } - Set<String> sourcesToRemove = new HashSet<String>(); - Map<String, String> handleToTypenameCache = new HashMap<String, String>(); + Set<String> sourcesToRemove = new HashSet<>(); + Map<String, String> handleToTypenameCache = new HashMap<>(); // Iterate over the source handles in the relationships map, the aim // here is to remove any 'affected by' // relationships where the source of the relationship is the specified // type (since it will be readded // when the type is woven) Set<String> sourcehandlesSet = mapper.getEntries(); - List<IRelationship> relationshipsToRemove = new ArrayList<IRelationship>(); + List<IRelationship> relationshipsToRemove = new ArrayList<>(); for (String hid : sourcehandlesSet) { if (isPhantomHandle(hid)) { // inpath handle - but for which type? @@ -780,7 +780,7 @@ public class AsmManager implements IStructureModel { continue; } List<String> targets = rel.getTargets(); - List<String> targetsToRemove = new ArrayList<String>(); + List<String> targetsToRemove = new ArrayList<>(); // find targets that target the type we are interested in, // they need removing @@ -928,8 +928,8 @@ public class AsmManager implements IStructureModel { // Now sort out the relationships map // IRelationshipMap irm = AsmManager.getDefault().getRelationshipMap(); - Set<String> sourcesToRemove = new HashSet<String>(); - Set<String> nonExistingHandles = new HashSet<String>(); // Cache of handles that we + Set<String> sourcesToRemove = new HashSet<>(); + Set<String> nonExistingHandles = new HashSet<>(); // Cache of handles that we // *know* are invalid // int srchandlecounter = 0; // int tgthandlecounter = 0; @@ -956,12 +956,12 @@ public class AsmManager implements IStructureModel { } else { // Ok, so the source is valid, what about the targets? List<IRelationship> relationships = mapper.get(hid); - List<IRelationship> relationshipsToRemove = new ArrayList<IRelationship>(); + List<IRelationship> relationshipsToRemove = new ArrayList<>(); // Iterate through the relationships against this source // handle for (IRelationship rel : relationships) { List<String> targets = rel.getTargets(); - List<String> targetsToRemove = new ArrayList<String>(); + List<String> targetsToRemove = new ArrayList<>(); // Iterate through the targets for this relationship for (String targethid : targets) { @@ -1168,7 +1168,7 @@ public class AsmManager implements IStructureModel { * A ModelInfo object captures basic information about the structure model. It is used for testing and producing debug info. */ public static class ModelInfo { - private final Hashtable<String, Integer> nodeTypeCount = new Hashtable<String, Integer>(); + private final Hashtable<String, Integer> nodeTypeCount = new Hashtable<>(); private final Properties extraProperties = new Properties(); private ModelInfo(IHierarchy hierarchy, IRelationshipMap relationshipMap) { diff --git a/asm/src/main/java/org/aspectj/asm/IProgramElement.java b/asm/src/main/java/org/aspectj/asm/IProgramElement.java index 402376217..8d4766681 100644 --- a/asm/src/main/java/org/aspectj/asm/IProgramElement.java +++ b/asm/src/main/java/org/aspectj/asm/IProgramElement.java @@ -349,7 +349,7 @@ public interface IProgramElement extends Serializable { } public static List<Kind> getNonAJMemberKinds() { - List<Kind> list = new ArrayList<Kind>(); + List<Kind> list = new ArrayList<>(); list.add(METHOD); list.add(ENUM_VALUE); list.add(FIELD); diff --git a/asm/src/main/java/org/aspectj/asm/internal/AspectJElementHierarchy.java b/asm/src/main/java/org/aspectj/asm/internal/AspectJElementHierarchy.java index 6019964c6..869affd91 100644 --- a/asm/src/main/java/org/aspectj/asm/internal/AspectJElementHierarchy.java +++ b/asm/src/main/java/org/aspectj/asm/internal/AspectJElementHierarchy.java @@ -43,7 +43,7 @@ public class AspectJElementHierarchy implements IHierarchy { // Access to the handleMap and typeMap are now synchronized - at least the find methods and the updateHandleMap function // see pr305788 private Map<String, IProgramElement> fileMap = null; - private Map<String, IProgramElement> handleMap = new HashMap<String, IProgramElement>(); + private Map<String, IProgramElement> handleMap = new HashMap<>(); private Map<String, IProgramElement> typeMap = null; public AspectJElementHierarchy(AsmManager asm) { @@ -84,8 +84,8 @@ public class AspectJElementHierarchy implements IHierarchy { public void setRoot(IProgramElement root) { this.root = root; - handleMap = new HashMap<String, IProgramElement>(); - typeMap = new HashMap<String, IProgramElement>(); + handleMap = new HashMap<>(); + typeMap = new HashMap<>(); } public void addToFileMap(String key, IProgramElement value) { @@ -230,7 +230,7 @@ public class AspectJElementHierarchy implements IHierarchy { if ((children.get(0)).getKind() == IProgramElement.Kind.SOURCE_FOLDER) { String searchPackageName = (packagename == null ? "" : packagename); // default package means match on "" // dealing with source folders - List<IProgramElement> matchingPackageNodes = new ArrayList<IProgramElement>(); + List<IProgramElement> matchingPackageNodes = new ArrayList<>(); for (IProgramElement sourceFolder : children) { List<IProgramElement> possiblePackageNodes = sourceFolder.getChildren(); for (IProgramElement possiblePackageNode : possiblePackageNodes) { @@ -248,11 +248,11 @@ public class AspectJElementHierarchy implements IHierarchy { // thing to return in the list if (packagename == null) { // default package - List<IProgramElement> result = new ArrayList<IProgramElement>(); + List<IProgramElement> result = new ArrayList<>(); result.add(root); return result; } - List<IProgramElement> result = new ArrayList<IProgramElement>(); + List<IProgramElement> result = new ArrayList<>(); for (IProgramElement possiblePackage : children) { if (possiblePackage.getKind() == IProgramElement.Kind.PACKAGE && possiblePackage.getName().equals(packagename)) { result.add(possiblePackage); @@ -643,7 +643,7 @@ public class AspectJElementHierarchy implements IHierarchy { // TODO rename this method ... it does more than just the handle map public void updateHandleMap(Set<String> deletedFiles) { // Only delete the entries we need to from the handle map - for performance reasons - List<String> forRemoval = new ArrayList<String>(); + List<String> forRemoval = new ArrayList<>(); Set<String> k = null; synchronized (this) { k = handleMap.keySet(); diff --git a/asm/src/main/java/org/aspectj/asm/internal/ProgramElement.java b/asm/src/main/java/org/aspectj/asm/internal/ProgramElement.java index 9842830cb..8c13747be 100644 --- a/asm/src/main/java/org/aspectj/asm/internal/ProgramElement.java +++ b/asm/src/main/java/org/aspectj/asm/internal/ProgramElement.java @@ -223,7 +223,7 @@ public class ProgramElement implements IProgramElement { } private static List<IProgramElement.Modifiers> genModifiers(int modifiers) { - List<IProgramElement.Modifiers> modifiersList = new ArrayList<IProgramElement.Modifiers>(); + List<IProgramElement.Modifiers> modifiersList = new ArrayList<>(); if ((modifiers & AccStatic) != 0) { modifiersList.add(IProgramElement.Modifiers.STATIC); } @@ -551,7 +551,7 @@ public class ProgramElement implements IProgramElement { public void addChild(IProgramElement child) { if (children == null || children == Collections.EMPTY_LIST) { - children = new ArrayList<IProgramElement>(); + children = new ArrayList<>(); } children.add(child); child.setParent(this); @@ -559,7 +559,7 @@ public class ProgramElement implements IProgramElement { public void addChild(int position, IProgramElement child) { if (children == null || children == Collections.EMPTY_LIST) { - children = new ArrayList<IProgramElement>(); + children = new ArrayList<>(); } children.add(position, child); child.setParent(this); @@ -750,7 +750,7 @@ public class ProgramElement implements IProgramElement { if (l == null || l.isEmpty()) { return Collections.emptyList(); } - List<char[]> params = new ArrayList<char[]>(); + List<char[]> params = new ArrayList<>(); for (char[] param : l) { params.add(NameConvertor.convertFromSignature(param)); } @@ -805,7 +805,7 @@ public class ProgramElement implements IProgramElement { private void fixMap() { if (kvpairs == Collections.EMPTY_MAP) { - kvpairs = new HashMap<String, Object>(); + kvpairs = new HashMap<>(); } } diff --git a/asm/src/main/java/org/aspectj/asm/internal/RelationshipMap.java b/asm/src/main/java/org/aspectj/asm/internal/RelationshipMap.java index 0df2fdd89..5a5e18b46 100644 --- a/asm/src/main/java/org/aspectj/asm/internal/RelationshipMap.java +++ b/asm/src/main/java/org/aspectj/asm/internal/RelationshipMap.java @@ -55,8 +55,8 @@ public class RelationshipMap extends HashMap<String, List<IRelationship>> implem if (!createIfMissing) { return null; } - relationships = new ArrayList<IRelationship>(); - IRelationship rel = new Relationship(relationshipName, kind, source, new ArrayList<String>(), runtimeTest); + relationships = new ArrayList<>(); + IRelationship rel = new Relationship(relationshipName, kind, source, new ArrayList<>(), runtimeTest); relationships.add(rel); super.put(source, relationships); @@ -70,7 +70,7 @@ public class RelationshipMap extends HashMap<String, List<IRelationship>> implem if (createIfMissing) { // At this point we did find some relationships for 'source' but not one that looks like what we are // after (either the kind or the name or the dynamictests setting don't match) - IRelationship rel = new Relationship(relationshipName, kind, source, new ArrayList<String>(), runtimeTest); + IRelationship rel = new Relationship(relationshipName, kind, source, new ArrayList<>(), runtimeTest); relationships.add(rel); return rel; } @@ -112,7 +112,7 @@ public class RelationshipMap extends HashMap<String, List<IRelationship>> implem List<IRelationship> existingRelationships = super.get(source); if (existingRelationships == null) { // new entry - existingRelationships = new ArrayList<IRelationship>(); + existingRelationships = new ArrayList<>(); existingRelationships.add(relationship); super.put(source, existingRelationships); } else { |