diff options
author | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-15 17:01:46 +0200 |
---|---|---|
committer | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-15 17:01:46 +0200 |
commit | 639f5030e0391e831138f9786cf831c3374449e7 (patch) | |
tree | fc4e616cb6df8e73722a6d0cf83a55efd6d87387 /weaver | |
parent | 2409bcbc7c9606b055e23f52d688eecda84351d6 (diff) | |
download | aspectj-639f5030e0391e831138f9786cf831c3374449e7.tar.gz aspectj-639f5030e0391e831138f9786cf831c3374449e7.zip |
Weaken Collection declarations
Reports on declarations of Collection variables made by using the collection class as the type, rather than an appropriate interface.
Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
Diffstat (limited to 'weaver')
5 files changed, 24 insertions, 24 deletions
diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeaver.java index b80080ec1..110d58c88 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeaver.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeaver.java @@ -946,7 +946,7 @@ public class BcelWeaver { manifest = new Manifest(); - Attributes attributes = manifest.getMainAttributes(); + Map attributes = manifest.getMainAttributes(); attributes.put(Name.MANIFEST_VERSION, WEAVER_MANIFEST_VERSION); attributes.put(CREATED_BY, WEAVER_CREATED_BY); } diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java b/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java index cd378dbbf..76acc6e7f 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java @@ -352,12 +352,12 @@ public class ClassPathManager { FileSystem fs = null; try { if (LangUtil.is19VMOrGreater()) { - HashMap<String, String> env = new HashMap<>(); + Map<String, String> env = new HashMap<>(); env.put("java.home", jdkHome); fs = FileSystems.newFileSystem(JRT_URI, env); } else { URLClassLoader loader = new URLClassLoader(new URL[] { jrtPath }); - HashMap<String, ?> env = new HashMap<>(); + Map<String, ?> env = new HashMap<>(); fs = FileSystems.newFileSystem(JRT_URI, env, loader); } state = new JImageState(jrtFsPath, fs); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java index 7e2541e6c..7bac02dad 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java @@ -1359,7 +1359,7 @@ public final class LazyMethodGen implements Traceable { } private void addExceptionHandlers(MethodGen gen, Map<InstructionHandle, InstructionHandle> map, - LinkedList<ExceptionRange> exnList) { + Iterable<ExceptionRange> exnList) { // now add exception handlers for (ExceptionRange r : exnList) { if (r.isEmpty()) { @@ -1547,7 +1547,7 @@ public final class LazyMethodGen implements Traceable { // but I don't trust the only implementation, TreeSet, to do the right // thing. - /* private */static void insertHandler(ExceptionRange fresh, LinkedList<ExceptionRange> l) { + /* private */static void insertHandler(ExceptionRange fresh, List<ExceptionRange> l) { // Old implementation, simply: l.add(0,fresh); for (ListIterator<ExceptionRange> iter = l.listIterator(); iter.hasNext();) { ExceptionRange r = iter.next(); diff --git a/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/SimpleAOPParser.java b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/SimpleAOPParser.java index e49988a89..8d912a317 100644 --- a/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/SimpleAOPParser.java +++ b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/SimpleAOPParser.java @@ -253,7 +253,7 @@ public class SimpleAOPParser { private static void traverse(SimpleAOPParser sap, LightXMLParser xml) throws Exception { sap.startElement(xml.getName(), xml.getAttributes()); - ArrayList childrens = xml.getChildrens(); + Iterable childrens = xml.getChildrens(); for (Object children : childrens) { LightXMLParser child = (LightXMLParser) children; traverse(sap, child); diff --git a/weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java b/weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java index f9b020272..fbe505292 100644 --- a/weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java +++ b/weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java @@ -191,13 +191,13 @@ public class ReferenceTypeTestCase extends TestCase { public void testAssignable02() { List list = new ArrayList(); - ArrayList arraylist = null; + List arraylist = null; List<String> listOfString = new ArrayList<>(); List<?> listOfSomething = new ArrayList<Integer>(); - ArrayList<?> arrayListOfSomething = null; + List<?> arrayListOfSomething = null; List<Number> listOfNumber = null; ArrayList<Number> arrayListOfNumber = null; - ArrayList<? extends Number> arrayListOfSomethingNumberish = null; + List<? extends Number> arrayListOfSomethingNumberish = null; List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>(); List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>(); List<Integer> listOfInteger = new ArrayList<>(); @@ -274,14 +274,14 @@ public class ReferenceTypeTestCase extends TestCase { public void testAssignable03_method_m2() { List list = new ArrayList(); - ArrayList arraylist = null; + List arraylist = null; List<String> listOfString = new ArrayList<>(); List<?> listOfSomething = new ArrayList<Integer>(); - ArrayList<?> arrayListOfSomething = null; + List<?> arrayListOfSomething = null; List<Number> listOfNumber = null; - ArrayList<Number> arrayListOfNumber = null; - ArrayList<Integer> arrayListOfInteger = null; - ArrayList<? extends Number> arrayListOfSomethingNumberish = null; + List<Number> arrayListOfNumber = null; + List<Integer> arrayListOfInteger = null; + List<? extends Number> arrayListOfSomethingNumberish = null; List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>(); List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>(); List<Integer> listOfInteger = new ArrayList<>(); @@ -364,15 +364,15 @@ public class ReferenceTypeTestCase extends TestCase { ArrayList arraylist = null; List<String> listOfString = new ArrayList<>(); List<?> listOfSomething = new ArrayList<Integer>(); - ArrayList<?> arrayListOfSomething = null; + List<?> arrayListOfSomething = null; List<Number> listOfNumber = null; - ArrayList<Number> arrayListOfNumber = null; + List<Number> arrayListOfNumber = null; ArrayList<Integer> arrayListOfInteger = null; - ArrayList<? extends Number> arrayListOfSomethingNumberish = null; + List<? extends Number> arrayListOfSomethingNumberish = null; List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>(); List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>(); List<Integer> listOfInteger = new ArrayList<>(); - ArrayList arrayList = null; + List arrayList = null; ArrayList<String> arrayListOfString; ArrayList<Integer> arraylistOfInteger; // interfaces too List<? extends A,B> @@ -477,18 +477,18 @@ public class ReferenceTypeTestCase extends TestCase { public void testAssignable03_method_m4() { List list = new ArrayList(); - ArrayList arraylist = null; + List arraylist = null; List<String> listOfString = new ArrayList<>(); List<?> listOfSomething = new ArrayList<Integer>(); - ArrayList<?> arrayListOfSomething = null; + List<?> arrayListOfSomething = null; List<Number> listOfNumber = null; - ArrayList<Number> arrayListOfNumber = null; - ArrayList<? extends Number> arrayListOfSomethingNumberish = null; + List<Number> arrayListOfNumber = null; + List<? extends Number> arrayListOfSomethingNumberish = null; List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>(); List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>(); List<Integer> listOfInteger = new ArrayList<>(); - ArrayList<String> arrayListOfString; - ArrayList<Integer> arraylistOfInteger; + List<String> arrayListOfString; + List<Integer> arraylistOfInteger; // interfaces too List<? extends A,B> ReferenceType ajArrayListOfString = resolve("Pjava/util/ArrayList<Ljava/lang/String;>;"); |