aboutsummaryrefslogtreecommitdiffstats
path: root/bcel-builder/src/main
diff options
context:
space:
mode:
authorLars Grefer <eclipse@larsgrefer.de>2020-08-15 17:01:46 +0200
committerLars Grefer <eclipse@larsgrefer.de>2020-08-15 17:01:46 +0200
commit639f5030e0391e831138f9786cf831c3374449e7 (patch)
treefc4e616cb6df8e73722a6d0cf83a55efd6d87387 /bcel-builder/src/main
parent2409bcbc7c9606b055e23f52d688eecda84351d6 (diff)
downloadaspectj-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 'bcel-builder/src/main')
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/FieldGenOrMethodGen.java4
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionList.java9
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/MethodGen.java14
-rw-r--r--bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassPath.java10
4 files changed, 13 insertions, 24 deletions
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/FieldGenOrMethodGen.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/FieldGenOrMethodGen.java
index c8e1fe2fb..5b4256685 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/FieldGenOrMethodGen.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/FieldGenOrMethodGen.java
@@ -76,8 +76,8 @@ public abstract class FieldGenOrMethodGen extends Modifiers {
protected String name;
protected Type type;
protected ConstantPool cp;
- private ArrayList<Attribute> attributeList = new ArrayList<>();
- protected ArrayList<AnnotationGen> annotationList = new ArrayList<>();
+ private List<Attribute> attributeList = new ArrayList<>();
+ protected List<AnnotationGen> annotationList = new ArrayList<>();
protected FieldGenOrMethodGen() {
}
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionList.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionList.java
index 156adf0ad..7938218bc 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionList.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/InstructionList.java
@@ -58,10 +58,7 @@ import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Set;
+import java.util.*;
import org.aspectj.apache.bcel.Constants;
import org.aspectj.apache.bcel.classfile.Constant;
@@ -690,7 +687,7 @@ public class InstructionList implements Serializable {
return;
}
- ArrayList<InstructionHandle> target_vec = new ArrayList<>();
+ List<InstructionHandle> target_vec = new ArrayList<>();
for (InstructionHandle ih = first; ih != null; ih = ih.next) {
ih.getInstruction().dispose(); // e.g. BranchInstructions release their targets
@@ -1003,7 +1000,7 @@ public class InstructionList implements Serializable {
*/
public Instruction[] getInstructions() {
ByteSequence bytes = new ByteSequence(getByteCode());
- ArrayList<Instruction> instructions = new ArrayList<>();
+ List<Instruction> instructions = new ArrayList<>();
try {
while (bytes.available() > 0) {
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/MethodGen.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/MethodGen.java
index cf8c06834..453fe7c1f 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/MethodGen.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/MethodGen.java
@@ -54,11 +54,7 @@ package org.aspectj.apache.bcel.generic;
* <http://www.apache.org/>.
*/
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Stack;
+import java.util.*;
import org.aspectj.apache.bcel.Constants;
import org.aspectj.apache.bcel.classfile.Attribute;
@@ -103,11 +99,11 @@ public class MethodGen extends FieldGenOrMethodGen {
private int highestLineNumber = 0;
- private ArrayList<LocalVariableGen> localVariablesList = new ArrayList<>();
- private ArrayList<LineNumberGen> lineNumbersList = new ArrayList<>();
+ private List<LocalVariableGen> localVariablesList = new ArrayList<>();
+ private List<LineNumberGen> lineNumbersList = new ArrayList<>();
private ArrayList<CodeExceptionGen> exceptionsList = new ArrayList<>();
private ArrayList<String> exceptionsThrown = new ArrayList<>();
- private ArrayList<Attribute> codeAttributesList = new ArrayList<>();
+ private List<Attribute> codeAttributesList = new ArrayList<>();
private List<AnnotationGen>[] param_annotations; // Array of lists containing AnnotationGen objects
private boolean hasParameterAnnotations = false;
private boolean haveUnpackedParameterAnnotations = false;
@@ -934,7 +930,7 @@ public class MethodGen extends FieldGenOrMethodGen {
static final class BranchStack {
Stack<BranchTarget> branchTargets = new Stack<>();
- Hashtable<InstructionHandle, BranchTarget> visitedTargets = new Hashtable<>();
+ Map<InstructionHandle, BranchTarget> visitedTargets = new Hashtable<>();
public void push(InstructionHandle target, int stackDepth) {
if (visited(target)) {
diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassPath.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassPath.java
index 179800540..678abb1dc 100644
--- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassPath.java
+++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/util/ClassPath.java
@@ -69,11 +69,7 @@ import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributeView;
import java.nio.file.attribute.BasicFileAttributes;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.StringTokenizer;
+import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@@ -106,7 +102,7 @@ public class ClassPath implements Serializable {
public ClassPath(String class_path) {
this.class_path = class_path;
- ArrayList<PathEntry> vec = new ArrayList<>();
+ List<PathEntry> vec = new ArrayList<>();
for (StringTokenizer tok = new StringTokenizer(class_path, System.getProperty("path.separator")); tok
.hasMoreTokens();) {
@@ -167,7 +163,7 @@ public class ClassPath implements Serializable {
return false;
}
- private static final void getPathComponents(String path, ArrayList<String> list) {
+ private static final void getPathComponents(String path, List<String> list) {
if (path != null) {
StringTokenizer tok = new StringTokenizer(path, File.pathSeparator);