explicit types to diamonds
This commit is contained in:
@@ -169,7 +169,7 @@ public class AssertProcessor {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<Exprent> lstParams = new ArrayList<Exprent>();
|
||||
List<Exprent> lstParams = new ArrayList<>();
|
||||
|
||||
Exprent ascond = null, retcond = null;
|
||||
if (exprres[0] != null) {
|
||||
@@ -196,7 +196,7 @@ public class AssertProcessor {
|
||||
first.removeSuccessor(stat.getIfEdge());
|
||||
first.removeSuccessor(stat.getElseEdge());
|
||||
|
||||
List<Statement> lstStatements = new ArrayList<Statement>();
|
||||
List<Statement> lstStatements = new ArrayList<>();
|
||||
if (first.getExprents() != null && !first.getExprents().isEmpty()) {
|
||||
lstStatements.add(first);
|
||||
}
|
||||
|
||||
@@ -74,12 +74,12 @@ public class ClassReference14Processor {
|
||||
|
||||
public static void processClassReferences(ClassNode node) {
|
||||
// find the synthetic method Class class$(String) if present
|
||||
HashMap<ClassWrapper, MethodWrapper> mapClassMeths = new HashMap<ClassWrapper, MethodWrapper>();
|
||||
HashMap<ClassWrapper, MethodWrapper> mapClassMeths = new HashMap<>();
|
||||
mapClassMethods(node, mapClassMeths);
|
||||
if (mapClassMeths.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
HashSet<ClassWrapper> setFound = new HashSet<ClassWrapper>();
|
||||
HashSet<ClassWrapper> setFound = new HashSet<>();
|
||||
processClassRec(node, mapClassMeths, setFound);
|
||||
|
||||
if (!setFound.isEmpty()) {
|
||||
|
||||
@@ -42,7 +42,7 @@ import java.util.Map.Entry;
|
||||
public class ClassesProcessor {
|
||||
public static final int AVERAGE_CLASS_SIZE = 16 * 1024;
|
||||
|
||||
private final Map<String, ClassNode> mapRootClasses = new HashMap<String, ClassNode>();
|
||||
private final Map<String, ClassNode> mapRootClasses = new HashMap<>();
|
||||
|
||||
private static class Inner {
|
||||
private String simpleName;
|
||||
@@ -55,10 +55,10 @@ public class ClassesProcessor {
|
||||
}
|
||||
|
||||
public ClassesProcessor(StructContext context) {
|
||||
Map<String, Inner> mapInnerClasses = new HashMap<String, Inner>();
|
||||
Map<String, Set<String>> mapNestedClassReferences = new HashMap<String, Set<String>>();
|
||||
Map<String, Set<String>> mapEnclosingClassReferences = new HashMap<String, Set<String>>();
|
||||
Map<String, String> mapNewSimpleNames = new HashMap<String, String>();
|
||||
Map<String, Inner> mapInnerClasses = new HashMap<>();
|
||||
Map<String, Set<String>> mapNestedClassReferences = new HashMap<>();
|
||||
Map<String, Set<String>> mapEnclosingClassReferences = new HashMap<>();
|
||||
Map<String, String> mapNewSimpleNames = new HashMap<>();
|
||||
|
||||
boolean bDecompileInner = DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_INNER);
|
||||
|
||||
@@ -116,14 +116,14 @@ public class ClassesProcessor {
|
||||
// reference to the nested class
|
||||
Set<String> set = mapNestedClassReferences.get(enclClassName);
|
||||
if (set == null) {
|
||||
mapNestedClassReferences.put(enclClassName, set = new HashSet<String>());
|
||||
mapNestedClassReferences.put(enclClassName, set = new HashSet<>());
|
||||
}
|
||||
set.add(innerName);
|
||||
|
||||
// reference to the enclosing class
|
||||
set = mapEnclosingClassReferences.get(innerName);
|
||||
if (set == null) {
|
||||
mapEnclosingClassReferences.put(innerName, set = new HashSet<String>());
|
||||
mapEnclosingClassReferences.put(innerName, set = new HashSet<>());
|
||||
}
|
||||
set.add(enclClassName);
|
||||
}
|
||||
@@ -143,8 +143,8 @@ public class ClassesProcessor {
|
||||
for (Entry<String, ClassNode> ent : mapRootClasses.entrySet()) {
|
||||
// root class?
|
||||
if (!mapInnerClasses.containsKey(ent.getKey())) {
|
||||
Set<String> setVisited = new HashSet<String>();
|
||||
LinkedList<String> stack = new LinkedList<String>();
|
||||
Set<String> setVisited = new HashSet<>();
|
||||
LinkedList<String> stack = new LinkedList<>();
|
||||
|
||||
stack.add(ent.getKey());
|
||||
setVisited.add(ent.getKey());
|
||||
@@ -347,10 +347,10 @@ public class ClassesProcessor {
|
||||
private ClassWrapper wrapper;
|
||||
public String enclosingMethod;
|
||||
public InvocationExprent superInvocation;
|
||||
public final Map<String, VarVersionPair> mapFieldsToVars = new HashMap<String, VarVersionPair>();
|
||||
public final Map<String, VarVersionPair> mapFieldsToVars = new HashMap<>();
|
||||
public VarType anonymousClassType;
|
||||
public final List<ClassNode> nested = new ArrayList<ClassNode>();
|
||||
public final Set<String> enclosingClasses = new HashSet<String>();
|
||||
public final List<ClassNode> nested = new ArrayList<>();
|
||||
public final Set<String> enclosingClasses = new HashSet<>();
|
||||
public ClassNode parent;
|
||||
public LambdaInformation lambdaInformation;
|
||||
public boolean namelessConstructorStub = false;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class DecompilerContext {
|
||||
public static final String CURRENT_METHOD_WRAPPER = "CURRENT_METHOD_WRAPPER";
|
||||
public static final String CURRENT_VAR_PROCESSOR = "CURRENT_VAR_PROCESSOR";
|
||||
|
||||
private static final ThreadLocal<DecompilerContext> currentContext = new ThreadLocal<DecompilerContext>();
|
||||
private static final ThreadLocal<DecompilerContext> currentContext = new ThreadLocal<>();
|
||||
|
||||
private final Map<String, Object> properties;
|
||||
private StructContext structContext;
|
||||
@@ -52,7 +52,7 @@ public class DecompilerContext {
|
||||
}
|
||||
|
||||
public static void initContext(Map<String, Object> propertiesCustom) {
|
||||
Map<String, Object> properties = new HashMap<String, Object>(IFernflowerPreferences.DEFAULTS);
|
||||
Map<String, Object> properties = new HashMap<>(IFernflowerPreferences.DEFAULTS);
|
||||
if (propertiesCustom != null) {
|
||||
properties.putAll(propertiesCustom);
|
||||
}
|
||||
|
||||
@@ -156,8 +156,8 @@ public class InitializerProcessor {
|
||||
|
||||
boolean isAnonymous = DecompilerContext.getClassProcessor().getMapRootClasses().get(cl.qualifiedName).type == ClassNode.CLASS_ANONYMOUS;
|
||||
|
||||
List<List<Exprent>> lstFirst = new ArrayList<List<Exprent>>();
|
||||
List<MethodWrapper> lstMethodWrappers = new ArrayList<MethodWrapper>();
|
||||
List<List<Exprent>> lstFirst = new ArrayList<>();
|
||||
List<MethodWrapper> lstMethodWrappers = new ArrayList<>();
|
||||
|
||||
for (MethodWrapper method : wrapper.getMethods()) {
|
||||
if (CodeConstants.INIT_NAME.equals(method.methodStruct.getName()) && method.root != null) { // successfully decompiled constructor
|
||||
|
||||
@@ -105,7 +105,7 @@ public class TextBuffer {
|
||||
int currentLine = 0;
|
||||
int previousMarkLine = 0;
|
||||
int dumpedLines = 0;
|
||||
ArrayList<Integer> linesWithMarks = new ArrayList<Integer>(myLineToOffsetMapping.keySet());
|
||||
ArrayList<Integer> linesWithMarks = new ArrayList<>(myLineToOffsetMapping.keySet());
|
||||
Collections.sort(linesWithMarks);
|
||||
for (Integer markLine : linesWithMarks) {
|
||||
Integer markOffset = myLineToOffsetMapping.get(markLine);
|
||||
@@ -194,7 +194,7 @@ public class TextBuffer {
|
||||
public void setLength(int position) {
|
||||
myStringBuilder.setLength(position);
|
||||
if (myLineToOffsetMapping != null) {
|
||||
HashMap<Integer, Integer> newMap = new HashMap<Integer, Integer>();
|
||||
HashMap<Integer, Integer> newMap = new HashMap<>();
|
||||
for (Map.Entry<Integer, Integer> entry : myLineToOffsetMapping.entrySet()) {
|
||||
if (entry.getValue() <= position) {
|
||||
newMap.put(entry.getKey(), entry.getValue());
|
||||
@@ -217,7 +217,7 @@ public class TextBuffer {
|
||||
|
||||
private void shiftMapping(int startOffset, int shiftOffset) {
|
||||
if (myLineToOffsetMapping != null) {
|
||||
HashMap<Integer, Integer> newMap = new HashMap<Integer, Integer>();
|
||||
HashMap<Integer, Integer> newMap = new HashMap<>();
|
||||
for (Map.Entry<Integer, Integer> entry : myLineToOffsetMapping.entrySet()) {
|
||||
int newValue = entry.getValue();
|
||||
if (newValue >= startOffset) {
|
||||
@@ -233,7 +233,7 @@ public class TextBuffer {
|
||||
|
||||
private void checkMapCreated() {
|
||||
if (myLineToOffsetMapping == null) {
|
||||
myLineToOffsetMapping = new HashMap<Integer, Integer>();
|
||||
myLineToOffsetMapping = new HashMap<>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ public class TextBuffer {
|
||||
if (srcLines.size() < 2 || srcLines.size() <= requiredLineNumber) {
|
||||
return srcLines;
|
||||
}
|
||||
List<String> res = new LinkedList<String>(srcLines);
|
||||
List<String> res = new LinkedList<>(srcLines);
|
||||
// first join lines with a single { or }
|
||||
for (int i = res.size()-1; i > 0 ; i--) {
|
||||
String s = res.get(i);
|
||||
@@ -294,12 +294,12 @@ public class TextBuffer {
|
||||
|
||||
public void dumpOriginalLineNumbers(int[] lineMapping) {
|
||||
if (lineMapping.length > 0) {
|
||||
myLineMapping = new HashMap<Integer, Set<Integer>>();
|
||||
myLineMapping = new HashMap<>();
|
||||
for (int i = 0; i < lineMapping.length; i += 2) {
|
||||
int key = lineMapping[i + 1];
|
||||
Set<Integer> existing = myLineMapping.get(key);
|
||||
if (existing == null) {
|
||||
existing = new TreeSet<Integer>();
|
||||
existing = new TreeSet<>();
|
||||
myLineMapping.put(key, existing);
|
||||
}
|
||||
existing.add(lineMapping[i]);
|
||||
|
||||
@@ -25,7 +25,7 @@ public class BytecodeMappingTracer {
|
||||
|
||||
private int currentSourceLine;
|
||||
private StructLineNumberTableAttribute lineNumberTable = null;
|
||||
private final Map<Integer, Integer> mapping = new HashMap<Integer, Integer>(); // bytecode offset, source line
|
||||
private final Map<Integer, Integer> mapping = new HashMap<>(); // bytecode offset, source line
|
||||
|
||||
public BytecodeMappingTracer() { }
|
||||
|
||||
@@ -81,7 +81,7 @@ public class BytecodeMappingTracer {
|
||||
this.lineNumberTable = lineNumberTable;
|
||||
}
|
||||
|
||||
private final Set<Integer> unmappedLines = new HashSet<Integer>();
|
||||
private final Set<Integer> unmappedLines = new HashSet<>();
|
||||
|
||||
public Set<Integer> getUnmappedLines() {
|
||||
return unmappedLines;
|
||||
@@ -92,7 +92,7 @@ public class BytecodeMappingTracer {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
Map<Integer, Integer> res = new HashMap<Integer, Integer>();
|
||||
Map<Integer, Integer> res = new HashMap<>();
|
||||
|
||||
// first match offsets from line number table
|
||||
int[] data = lineNumberTable.getRawData();
|
||||
|
||||
@@ -26,21 +26,21 @@ public class BytecodeSourceMapper {
|
||||
private int offset_total;
|
||||
|
||||
// class, method, bytecode offset, source line
|
||||
private final Map<String, Map<String, Map<Integer, Integer>>> mapping = new LinkedHashMap<String, Map<String, Map<Integer, Integer>>>();
|
||||
private final Map<String, Map<String, Map<Integer, Integer>>> mapping = new LinkedHashMap<>();
|
||||
|
||||
// original line to decompiled line
|
||||
private final Map<Integer, Integer> linesMapping = new HashMap<Integer, Integer>();
|
||||
private final Set<Integer> unmappedLines = new TreeSet<Integer>();
|
||||
private final Map<Integer, Integer> linesMapping = new HashMap<>();
|
||||
private final Set<Integer> unmappedLines = new TreeSet<>();
|
||||
|
||||
public void addMapping(String className, String methodName, int bytecodeOffset, int sourceLine) {
|
||||
Map<String, Map<Integer, Integer>> class_mapping = mapping.get(className);
|
||||
if (class_mapping == null) {
|
||||
mapping.put(className, class_mapping = new LinkedHashMap<String, Map<Integer, Integer>>()); // need to preserve order
|
||||
mapping.put(className, class_mapping = new LinkedHashMap<>()); // need to preserve order
|
||||
}
|
||||
|
||||
Map<Integer, Integer> method_mapping = class_mapping.get(methodName);
|
||||
if (method_mapping == null) {
|
||||
class_mapping.put(methodName, method_mapping = new HashMap<Integer, Integer>());
|
||||
class_mapping.put(methodName, method_mapping = new HashMap<>());
|
||||
}
|
||||
|
||||
// don't overwrite
|
||||
@@ -78,7 +78,7 @@ public class BytecodeSourceMapper {
|
||||
|
||||
buffer.appendIndent(1).append("method '" + method_entry.getKey() + "' {" + lineSeparator);
|
||||
|
||||
List<Integer> lstBytecodeOffsets = new ArrayList<Integer>(method_mapping.keySet());
|
||||
List<Integer> lstBytecodeOffsets = new ArrayList<>(method_mapping.keySet());
|
||||
Collections.sort(lstBytecodeOffsets);
|
||||
|
||||
for (Integer offset : lstBytecodeOffsets) {
|
||||
@@ -97,7 +97,7 @@ public class BytecodeSourceMapper {
|
||||
|
||||
// lines mapping
|
||||
buffer.append("Lines mapping:").appendLineSeparator();
|
||||
Map<Integer, Integer> sorted = new TreeMap<Integer, Integer>(linesMapping);
|
||||
Map<Integer, Integer> sorted = new TreeMap<>(linesMapping);
|
||||
for (Entry<Integer, Integer> entry : sorted.entrySet()) {
|
||||
buffer.append(entry.getKey()).append(" <-> ").append(entry.getValue() + offset_total + 1).appendLineSeparator();
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ import java.util.Map.Entry;
|
||||
public class ImportCollector {
|
||||
private static final String JAVA_LANG_PACKAGE = "java.lang";
|
||||
|
||||
private final Map<String, String> mapSimpleNames = new HashMap<String, String>();
|
||||
private final Set<String> setNotImportedNames = new HashSet<String>();
|
||||
private final Map<String, String> mapSimpleNames = new HashMap<>();
|
||||
private final Set<String> setNotImportedNames = new HashSet<>();
|
||||
private final String currentPackageSlash;
|
||||
private final String currentPackagePoint;
|
||||
|
||||
@@ -124,7 +124,7 @@ public class ImportCollector {
|
||||
}
|
||||
|
||||
private List<String> packImports() {
|
||||
List<Entry<String, String>> lst = new ArrayList<Entry<String, String>>(mapSimpleNames.entrySet());
|
||||
List<Entry<String, String>> lst = new ArrayList<>(mapSimpleNames.entrySet());
|
||||
|
||||
Collections.sort(lst, (par0, par1) -> {
|
||||
int res = par0.getValue().compareTo(par1.getValue());
|
||||
@@ -134,7 +134,7 @@ public class ImportCollector {
|
||||
return res;
|
||||
});
|
||||
|
||||
List<String> res = new ArrayList<String>();
|
||||
List<String> res = new ArrayList<>();
|
||||
for (Entry<String, String> ent : lst) {
|
||||
// exclude a current class or one of the nested ones, java.lang and empty packages
|
||||
if (!setNotImportedNames.contains(ent.getKey()) &&
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.Set;
|
||||
|
||||
public class VarNamesCollector {
|
||||
|
||||
private final Set<String> usedNames = new HashSet<String>();
|
||||
private final Set<String> usedNames = new HashSet<>();
|
||||
|
||||
public VarNamesCollector() { }
|
||||
|
||||
|
||||
@@ -41,9 +41,9 @@ public class ConsoleDecompiler implements IBytecodeProvider, IResultSaver {
|
||||
return;
|
||||
}
|
||||
|
||||
Map<String, Object> mapOptions = new HashMap<String, Object>();
|
||||
List<File> lstSources = new ArrayList<File>();
|
||||
List<File> lstLibraries = new ArrayList<File>();
|
||||
Map<String, Object> mapOptions = new HashMap<>();
|
||||
List<File> lstSources = new ArrayList<>();
|
||||
List<File> lstLibraries = new ArrayList<>();
|
||||
|
||||
boolean isOption = true;
|
||||
for (int i = 0; i < args.length - 1; ++i) { // last parameter - destination
|
||||
@@ -113,8 +113,8 @@ public class ConsoleDecompiler implements IBytecodeProvider, IResultSaver {
|
||||
|
||||
private final File root;
|
||||
private final Fernflower fernflower;
|
||||
private final Map<String, ZipOutputStream> mapArchiveStreams = new HashMap<String, ZipOutputStream>();
|
||||
private final Map<String, Set<String>> mapArchiveEntries = new HashMap<String, Set<String>>();
|
||||
private final Map<String, ZipOutputStream> mapArchiveStreams = new HashMap<>();
|
||||
private final Map<String, Set<String>> mapArchiveEntries = new HashMap<>();
|
||||
|
||||
@SuppressWarnings("UseOfSystemOutOrSystemErr")
|
||||
public ConsoleDecompiler(File destination, Map<String, Object> options) {
|
||||
@@ -266,7 +266,7 @@ public class ConsoleDecompiler implements IBytecodeProvider, IResultSaver {
|
||||
private boolean checkEntry(String entryName, String file) {
|
||||
Set<String> set = mapArchiveEntries.get(file);
|
||||
if (set == null) {
|
||||
mapArchiveEntries.put(file, set = new HashSet<String>());
|
||||
mapArchiveEntries.put(file, set = new HashSet<>());
|
||||
}
|
||||
|
||||
boolean added = set.add(entryName);
|
||||
|
||||
@@ -40,10 +40,10 @@ import java.util.Set;
|
||||
public class ClassWrapper {
|
||||
|
||||
private final StructClass classStruct;
|
||||
private final Set<String> hiddenMembers = new HashSet<String>();
|
||||
private final VBStyleCollection<Exprent, String> staticFieldInitializers = new VBStyleCollection<Exprent, String>();
|
||||
private final VBStyleCollection<Exprent, String> dynamicFieldInitializers = new VBStyleCollection<Exprent, String>();
|
||||
private final VBStyleCollection<MethodWrapper, String> methods = new VBStyleCollection<MethodWrapper, String>();
|
||||
private final Set<String> hiddenMembers = new HashSet<>();
|
||||
private final VBStyleCollection<Exprent, String> staticFieldInitializers = new VBStyleCollection<>();
|
||||
private final VBStyleCollection<Exprent, String> dynamicFieldInitializers = new VBStyleCollection<>();
|
||||
private final VBStyleCollection<MethodWrapper, String> methods = new VBStyleCollection<>();
|
||||
|
||||
public ClassWrapper(StructClass classStruct) {
|
||||
this.classStruct = classStruct;
|
||||
@@ -55,7 +55,7 @@ public class ClassWrapper {
|
||||
DecompilerContext.getLogger().startClass(classStruct.qualifiedName);
|
||||
|
||||
// collect field names
|
||||
Set<String> setFieldNames = new HashSet<String>();
|
||||
Set<String> setFieldNames = new HashSet<>();
|
||||
for (StructField fd : classStruct.getFields()) {
|
||||
setFieldNames.add(fd.getName());
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class LambdaProcessor {
|
||||
return false; // no lambda bootstrap constant found
|
||||
}
|
||||
|
||||
Map<String, String> mapMethodsLambda = new HashMap<String, String>();
|
||||
Map<String, String> mapMethodsLambda = new HashMap<>();
|
||||
|
||||
// iterate over code and find invocations of bootstrap methods. Replace them with anonymous classes.
|
||||
for (StructMethod mt : cl.getMethods()) {
|
||||
|
||||
@@ -31,7 +31,7 @@ public class MethodWrapper {
|
||||
public final VarProcessor varproc;
|
||||
public final StructMethod methodStruct;
|
||||
public final CounterContainer counter;
|
||||
public final HashSet<String> setOuterVarNames = new HashSet<String>();
|
||||
public final HashSet<String> setOuterVarNames = new HashSet<>();
|
||||
|
||||
public DirectGraph graph;
|
||||
public List<VarVersionPair> signatureFields;
|
||||
|
||||
@@ -130,7 +130,7 @@ public class NestedClassProcessor {
|
||||
method.varproc.setVarName(new VarVersionPair(0, 0), parent.simpleName + ".this");
|
||||
}
|
||||
|
||||
final Map<VarVersionPair, String> mapNewNames = new HashMap<VarVersionPair, String>();
|
||||
final Map<VarVersionPair, String> mapNewNames = new HashMap<>();
|
||||
|
||||
enclosingMethod.getOrBuildGraph().iterateExprents(new DirectGraph.ExprentIterator() {
|
||||
@Override
|
||||
@@ -168,7 +168,7 @@ public class NestedClassProcessor {
|
||||
});
|
||||
|
||||
// update names of local variables
|
||||
Set<String> setNewOuterNames = new HashSet<String>(mapNewNames.values());
|
||||
Set<String> setNewOuterNames = new HashSet<>(mapNewNames.values());
|
||||
setNewOuterNames.removeAll(method.setOuterVarNames);
|
||||
|
||||
method.varproc.refreshVarNames(new VarNamesCollector(setNewOuterNames));
|
||||
@@ -180,7 +180,7 @@ public class NestedClassProcessor {
|
||||
}
|
||||
|
||||
private static void checkNotFoundClasses(ClassNode root, ClassNode node) {
|
||||
List<ClassNode> copy = new ArrayList<ClassNode>(node.nested);
|
||||
List<ClassNode> copy = new ArrayList<>(node.nested);
|
||||
|
||||
for (ClassNode child : copy) {
|
||||
if (child.classStruct.hasModifier(CodeConstants.ACC_SYNTHETIC)) {
|
||||
@@ -225,7 +225,7 @@ public class NestedClassProcessor {
|
||||
private static boolean insertNestedClass(ClassNode root, ClassNode child) {
|
||||
Set<String> setEnclosing = child.enclosingClasses;
|
||||
|
||||
LinkedList<ClassNode> stack = new LinkedList<ClassNode>();
|
||||
LinkedList<ClassNode> stack = new LinkedList<>();
|
||||
stack.add(root);
|
||||
|
||||
while (!stack.isEmpty()) {
|
||||
@@ -248,7 +248,7 @@ public class NestedClassProcessor {
|
||||
private static void computeLocalVarsAndDefinitions(final ClassNode node) {
|
||||
// local var masks
|
||||
// class name, constructor descriptor, field mask
|
||||
final Map<String, Map<String, List<VarFieldPair>>> mapVarMasks = new HashMap<String, Map<String, List<VarFieldPair>>>();
|
||||
final Map<String, Map<String, List<VarFieldPair>>> mapVarMasks = new HashMap<>();
|
||||
|
||||
int clTypes = 0;
|
||||
|
||||
@@ -274,7 +274,7 @@ public class NestedClassProcessor {
|
||||
}
|
||||
|
||||
// local var masks
|
||||
final Map<String, Map<String, List<VarFieldPair>>> mapVarFieldPairs = new HashMap<String, Map<String, List<VarFieldPair>>>();
|
||||
final Map<String, Map<String, List<VarFieldPair>>> mapVarFieldPairs = new HashMap<>();
|
||||
|
||||
if (clTypes != ClassNode.CLASS_MEMBER) {
|
||||
// iterate enclosing class
|
||||
@@ -298,10 +298,10 @@ public class NestedClassProcessor {
|
||||
List<VarFieldPair> mask = mapVarMasks.get(refClassName).get(constructor.getStringDescriptor());
|
||||
|
||||
if (!mapVarFieldPairs.containsKey(refClassName)) {
|
||||
mapVarFieldPairs.put(refClassName, new HashMap<String, List<VarFieldPair>>());
|
||||
mapVarFieldPairs.put(refClassName, new HashMap<>());
|
||||
}
|
||||
|
||||
List<VarFieldPair> lstTemp = new ArrayList<VarFieldPair>();
|
||||
List<VarFieldPair> lstTemp = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < mask.size(); i++) {
|
||||
Exprent param = constructor.getLstParameters().get(i);
|
||||
@@ -356,7 +356,7 @@ public class NestedClassProcessor {
|
||||
if (mapVarFieldPairs.containsKey(enclosing.getKey())) {
|
||||
for (List<VarFieldPair> mask : mapVarFieldPairs.get(enclosing.getKey()).values()) {
|
||||
if (interPairMask == null) {
|
||||
interPairMask = new ArrayList<VarFieldPair>(mask);
|
||||
interPairMask = new ArrayList<>(mask);
|
||||
}
|
||||
else {
|
||||
mergeListSignatures(interPairMask, mask, false);
|
||||
@@ -368,7 +368,7 @@ public class NestedClassProcessor {
|
||||
// merge all constructors
|
||||
for (List<VarFieldPair> mask : enclosing.getValue().values()) {
|
||||
if (interMask == null) {
|
||||
interMask = new ArrayList<VarFieldPair>(mask);
|
||||
interMask = new ArrayList<>(mask);
|
||||
}
|
||||
else {
|
||||
mergeListSignatures(interMask, mask, false);
|
||||
@@ -376,7 +376,7 @@ public class NestedClassProcessor {
|
||||
}
|
||||
|
||||
if (interPairMask == null) { // member or local and never instantiated
|
||||
interPairMask = interMask != null ? new ArrayList<VarFieldPair>(interMask) : new ArrayList<VarFieldPair>();
|
||||
interPairMask = interMask != null ? new ArrayList<>(interMask) : new ArrayList<>();
|
||||
|
||||
boolean found = false;
|
||||
|
||||
@@ -403,7 +403,7 @@ public class NestedClassProcessor {
|
||||
mergeListSignatures(entry.getValue(), interPairMask, false);
|
||||
|
||||
MethodWrapper method = nestedNode.getWrapper().getMethodWrapper(CodeConstants.INIT_NAME, entry.getKey());
|
||||
method.signatureFields = new ArrayList<VarVersionPair>();
|
||||
method.signatureFields = new ArrayList<>();
|
||||
|
||||
for (VarFieldPair pair : entry.getValue()) {
|
||||
method.signatureFields.add(pair == null ? null : pair.varPair);
|
||||
@@ -419,10 +419,10 @@ public class NestedClassProcessor {
|
||||
// iterate all child methods
|
||||
for (final MethodWrapper method : child.getWrapper().getMethods()) {
|
||||
if (method.root != null) { // neither abstract nor native
|
||||
Map<VarVersionPair, String> mapNewNames = new HashMap<VarVersionPair, String>(); // local var names
|
||||
Map<VarVersionPair, VarType> mapNewTypes = new HashMap<VarVersionPair, VarType>(); // local var types
|
||||
Map<VarVersionPair, String> mapNewNames = new HashMap<>(); // local var names
|
||||
Map<VarVersionPair, VarType> mapNewTypes = new HashMap<>(); // local var types
|
||||
|
||||
final Map<Integer, VarVersionPair> mapParamsToNewVars = new HashMap<Integer, VarVersionPair>();
|
||||
final Map<Integer, VarVersionPair> mapParamsToNewVars = new HashMap<>();
|
||||
if (method.signatureFields != null) {
|
||||
int index = 0, varIndex = 1;
|
||||
MethodDescriptor md = MethodDescriptor.parseDescriptor(method.methodStruct.getDescriptor());
|
||||
@@ -462,7 +462,7 @@ public class NestedClassProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
final Map<String, VarVersionPair> mapFieldsToNewVars = new HashMap<String, VarVersionPair>();
|
||||
final Map<String, VarVersionPair> mapFieldsToNewVars = new HashMap<>();
|
||||
for (ClassNode classNode = child; classNode != null; classNode = classNode.parent) {
|
||||
for (Entry<String, VarVersionPair> entry : classNode.mapFieldsToVars.entrySet()) {
|
||||
VarVersionPair newVar = new VarVersionPair(method.counter.getCounterAndIncrement(CounterContainer.VAR_COUNTER), 0);
|
||||
@@ -503,7 +503,7 @@ public class NestedClassProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
Set<String> setNewOuterNames = new HashSet<String>(mapNewNames.values());
|
||||
Set<String> setNewOuterNames = new HashSet<>(mapNewNames.values());
|
||||
setNewOuterNames.removeAll(method.setOuterVarNames);
|
||||
|
||||
method.varproc.refreshVarNames(new VarNamesCollector(setNewOuterNames));
|
||||
@@ -593,7 +593,7 @@ public class NestedClassProcessor {
|
||||
}
|
||||
|
||||
private static Map<String, List<VarFieldPair>> getMaskLocalVars(ClassWrapper wrapper) {
|
||||
Map<String, List<VarFieldPair>> mapMasks = new HashMap<String, List<VarFieldPair>>();
|
||||
Map<String, List<VarFieldPair>> mapMasks = new HashMap<>();
|
||||
|
||||
StructClass cl = wrapper.getClassStruct();
|
||||
|
||||
@@ -605,7 +605,7 @@ public class NestedClassProcessor {
|
||||
DirectGraph graph = method.getOrBuildGraph();
|
||||
|
||||
if (graph != null) { // something gone wrong, should not be null
|
||||
List<VarFieldPair> fields = new ArrayList<VarFieldPair>();
|
||||
List<VarFieldPair> fields = new ArrayList<>();
|
||||
|
||||
int varIndex = 1;
|
||||
for (int i = 0; i < md.params.length; i++) { // no static methods allowed
|
||||
@@ -754,7 +754,7 @@ public class NestedClassProcessor {
|
||||
private static void setLocalClassDefinition(MethodWrapper method, ClassNode node) {
|
||||
RootStatement root = method.root;
|
||||
|
||||
Set<Statement> setStats = new HashSet<Statement>();
|
||||
Set<Statement> setStats = new HashSet<>();
|
||||
VarType classType = new VarType(node.classStruct.qualifiedName, true);
|
||||
|
||||
Statement statement = getDefStatement(root, classType, setStats);
|
||||
@@ -793,7 +793,7 @@ public class NestedClassProcessor {
|
||||
}
|
||||
|
||||
private static Statement findFirstBlock(Statement stat, Set<Statement> setStats) {
|
||||
LinkedList<Statement> stack = new LinkedList<Statement>();
|
||||
LinkedList<Statement> stack = new LinkedList<>();
|
||||
stack.add(stat);
|
||||
|
||||
while (!stack.isEmpty()) {
|
||||
@@ -827,7 +827,7 @@ public class NestedClassProcessor {
|
||||
}
|
||||
|
||||
private static Statement getDefStatement(Statement stat, VarType classType, Set<Statement> setStats) {
|
||||
List<Exprent> lst = new ArrayList<Exprent>();
|
||||
List<Exprent> lst = new ArrayList<>();
|
||||
Statement retStat = null;
|
||||
|
||||
if (stat.getExprents() == null) {
|
||||
|
||||
@@ -36,7 +36,7 @@ public class NestedMemberAccess {
|
||||
private enum MethodAccess {NORMAL, FIELD_GET, FIELD_SET, METHOD, FUNCTION}
|
||||
|
||||
private boolean noSynthFlag;
|
||||
private final Map<MethodWrapper, MethodAccess> mapMethodType = new HashMap<MethodWrapper, MethodAccess>();
|
||||
private final Map<MethodWrapper, MethodAccess> mapMethodType = new HashMap<>();
|
||||
|
||||
|
||||
public void propagateMemberAccess(ClassNode root) {
|
||||
@@ -231,8 +231,8 @@ public class NestedMemberAccess {
|
||||
|
||||
DirectGraph graph = meth.getOrBuildGraph();
|
||||
|
||||
HashSet<DirectNode> setVisited = new HashSet<DirectNode>();
|
||||
LinkedList<DirectNode> stack = new LinkedList<DirectNode>();
|
||||
HashSet<DirectNode> setVisited = new HashSet<>();
|
||||
LinkedList<DirectNode> stack = new LinkedList<>();
|
||||
stack.add(graph.first);
|
||||
|
||||
while (!stack.isEmpty()) { // TODO: replace with interface iterator?
|
||||
|
||||
Reference in New Issue
Block a user