explicit types to diamonds
This commit is contained in:
@@ -42,11 +42,11 @@ public class ContextUnit {
|
||||
private final IResultSaver resultSaver;
|
||||
private final IDecompiledData decompiledData;
|
||||
|
||||
private final List<String> classEntries = new ArrayList<String>(); // class file or jar/zip entry
|
||||
private final List<String> dirEntries = new ArrayList<String>();
|
||||
private final List<String[]> otherEntries = new ArrayList<String[]>();
|
||||
private final List<String> classEntries = new ArrayList<>(); // class file or jar/zip entry
|
||||
private final List<String> dirEntries = new ArrayList<>();
|
||||
private final List<String[]> otherEntries = new ArrayList<>();
|
||||
|
||||
private List<StructClass> classes = new ArrayList<StructClass>();
|
||||
private List<StructClass> classes = new ArrayList<>();
|
||||
private Manifest manifest;
|
||||
|
||||
public ContextUnit(int type, String archivePath, String filename, boolean own, IResultSaver resultSaver, IDecompiledData decompiledData) {
|
||||
@@ -72,7 +72,7 @@ public class ContextUnit {
|
||||
}
|
||||
|
||||
public void reload(LazyLoader loader) throws IOException {
|
||||
List<StructClass> lstClasses = new ArrayList<StructClass>();
|
||||
List<StructClass> lstClasses = new ArrayList<>();
|
||||
|
||||
for (StructClass cl : classes) {
|
||||
String oldName = cl.qualifiedName;
|
||||
|
||||
@@ -93,7 +93,7 @@ public class StructClass extends StructMember {
|
||||
|
||||
// fields
|
||||
length = in.readUnsignedShort();
|
||||
fields = new VBStyleCollection<StructField, String>();
|
||||
fields = new VBStyleCollection<>();
|
||||
for (int i = 0; i < length; i++) {
|
||||
StructField field = new StructField(in, this);
|
||||
fields.addWithKey(field, InterpreterUtil.makeUniqueKey(field.getName(), field.getDescriptor()));
|
||||
@@ -101,7 +101,7 @@ public class StructClass extends StructMember {
|
||||
|
||||
// methods
|
||||
length = in.readUnsignedShort();
|
||||
methods = new VBStyleCollection<StructMethod, String>();
|
||||
methods = new VBStyleCollection<>();
|
||||
for (int i = 0; i < length; i++) {
|
||||
StructMethod method = new StructMethod(in, this);
|
||||
methods.addWithKey(method, InterpreterUtil.makeUniqueKey(method.getName(), method.getDescriptor()));
|
||||
|
||||
@@ -35,8 +35,8 @@ public class StructContext {
|
||||
private final IResultSaver saver;
|
||||
private final IDecompiledData decompiledData;
|
||||
private final LazyLoader loader;
|
||||
private final Map<String, ContextUnit> units = new HashMap<String, ContextUnit>();
|
||||
private final Map<String, StructClass> classes = new HashMap<String, StructClass>();
|
||||
private final Map<String, ContextUnit> units = new HashMap<>();
|
||||
private final Map<String, StructClass> classes = new HashMap<>();
|
||||
|
||||
public StructContext(IResultSaver saver, IDecompiledData decompiledData, LazyLoader loader) {
|
||||
this.saver = saver;
|
||||
|
||||
@@ -47,7 +47,7 @@ public class StructMember {
|
||||
}
|
||||
|
||||
protected VBStyleCollection<StructGeneralAttribute, String> readAttributes(DataInputFullStream in, ConstantPool pool) throws IOException {
|
||||
VBStyleCollection<StructGeneralAttribute, String> attributes = new VBStyleCollection<StructGeneralAttribute, String>();
|
||||
VBStyleCollection<StructGeneralAttribute, String> attributes = new VBStyleCollection<>();
|
||||
|
||||
int length = in.readUnsignedShort();
|
||||
for (int i = 0; i < length; i++) {
|
||||
|
||||
@@ -119,7 +119,7 @@ public class StructMethod extends StructMember {
|
||||
|
||||
@SuppressWarnings("AssignmentToForLoopParameter")
|
||||
private InstructionSequence parseBytecode(DataInputFullStream in, int length, ConstantPool pool) throws IOException {
|
||||
VBStyleCollection<Instruction, Integer> instructions = new VBStyleCollection<Instruction, Integer>();
|
||||
VBStyleCollection<Instruction, Integer> instructions = new VBStyleCollection<>();
|
||||
|
||||
int bytecode_version = classStruct.getBytecodeVersion();
|
||||
|
||||
@@ -137,7 +137,7 @@ public class StructMethod extends StructMember {
|
||||
opcode = in.readUnsignedByte();
|
||||
}
|
||||
|
||||
List<Integer> operands = new ArrayList<Integer>();
|
||||
List<Integer> operands = new ArrayList<>();
|
||||
|
||||
if (opcode >= opc_iconst_m1 && opcode <= opc_iconst_5) {
|
||||
operands.add(new Integer(opr_iconst[opcode - opc_iconst_m1]));
|
||||
@@ -331,7 +331,7 @@ public class StructMethod extends StructMember {
|
||||
}
|
||||
|
||||
// initialize exception table
|
||||
List<ExceptionHandler> lstHandlers = new ArrayList<ExceptionHandler>();
|
||||
List<ExceptionHandler> lstHandlers = new ArrayList<>();
|
||||
|
||||
int exception_count = in.readUnsignedShort();
|
||||
for (int i = 0; i < exception_count; i++) {
|
||||
|
||||
@@ -39,7 +39,7 @@ public class StructAnnotationAttribute extends StructGeneralAttribute {
|
||||
public static List<AnnotationExprent> parseAnnotations(ConstantPool pool, DataInputStream data) throws IOException {
|
||||
int len = data.readUnsignedShort();
|
||||
if (len > 0) {
|
||||
List<AnnotationExprent> annotations = new ArrayList<AnnotationExprent>(len);
|
||||
List<AnnotationExprent> annotations = new ArrayList<>(len);
|
||||
for (int i = 0; i < len; i++) {
|
||||
annotations.add(parseAnnotation(data, pool));
|
||||
}
|
||||
@@ -57,8 +57,8 @@ public class StructAnnotationAttribute extends StructGeneralAttribute {
|
||||
List<Exprent> values;
|
||||
int len = data.readUnsignedShort();
|
||||
if (len > 0) {
|
||||
names = new ArrayList<String>(len);
|
||||
values = new ArrayList<Exprent>(len);
|
||||
names = new ArrayList<>(len);
|
||||
values = new ArrayList<>(len);
|
||||
for (int i = 0; i < len; i++) {
|
||||
names.add(pool.getPrimitiveConstant(data.readUnsignedShort()).getString());
|
||||
values.add(parseAnnotationElement(data, pool));
|
||||
@@ -127,7 +127,7 @@ public class StructAnnotationAttribute extends StructGeneralAttribute {
|
||||
List<Exprent> elements = Collections.emptyList();
|
||||
int len = data.readUnsignedShort();
|
||||
if (len > 0) {
|
||||
elements = new ArrayList<Exprent>(len);
|
||||
elements = new ArrayList<>(len);
|
||||
for (int i = 0; i < len; i++) {
|
||||
elements.add(parseAnnotationElement(data, pool));
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class StructAnnotationParameterAttribute extends StructGeneralAttribute {
|
||||
|
||||
int len = data.readUnsignedByte();
|
||||
if (len > 0) {
|
||||
paramAnnotations = new ArrayList<List<AnnotationExprent>>(len);
|
||||
paramAnnotations = new ArrayList<>(len);
|
||||
for (int i = 0; i < len; i++) {
|
||||
List<AnnotationExprent> annotations = StructAnnotationAttribute.parseAnnotations(pool, data);
|
||||
paramAnnotations.add(annotations);
|
||||
|
||||
@@ -26,8 +26,8 @@ import java.util.List;
|
||||
|
||||
public class StructBootstrapMethodsAttribute extends StructGeneralAttribute {
|
||||
|
||||
private final List<LinkConstant> methodRefs = new ArrayList<LinkConstant>();
|
||||
private final List<List<PooledConstant>> methodArguments = new ArrayList<List<PooledConstant>>();
|
||||
private final List<LinkConstant> methodRefs = new ArrayList<>();
|
||||
private final List<List<PooledConstant>> methodArguments = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void initContent(ConstantPool pool) throws IOException {
|
||||
@@ -39,7 +39,7 @@ public class StructBootstrapMethodsAttribute extends StructGeneralAttribute {
|
||||
int bootstrap_method_ref = data.readUnsignedShort();
|
||||
int num_bootstrap_arguments = data.readUnsignedShort();
|
||||
|
||||
List<PooledConstant> list_arguments = new ArrayList<PooledConstant>();
|
||||
List<PooledConstant> list_arguments = new ArrayList<>();
|
||||
|
||||
for (int j = 0; j < num_bootstrap_arguments; ++j) {
|
||||
int bootstrap_argument_ref = data.readUnsignedShort();
|
||||
|
||||
@@ -32,7 +32,7 @@ public class StructExceptionsAttribute extends StructGeneralAttribute {
|
||||
DataInputStream data = stream();
|
||||
int len = data.readUnsignedShort();
|
||||
if (len > 0) {
|
||||
throwsExceptions = new ArrayList<Integer>(len);
|
||||
throwsExceptions = new ArrayList<>(len);
|
||||
for (int i = 0; i < len; i++) {
|
||||
throwsExceptions.add(data.readUnsignedShort());
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class StructInnerClassesAttribute extends StructGeneralAttribute {
|
||||
|
||||
int len = data.readUnsignedShort();
|
||||
if (len > 0) {
|
||||
entries = new ArrayList<Entry>(len);
|
||||
entries = new ArrayList<>(len);
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
int innerNameIdx = data.readUnsignedShort();
|
||||
|
||||
@@ -43,7 +43,7 @@ public class StructLocalVariableTableAttribute extends StructGeneralAttribute {
|
||||
|
||||
int len = data.readUnsignedShort();
|
||||
if (len > 0) {
|
||||
mapVarNames = new HashMap<Integer, String>(len);
|
||||
mapVarNames = new HashMap<>(len);
|
||||
for (int i = 0; i < len; i++) {
|
||||
data.discard(4);
|
||||
int nameIndex = data.readUnsignedShort();
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ConstantPool implements NewClassNameBuilder {
|
||||
|
||||
public ConstantPool(DataInputStream in) throws IOException {
|
||||
int size = in.readUnsignedShort();
|
||||
pool = new ArrayList<PooledConstant>(size);
|
||||
pool = new ArrayList<>(size);
|
||||
BitSet[] nextPass = {new BitSet(size), new BitSet(size), new BitSet(size)};
|
||||
|
||||
// first dummy constant
|
||||
|
||||
@@ -24,9 +24,9 @@ import java.util.List;
|
||||
|
||||
public class DataPoint {
|
||||
|
||||
private List<VarType> localVariables = new ArrayList<VarType>();
|
||||
private List<VarType> localVariables = new ArrayList<>();
|
||||
|
||||
private ListStack<VarType> stack = new ListStack<VarType>();
|
||||
private ListStack<VarType> stack = new ListStack<>();
|
||||
|
||||
|
||||
public void setVariable(int index, VarType value) {
|
||||
@@ -53,7 +53,7 @@ public class DataPoint {
|
||||
|
||||
public DataPoint copy() {
|
||||
DataPoint point = new DataPoint();
|
||||
point.setLocalVariables(new ArrayList<VarType>(localVariables));
|
||||
point.setLocalVariables(new ArrayList<>(localVariables));
|
||||
point.setStack(stack.clone());
|
||||
return point;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class MethodDescriptor {
|
||||
|
||||
if (parenth > 1) {
|
||||
String parameters = descriptor.substring(1, parenth);
|
||||
List<String> lst = new ArrayList<String>();
|
||||
List<String> lst = new ArrayList<>();
|
||||
|
||||
int indexFrom = -1, ind, len = parameters.length(), index = 0;
|
||||
while (index < len) {
|
||||
|
||||
@@ -22,9 +22,9 @@ public class GenericClassDescriptor {
|
||||
|
||||
public GenericType superclass;
|
||||
|
||||
public final List<GenericType> superinterfaces = new ArrayList<GenericType>();
|
||||
public final List<GenericType> superinterfaces = new ArrayList<>();
|
||||
|
||||
public final List<String> fparameters = new ArrayList<String>();
|
||||
public final List<String> fparameters = new ArrayList<>();
|
||||
|
||||
public final List<List<GenericType>> fbounds = new ArrayList<List<GenericType>>();
|
||||
public final List<List<GenericType>> fbounds = new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ public class GenericMain {
|
||||
String param = value.substring(0, to);
|
||||
value = value.substring(to + 1);
|
||||
|
||||
List<GenericType> lstBounds = new ArrayList<GenericType>();
|
||||
List<GenericType> lstBounds = new ArrayList<>();
|
||||
|
||||
while (true) {
|
||||
if (value.charAt(0) == ':') {
|
||||
|
||||
@@ -20,13 +20,13 @@ import java.util.List;
|
||||
|
||||
public class GenericMethodDescriptor {
|
||||
|
||||
public final List<String> fparameters = new ArrayList<String>();
|
||||
public final List<String> fparameters = new ArrayList<>();
|
||||
|
||||
public final List<List<GenericType>> fbounds = new ArrayList<List<GenericType>>();
|
||||
public final List<List<GenericType>> fbounds = new ArrayList<>();
|
||||
|
||||
public final List<GenericType> params = new ArrayList<GenericType>();
|
||||
public final List<GenericType> params = new ArrayList<>();
|
||||
|
||||
public GenericType ret;
|
||||
|
||||
public final List<GenericType> exceptions = new ArrayList<GenericType>();
|
||||
public final List<GenericType> exceptions = new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -32,9 +32,9 @@ public class GenericType {
|
||||
public final int arrayDim;
|
||||
public final String value;
|
||||
|
||||
private final List<GenericType> enclosingClasses = new ArrayList<GenericType>();
|
||||
private final List<GenericType> arguments = new ArrayList<GenericType>();
|
||||
private final List<Integer> wildcards = new ArrayList<Integer>();
|
||||
private final List<GenericType> enclosingClasses = new ArrayList<>();
|
||||
private final List<GenericType> arguments = new ArrayList<>();
|
||||
private final List<Integer> wildcards = new ArrayList<>();
|
||||
|
||||
public GenericType(int type, int arrayDim, String value) {
|
||||
this.type = type;
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.util.Map;
|
||||
|
||||
public class LazyLoader {
|
||||
|
||||
private final Map<String, Link> mapClassLinks = new HashMap<String, Link>();
|
||||
private final Map<String, Link> mapClassLinks = new HashMap<>();
|
||||
private final IBytecodeProvider provider;
|
||||
|
||||
public LazyLoader(IBytecodeProvider provider) {
|
||||
|
||||
@@ -36,16 +36,16 @@ public class MatchEngine {
|
||||
|
||||
private MatchNode rootNode = null;
|
||||
|
||||
private final Map<String, Object> variables = new HashMap<String, Object>();
|
||||
private final Map<String, Object> variables = new HashMap<>();
|
||||
|
||||
private static final Map<String, MatchProperties> stat_properties = new HashMap<String, MatchProperties>();
|
||||
private static final Map<String, MatchProperties> expr_properties = new HashMap<String, MatchProperties>();
|
||||
private static final Map<String, Integer> stat_type = new HashMap<String, Integer>();
|
||||
private static final Map<String, Integer> expr_type = new HashMap<String, Integer>();
|
||||
private static final Map<String, Integer> expr_func_type = new HashMap<String, Integer>();
|
||||
private static final Map<String, Integer> expr_exit_type = new HashMap<String, Integer>();
|
||||
private static final Map<String, Integer> stat_if_type = new HashMap<String, Integer>();
|
||||
private static final Map<String, VarType> expr_const_type = new HashMap<String, VarType>();
|
||||
private static final Map<String, MatchProperties> stat_properties = new HashMap<>();
|
||||
private static final Map<String, MatchProperties> expr_properties = new HashMap<>();
|
||||
private static final Map<String, Integer> stat_type = new HashMap<>();
|
||||
private static final Map<String, Integer> expr_type = new HashMap<>();
|
||||
private static final Map<String, Integer> expr_func_type = new HashMap<>();
|
||||
private static final Map<String, Integer> expr_exit_type = new HashMap<>();
|
||||
private static final Map<String, Integer> stat_if_type = new HashMap<>();
|
||||
private static final Map<String, VarType> expr_const_type = new HashMap<>();
|
||||
|
||||
static {
|
||||
stat_properties.put("type", MatchProperties.STATEMENT_TYPE);
|
||||
@@ -109,11 +109,11 @@ public class MatchEngine {
|
||||
String[] lines = description.split("\n");
|
||||
|
||||
int depth = 0;
|
||||
LinkedList<MatchNode> stack = new LinkedList<MatchNode>();
|
||||
LinkedList<MatchNode> stack = new LinkedList<>();
|
||||
|
||||
for(String line : lines) {
|
||||
|
||||
List<String> properties = new ArrayList<String>(Arrays.asList(line.split("\\s+"))); // split on any number of whitespaces
|
||||
List<String> properties = new ArrayList<>(Arrays.asList(line.split("\\s+"))); // split on any number of whitespaces
|
||||
if(properties.get(0).isEmpty()) {
|
||||
properties.remove(0);
|
||||
}
|
||||
|
||||
@@ -48,9 +48,9 @@ public class MatchNode {
|
||||
|
||||
private final int type;
|
||||
|
||||
private final Map<MatchProperties, RuleValue> rules = new HashMap<MatchProperties, RuleValue>();
|
||||
private final Map<MatchProperties, RuleValue> rules = new HashMap<>();
|
||||
|
||||
private final List<MatchNode> children = new ArrayList<MatchNode>();
|
||||
private final List<MatchNode> children = new ArrayList<>();
|
||||
|
||||
|
||||
public MatchNode(int type) {
|
||||
|
||||
Reference in New Issue
Block a user