diff --git a/src/main/java/spoon/ContractVerifier.java b/src/main/java/spoon/ContractVerifier.java index b5f12bd965b..ac967e135fa 100644 --- a/src/main/java/spoon/ContractVerifier.java +++ b/src/main/java/spoon/ContractVerifier.java @@ -415,7 +415,7 @@ public void checkParentConsistency() { public void checkParentConsistency(CtElement element) { final Set inconsistentParents = new HashSet<>(); new CtScanner() { - private Deque previous = new ArrayDeque(); + private Deque previous = new ArrayDeque<>(); @Override protected void enter(CtElement e) { diff --git a/src/main/java/spoon/pattern/internal/matcher/TobeMatched.java b/src/main/java/spoon/pattern/internal/matcher/TobeMatched.java index 7ba84f65e53..f9053109928 100644 --- a/src/main/java/spoon/pattern/internal/matcher/TobeMatched.java +++ b/src/main/java/spoon/pattern/internal/matcher/TobeMatched.java @@ -114,7 +114,7 @@ public List getMatchedTargets(TobeMatched tobeMatchedTargets) { if (nrOfMatches == 0) { return Collections.emptyList(); } - List matched = new ArrayList(nrOfMatches); + List matched = new ArrayList<>(nrOfMatches); for (Object target : getTargets()) { if (containsSame(tobeMatchedTargets.getTargets(), target)) { //this origin target is still available in this to be matched targets diff --git a/src/main/java/spoon/reflect/visitor/ImportCleaner.java b/src/main/java/spoon/reflect/visitor/ImportCleaner.java index 0dfee64eeda..bf9c61ffc8b 100644 --- a/src/main/java/spoon/reflect/visitor/ImportCleaner.java +++ b/src/main/java/spoon/reflect/visitor/ImportCleaner.java @@ -311,8 +311,8 @@ private static String getImportRefID(CtReference ref) { */ private boolean removeAllTypeImportWithPackage(Set imports, String packageName) { boolean found = false; - for (Iterator iter = imports.iterator(); iter.hasNext();) { - CtImport newImport = (CtImport) iter.next(); + for (Iterator iter = imports.iterator(); iter.hasNext();) { + CtImport newImport = iter.next(); if (newImport.getImportKind() == CtImportKind.TYPE) { CtTypeReference typeRef = (CtTypeReference) newImport.getReference(); if (typeRef.getPackage() != null && packageName.equals(typeRef.getPackage().getQualifiedName())) { diff --git a/src/main/java/spoon/support/reflect/declaration/CtAnnotationImpl.java b/src/main/java/spoon/support/reflect/declaration/CtAnnotationImpl.java index 2761a86ec96..88b71d3e7b8 100644 --- a/src/main/java/spoon/support/reflect/declaration/CtAnnotationImpl.java +++ b/src/main/java/spoon/support/reflect/declaration/CtAnnotationImpl.java @@ -352,7 +352,7 @@ public Map getValues() { @Override public Map getAllValues() { - Map values = new TreeMap(); + Map values = new TreeMap<>(); // first, we put the default values CtAnnotationType annotationType = (CtAnnotationType) getAnnotationType().getTypeDeclaration(); for (CtAnnotationMethod m : annotationType.getAnnotationMethods()) { diff --git a/src/main/java/spoon/support/reflect/declaration/CtElementImpl.java b/src/main/java/spoon/support/reflect/declaration/CtElementImpl.java index 5866c49104a..a83e26d59fd 100644 --- a/src/main/java/spoon/support/reflect/declaration/CtElementImpl.java +++ b/src/main/java/spoon/support/reflect/declaration/CtElementImpl.java @@ -506,7 +506,7 @@ public Map getAllMetadata() { @Override public Set getMetadataKeys() { if (metadata == null) { - return Collections.EMPTY_SET; + return Collections.emptySet(); } return metadata.keySet(); } diff --git a/src/main/java/spoon/support/sniper/internal/ChangeResolver.java b/src/main/java/spoon/support/sniper/internal/ChangeResolver.java index 14baa6f4051..5ca9078c20c 100644 --- a/src/main/java/spoon/support/sniper/internal/ChangeResolver.java +++ b/src/main/java/spoon/support/sniper/internal/ChangeResolver.java @@ -30,7 +30,7 @@ public class ChangeResolver { public ChangeResolver(ChangeCollector changeCollector, CtElement element) { this.changeCollector = changeCollector; this.element = element; - changedRoles = element != null ? changeCollector.getChanges(element) : Collections.EMPTY_SET; + changedRoles = element != null ? changeCollector.getChanges(element) : Collections.emptySet(); } /** diff --git a/src/main/java/spoon/support/visitor/ClassTypingContext.java b/src/main/java/spoon/support/visitor/ClassTypingContext.java index 4f0665283f0..2817ae367af 100644 --- a/src/main/java/spoon/support/visitor/ClassTypingContext.java +++ b/src/main/java/spoon/support/visitor/ClassTypingContext.java @@ -710,7 +710,7 @@ private boolean isSameSignatureLikeScopeMethod(CtExecutable thatExecutable, b if (actualTA instanceof CtWildcardReference) { CtWildcardReference wildcardReference = (CtWildcardReference) actualTA; if (wildcardReference.isDefaultBoundingType()) { - thatType.setActualTypeArguments(Collections.EMPTY_LIST); + thatType.setActualTypeArguments(Collections.emptyList()); } } }