diff --git a/src/org/jetbrains/java/decompiler/code/InstructionSequence.java b/src/org/jetbrains/java/decompiler/code/InstructionSequence.java index cde9284..ec22827 100644 --- a/src/org/jetbrains/java/decompiler/code/InstructionSequence.java +++ b/src/org/jetbrains/java/decompiler/code/InstructionSequence.java @@ -41,7 +41,7 @@ public abstract class InstructionSequence { protected ExceptionTable exceptionTable = ExceptionTable.EMPTY; protected InstructionSequence() { - this(new VBStyleCollection()); + this(new VBStyleCollection<>()); } protected InstructionSequence(VBStyleCollection collinstr) { diff --git a/src/org/jetbrains/java/decompiler/code/cfg/BasicBlock.java b/src/org/jetbrains/java/decompiler/code/cfg/BasicBlock.java index 0bbaf72..55d7462 100644 --- a/src/org/jetbrains/java/decompiler/code/cfg/BasicBlock.java +++ b/src/org/jetbrains/java/decompiler/code/cfg/BasicBlock.java @@ -40,15 +40,15 @@ public class BasicBlock implements IGraphNode { private InstructionSequence seq = new SimpleInstructionSequence(); - private List preds = new ArrayList(); + private List preds = new ArrayList<>(); - private List succs = new ArrayList(); + private List succs = new ArrayList<>(); - private final List instrOldOffsets = new ArrayList(); + private final List instrOldOffsets = new ArrayList<>(); - private List predExceptions = new ArrayList(); + private List predExceptions = new ArrayList<>(); - private List succExceptions = new ArrayList(); + private List succExceptions = new ArrayList<>(); public BasicBlock(int id) { this.id = id; @@ -216,7 +216,7 @@ public class BasicBlock implements IGraphNode { } public List getPredecessors() { - List lst = new ArrayList(preds); + List lst = new ArrayList<>(preds); lst.addAll(predExceptions); return lst; } diff --git a/src/org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.java b/src/org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.java index 2f4761e..4706bf6 100644 --- a/src/org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.java +++ b/src/org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.java @@ -47,7 +47,7 @@ public class ControlFlowGraph implements CodeConstants { private Map subroutines; - private Set finallyExits = new HashSet(); + private Set finallyExits = new HashSet<>(); // ***************************************************************************** // constructors @@ -225,7 +225,7 @@ public class ControlFlowGraph implements CodeConstants { short[] states = findStartInstructions(instrseq); - Map mapInstrBlocks = new HashMap(); + Map mapInstrBlocks = new HashMap<>(); VBStyleCollection colBlocks = createBasicBlocks(states, instrseq, mapInstrBlocks); blocks = colBlocks; @@ -244,7 +244,7 @@ public class ControlFlowGraph implements CodeConstants { int len = seq.length(); short[] inststates = new short[len]; - Set excSet = new HashSet(); + Set excSet = new HashSet<>(); for (ExceptionHandler handler : seq.getExceptionTable().getHandlers()) { excSet.add(handler.from_instr); @@ -293,7 +293,7 @@ public class ControlFlowGraph implements CodeConstants { InstructionSequence instrseq, Map mapInstrBlocks) { - VBStyleCollection col = new VBStyleCollection(); + VBStyleCollection col = new VBStyleCollection<>(); InstructionSequence currseq = null; List lstOffs = null; @@ -367,9 +367,9 @@ public class ControlFlowGraph implements CodeConstants { private void setExceptionEdges(InstructionSequence instrseq, Map instrBlocks) { - exceptions = new ArrayList(); + exceptions = new ArrayList<>(); - Map mapRanges = new HashMap(); + Map mapRanges = new HashMap<>(); for (ExceptionHandler handler : instrseq.getExceptionTable().getHandlers()) { @@ -385,7 +385,7 @@ public class ControlFlowGraph implements CodeConstants { } else { - List protectedRange = new ArrayList(); + List protectedRange = new ArrayList<>(); for (int j = from.id; j < to.id; j++) { BasicBlock block = blocks.getWithKey(j); protectedRange.add(block); @@ -404,19 +404,19 @@ public class ControlFlowGraph implements CodeConstants { private void setSubroutineEdges() { - final Map subroutines = new HashMap(); + final Map subroutines = new HashMap<>(); for (BasicBlock block : blocks) { if (block.getSeq().getLastInstr().opcode == CodeConstants.opc_jsr) { - LinkedList stack = new LinkedList(); - LinkedList> stackJsrStacks = new LinkedList>(); + LinkedList stack = new LinkedList<>(); + LinkedList> stackJsrStacks = new LinkedList<>(); - Set setVisited = new HashSet(); + Set setVisited = new HashSet<>(); stack.add(block); - stackJsrStacks.add(new LinkedList()); + stackJsrStacks.add(new LinkedList<>()); while (!stack.isEmpty()) { @@ -449,7 +449,7 @@ public class ControlFlowGraph implements CodeConstants { for (BasicBlock succ : node.getSuccs()) { if (!setVisited.contains(succ)) { stack.add(succ); - stackJsrStacks.add(new LinkedList(jsrstack)); + stackJsrStacks.add(new LinkedList<>(jsrstack)); } } } @@ -480,7 +480,7 @@ public class ControlFlowGraph implements CodeConstants { private int processJsrRanges() { - List lstJsrAll = new ArrayList(); + List lstJsrAll = new ArrayList<>(); // get all jsr ranges for (Entry ent : subroutines.entrySet()) { @@ -492,7 +492,7 @@ public class ControlFlowGraph implements CodeConstants { // sort ranges // FIXME: better sort order - List lstJsr = new ArrayList(); + List lstJsr = new ArrayList<>(); for (JsrRecord arr : lstJsrAll) { int i = 0; for (; i < lstJsr.size(); i++) { @@ -514,7 +514,7 @@ public class ControlFlowGraph implements CodeConstants { Set set1 = arr1.range; if (!set.contains(arr1.jsr) && !set1.contains(arr.jsr)) { // rang 0 doesn't contain entry 1 and vice versa - Set setc = new HashSet(set); + Set setc = new HashSet<>(set); setc.retainAll(set1); if (!setc.isEmpty()) { @@ -530,9 +530,9 @@ public class ControlFlowGraph implements CodeConstants { private Set getJsrRange(BasicBlock jsr, BasicBlock ret) { - Set blocks = new HashSet(); + Set blocks = new HashSet<>(); - List lstNodes = new LinkedList(); + List lstNodes = new LinkedList<>(); lstNodes.add(jsr); BasicBlock dom = jsr.getSuccs().get(0); @@ -594,8 +594,8 @@ public class ControlFlowGraph implements CodeConstants { private void splitJsrRange(BasicBlock jsr, BasicBlock ret, Set common_blocks) { - List lstNodes = new LinkedList(); - Map mapNewNodes = new HashMap(); + List lstNodes = new LinkedList<>(); + Map mapNewNodes = new HashMap<>(); lstNodes.add(jsr); mapNewNodes.put(jsr.id, jsr); @@ -680,14 +680,14 @@ public class ControlFlowGraph implements CodeConstants { ExceptionRangeCFG range = exceptions.get(i); List lstRange = range.getProtectedRange(); - HashSet setBoth = new HashSet(common_blocks); + HashSet setBoth = new HashSet<>(common_blocks); setBoth.retainAll(lstRange); if (setBoth.size() > 0) { List lstNewRange; if (setBoth.size() == lstRange.size()) { - lstNewRange = new ArrayList(); + lstNewRange = new ArrayList<>(); ExceptionRangeCFG newRange = new ExceptionRangeCFG(lstNewRange, mapNewNodes.get(range.getHandler().id), range.getExceptionTypes()); exceptions.add(newRange); @@ -751,7 +751,7 @@ public class ControlFlowGraph implements CodeConstants { if (suc.mark != 1) { DataPoint point = new DataPoint(); - point.setLocalVariables(new ArrayList(data.getLocalVariables())); + point.setLocalVariables(new ArrayList<>(data.getLocalVariables())); point.getStack().push(new VarType(CodeConstants.TYPE_OBJECT, 0, null)); removeJsrInstructions(pool, suc, point); @@ -774,7 +774,7 @@ public class ControlFlowGraph implements CodeConstants { public List getReversePostOrder() { - List res = new LinkedList(); + List res = new LinkedList<>(); addToReversePostOrderListIterative(first, res); return res; @@ -782,10 +782,10 @@ public class ControlFlowGraph implements CodeConstants { private static void addToReversePostOrderListIterative(BasicBlock root, List lst) { - LinkedList stackNode = new LinkedList(); - LinkedList stackIndex = new LinkedList(); + LinkedList stackNode = new LinkedList<>(); + LinkedList stackIndex = new LinkedList<>(); - Set setVisited = new HashSet(); + Set setVisited = new HashSet<>(); stackNode.add(root); stackIndex.add(0); @@ -797,7 +797,7 @@ public class ControlFlowGraph implements CodeConstants { setVisited.add(node); - List lstSuccs = new ArrayList(node.getSuccs()); + List lstSuccs = new ArrayList<>(node.getSuccs()); lstSuccs.addAll(node.getSuccExceptions()); for (; index < lstSuccs.size(); index++) { diff --git a/src/org/jetbrains/java/decompiler/code/cfg/ExceptionRangeCFG.java b/src/org/jetbrains/java/decompiler/code/cfg/ExceptionRangeCFG.java index 47e0e21..38a105b 100644 --- a/src/org/jetbrains/java/decompiler/code/cfg/ExceptionRangeCFG.java +++ b/src/org/jetbrains/java/decompiler/code/cfg/ExceptionRangeCFG.java @@ -24,7 +24,7 @@ import java.util.Set; public class ExceptionRangeCFG { - private List protectedRange = new ArrayList(); // FIXME: replace with set + private List protectedRange = new ArrayList<>(); // FIXME: replace with set private BasicBlock handler; @@ -35,7 +35,7 @@ public class ExceptionRangeCFG { this.handler = handler; if (exceptionType != null) { - this.exceptionTypes = new ArrayList(exceptionType); + this.exceptionTypes = new ArrayList<>(exceptionType); } } @@ -105,7 +105,7 @@ public class ExceptionRangeCFG { return null; } - Set setExceptionStrings = new HashSet(); + Set setExceptionStrings = new HashSet<>(); for (String exceptionType : exceptionTypes) { // normalize order setExceptionStrings.add(exceptionType); diff --git a/src/org/jetbrains/java/decompiler/main/AssertProcessor.java b/src/org/jetbrains/java/decompiler/main/AssertProcessor.java index abb51ce..2ccbe3d 100644 --- a/src/org/jetbrains/java/decompiler/main/AssertProcessor.java +++ b/src/org/jetbrains/java/decompiler/main/AssertProcessor.java @@ -169,7 +169,7 @@ public class AssertProcessor { return false; } - List lstParams = new ArrayList(); + List 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 lstStatements = new ArrayList(); + List lstStatements = new ArrayList<>(); if (first.getExprents() != null && !first.getExprents().isEmpty()) { lstStatements.add(first); } diff --git a/src/org/jetbrains/java/decompiler/main/ClassReference14Processor.java b/src/org/jetbrains/java/decompiler/main/ClassReference14Processor.java index e97c47e..3ccc2d7 100644 --- a/src/org/jetbrains/java/decompiler/main/ClassReference14Processor.java +++ b/src/org/jetbrains/java/decompiler/main/ClassReference14Processor.java @@ -74,12 +74,12 @@ public class ClassReference14Processor { public static void processClassReferences(ClassNode node) { // find the synthetic method Class class$(String) if present - HashMap mapClassMeths = new HashMap(); + HashMap mapClassMeths = new HashMap<>(); mapClassMethods(node, mapClassMeths); if (mapClassMeths.isEmpty()) { return; } - HashSet setFound = new HashSet(); + HashSet setFound = new HashSet<>(); processClassRec(node, mapClassMeths, setFound); if (!setFound.isEmpty()) { diff --git a/src/org/jetbrains/java/decompiler/main/ClassesProcessor.java b/src/org/jetbrains/java/decompiler/main/ClassesProcessor.java index 17331e9..4afeddf 100644 --- a/src/org/jetbrains/java/decompiler/main/ClassesProcessor.java +++ b/src/org/jetbrains/java/decompiler/main/ClassesProcessor.java @@ -42,7 +42,7 @@ import java.util.Map.Entry; public class ClassesProcessor { public static final int AVERAGE_CLASS_SIZE = 16 * 1024; - private final Map mapRootClasses = new HashMap(); + private final Map mapRootClasses = new HashMap<>(); private static class Inner { private String simpleName; @@ -55,10 +55,10 @@ public class ClassesProcessor { } public ClassesProcessor(StructContext context) { - Map mapInnerClasses = new HashMap(); - Map> mapNestedClassReferences = new HashMap>(); - Map> mapEnclosingClassReferences = new HashMap>(); - Map mapNewSimpleNames = new HashMap(); + Map mapInnerClasses = new HashMap<>(); + Map> mapNestedClassReferences = new HashMap<>(); + Map> mapEnclosingClassReferences = new HashMap<>(); + Map mapNewSimpleNames = new HashMap<>(); boolean bDecompileInner = DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_INNER); @@ -116,14 +116,14 @@ public class ClassesProcessor { // reference to the nested class Set set = mapNestedClassReferences.get(enclClassName); if (set == null) { - mapNestedClassReferences.put(enclClassName, set = new HashSet()); + 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()); + mapEnclosingClassReferences.put(innerName, set = new HashSet<>()); } set.add(enclClassName); } @@ -143,8 +143,8 @@ public class ClassesProcessor { for (Entry ent : mapRootClasses.entrySet()) { // root class? if (!mapInnerClasses.containsKey(ent.getKey())) { - Set setVisited = new HashSet(); - LinkedList stack = new LinkedList(); + Set setVisited = new HashSet<>(); + LinkedList 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 mapFieldsToVars = new HashMap(); + public final Map mapFieldsToVars = new HashMap<>(); public VarType anonymousClassType; - public final List nested = new ArrayList(); - public final Set enclosingClasses = new HashSet(); + public final List nested = new ArrayList<>(); + public final Set enclosingClasses = new HashSet<>(); public ClassNode parent; public LambdaInformation lambdaInformation; public boolean namelessConstructorStub = false; diff --git a/src/org/jetbrains/java/decompiler/main/DecompilerContext.java b/src/org/jetbrains/java/decompiler/main/DecompilerContext.java index c31c57a..39619ce 100644 --- a/src/org/jetbrains/java/decompiler/main/DecompilerContext.java +++ b/src/org/jetbrains/java/decompiler/main/DecompilerContext.java @@ -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 currentContext = new ThreadLocal(); + private static final ThreadLocal currentContext = new ThreadLocal<>(); private final Map properties; private StructContext structContext; @@ -52,7 +52,7 @@ public class DecompilerContext { } public static void initContext(Map propertiesCustom) { - Map properties = new HashMap(IFernflowerPreferences.DEFAULTS); + Map properties = new HashMap<>(IFernflowerPreferences.DEFAULTS); if (propertiesCustom != null) { properties.putAll(propertiesCustom); } diff --git a/src/org/jetbrains/java/decompiler/main/InitializerProcessor.java b/src/org/jetbrains/java/decompiler/main/InitializerProcessor.java index 206b669..18a13d9 100644 --- a/src/org/jetbrains/java/decompiler/main/InitializerProcessor.java +++ b/src/org/jetbrains/java/decompiler/main/InitializerProcessor.java @@ -156,8 +156,8 @@ public class InitializerProcessor { boolean isAnonymous = DecompilerContext.getClassProcessor().getMapRootClasses().get(cl.qualifiedName).type == ClassNode.CLASS_ANONYMOUS; - List> lstFirst = new ArrayList>(); - List lstMethodWrappers = new ArrayList(); + List> lstFirst = new ArrayList<>(); + List lstMethodWrappers = new ArrayList<>(); for (MethodWrapper method : wrapper.getMethods()) { if (CodeConstants.INIT_NAME.equals(method.methodStruct.getName()) && method.root != null) { // successfully decompiled constructor diff --git a/src/org/jetbrains/java/decompiler/main/TextBuffer.java b/src/org/jetbrains/java/decompiler/main/TextBuffer.java index 952b26f..4e0b09a 100644 --- a/src/org/jetbrains/java/decompiler/main/TextBuffer.java +++ b/src/org/jetbrains/java/decompiler/main/TextBuffer.java @@ -105,7 +105,7 @@ public class TextBuffer { int currentLine = 0; int previousMarkLine = 0; int dumpedLines = 0; - ArrayList linesWithMarks = new ArrayList(myLineToOffsetMapping.keySet()); + ArrayList 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 newMap = new HashMap(); + HashMap newMap = new HashMap<>(); for (Map.Entry 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 newMap = new HashMap(); + HashMap newMap = new HashMap<>(); for (Map.Entry 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(); + myLineToOffsetMapping = new HashMap<>(); } } @@ -264,7 +264,7 @@ public class TextBuffer { if (srcLines.size() < 2 || srcLines.size() <= requiredLineNumber) { return srcLines; } - List res = new LinkedList(srcLines); + List 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>(); + myLineMapping = new HashMap<>(); for (int i = 0; i < lineMapping.length; i += 2) { int key = lineMapping[i + 1]; Set existing = myLineMapping.get(key); if (existing == null) { - existing = new TreeSet(); + existing = new TreeSet<>(); myLineMapping.put(key, existing); } existing.add(lineMapping[i]); diff --git a/src/org/jetbrains/java/decompiler/main/collectors/BytecodeMappingTracer.java b/src/org/jetbrains/java/decompiler/main/collectors/BytecodeMappingTracer.java index a72f988..18e1b78 100644 --- a/src/org/jetbrains/java/decompiler/main/collectors/BytecodeMappingTracer.java +++ b/src/org/jetbrains/java/decompiler/main/collectors/BytecodeMappingTracer.java @@ -25,7 +25,7 @@ public class BytecodeMappingTracer { private int currentSourceLine; private StructLineNumberTableAttribute lineNumberTable = null; - private final Map mapping = new HashMap(); // bytecode offset, source line + private final Map mapping = new HashMap<>(); // bytecode offset, source line public BytecodeMappingTracer() { } @@ -81,7 +81,7 @@ public class BytecodeMappingTracer { this.lineNumberTable = lineNumberTable; } - private final Set unmappedLines = new HashSet(); + private final Set unmappedLines = new HashSet<>(); public Set getUnmappedLines() { return unmappedLines; @@ -92,7 +92,7 @@ public class BytecodeMappingTracer { return Collections.emptyMap(); } - Map res = new HashMap(); + Map res = new HashMap<>(); // first match offsets from line number table int[] data = lineNumberTable.getRawData(); diff --git a/src/org/jetbrains/java/decompiler/main/collectors/BytecodeSourceMapper.java b/src/org/jetbrains/java/decompiler/main/collectors/BytecodeSourceMapper.java index 8d3770b..8531f50 100644 --- a/src/org/jetbrains/java/decompiler/main/collectors/BytecodeSourceMapper.java +++ b/src/org/jetbrains/java/decompiler/main/collectors/BytecodeSourceMapper.java @@ -26,21 +26,21 @@ public class BytecodeSourceMapper { private int offset_total; // class, method, bytecode offset, source line - private final Map>> mapping = new LinkedHashMap>>(); + private final Map>> mapping = new LinkedHashMap<>(); // original line to decompiled line - private final Map linesMapping = new HashMap(); - private final Set unmappedLines = new TreeSet(); + private final Map linesMapping = new HashMap<>(); + private final Set unmappedLines = new TreeSet<>(); public void addMapping(String className, String methodName, int bytecodeOffset, int sourceLine) { Map> class_mapping = mapping.get(className); if (class_mapping == null) { - mapping.put(className, class_mapping = new LinkedHashMap>()); // need to preserve order + mapping.put(className, class_mapping = new LinkedHashMap<>()); // need to preserve order } Map method_mapping = class_mapping.get(methodName); if (method_mapping == null) { - class_mapping.put(methodName, method_mapping = new HashMap()); + 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 lstBytecodeOffsets = new ArrayList(method_mapping.keySet()); + List 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 sorted = new TreeMap(linesMapping); + Map sorted = new TreeMap<>(linesMapping); for (Entry entry : sorted.entrySet()) { buffer.append(entry.getKey()).append(" <-> ").append(entry.getValue() + offset_total + 1).appendLineSeparator(); } diff --git a/src/org/jetbrains/java/decompiler/main/collectors/ImportCollector.java b/src/org/jetbrains/java/decompiler/main/collectors/ImportCollector.java index eea621b..cb13140 100644 --- a/src/org/jetbrains/java/decompiler/main/collectors/ImportCollector.java +++ b/src/org/jetbrains/java/decompiler/main/collectors/ImportCollector.java @@ -26,8 +26,8 @@ import java.util.Map.Entry; public class ImportCollector { private static final String JAVA_LANG_PACKAGE = "java.lang"; - private final Map mapSimpleNames = new HashMap(); - private final Set setNotImportedNames = new HashSet(); + private final Map mapSimpleNames = new HashMap<>(); + private final Set setNotImportedNames = new HashSet<>(); private final String currentPackageSlash; private final String currentPackagePoint; @@ -124,7 +124,7 @@ public class ImportCollector { } private List packImports() { - List> lst = new ArrayList>(mapSimpleNames.entrySet()); + List> 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 res = new ArrayList(); + List res = new ArrayList<>(); for (Entry ent : lst) { // exclude a current class or one of the nested ones, java.lang and empty packages if (!setNotImportedNames.contains(ent.getKey()) && diff --git a/src/org/jetbrains/java/decompiler/main/collectors/VarNamesCollector.java b/src/org/jetbrains/java/decompiler/main/collectors/VarNamesCollector.java index 33bf42c..05aac72 100644 --- a/src/org/jetbrains/java/decompiler/main/collectors/VarNamesCollector.java +++ b/src/org/jetbrains/java/decompiler/main/collectors/VarNamesCollector.java @@ -20,7 +20,7 @@ import java.util.Set; public class VarNamesCollector { - private final Set usedNames = new HashSet(); + private final Set usedNames = new HashSet<>(); public VarNamesCollector() { } diff --git a/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java b/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java index ea08023..8925ad7 100644 --- a/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java +++ b/src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java @@ -41,9 +41,9 @@ public class ConsoleDecompiler implements IBytecodeProvider, IResultSaver { return; } - Map mapOptions = new HashMap(); - List lstSources = new ArrayList(); - List lstLibraries = new ArrayList(); + Map mapOptions = new HashMap<>(); + List lstSources = new ArrayList<>(); + List 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 mapArchiveStreams = new HashMap(); - private final Map> mapArchiveEntries = new HashMap>(); + private final Map mapArchiveStreams = new HashMap<>(); + private final Map> mapArchiveEntries = new HashMap<>(); @SuppressWarnings("UseOfSystemOutOrSystemErr") public ConsoleDecompiler(File destination, Map options) { @@ -266,7 +266,7 @@ public class ConsoleDecompiler implements IBytecodeProvider, IResultSaver { private boolean checkEntry(String entryName, String file) { Set set = mapArchiveEntries.get(file); if (set == null) { - mapArchiveEntries.put(file, set = new HashSet()); + mapArchiveEntries.put(file, set = new HashSet<>()); } boolean added = set.add(entryName); diff --git a/src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java b/src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java index ef09bd0..39adbc9 100644 --- a/src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java +++ b/src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java @@ -40,10 +40,10 @@ import java.util.Set; public class ClassWrapper { private final StructClass classStruct; - private final Set hiddenMembers = new HashSet(); - private final VBStyleCollection staticFieldInitializers = new VBStyleCollection(); - private final VBStyleCollection dynamicFieldInitializers = new VBStyleCollection(); - private final VBStyleCollection methods = new VBStyleCollection(); + private final Set hiddenMembers = new HashSet<>(); + private final VBStyleCollection staticFieldInitializers = new VBStyleCollection<>(); + private final VBStyleCollection dynamicFieldInitializers = new VBStyleCollection<>(); + private final VBStyleCollection 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 setFieldNames = new HashSet(); + Set setFieldNames = new HashSet<>(); for (StructField fd : classStruct.getFields()) { setFieldNames.add(fd.getName()); } diff --git a/src/org/jetbrains/java/decompiler/main/rels/LambdaProcessor.java b/src/org/jetbrains/java/decompiler/main/rels/LambdaProcessor.java index b5ac0fb..0063a15 100644 --- a/src/org/jetbrains/java/decompiler/main/rels/LambdaProcessor.java +++ b/src/org/jetbrains/java/decompiler/main/rels/LambdaProcessor.java @@ -78,7 +78,7 @@ public class LambdaProcessor { return false; // no lambda bootstrap constant found } - Map mapMethodsLambda = new HashMap(); + Map mapMethodsLambda = new HashMap<>(); // iterate over code and find invocations of bootstrap methods. Replace them with anonymous classes. for (StructMethod mt : cl.getMethods()) { diff --git a/src/org/jetbrains/java/decompiler/main/rels/MethodWrapper.java b/src/org/jetbrains/java/decompiler/main/rels/MethodWrapper.java index eb397d1..3060c73 100644 --- a/src/org/jetbrains/java/decompiler/main/rels/MethodWrapper.java +++ b/src/org/jetbrains/java/decompiler/main/rels/MethodWrapper.java @@ -31,7 +31,7 @@ public class MethodWrapper { public final VarProcessor varproc; public final StructMethod methodStruct; public final CounterContainer counter; - public final HashSet setOuterVarNames = new HashSet(); + public final HashSet setOuterVarNames = new HashSet<>(); public DirectGraph graph; public List signatureFields; diff --git a/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java b/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java index c529a44..12e2de1 100644 --- a/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java +++ b/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java @@ -130,7 +130,7 @@ public class NestedClassProcessor { method.varproc.setVarName(new VarVersionPair(0, 0), parent.simpleName + ".this"); } - final Map mapNewNames = new HashMap(); + final Map mapNewNames = new HashMap<>(); enclosingMethod.getOrBuildGraph().iterateExprents(new DirectGraph.ExprentIterator() { @Override @@ -168,7 +168,7 @@ public class NestedClassProcessor { }); // update names of local variables - Set setNewOuterNames = new HashSet(mapNewNames.values()); + Set 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 copy = new ArrayList(node.nested); + List 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 setEnclosing = child.enclosingClasses; - LinkedList stack = new LinkedList(); + LinkedList 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>> mapVarMasks = new HashMap>>(); + final Map>> mapVarMasks = new HashMap<>(); int clTypes = 0; @@ -274,7 +274,7 @@ public class NestedClassProcessor { } // local var masks - final Map>> mapVarFieldPairs = new HashMap>>(); + final Map>> mapVarFieldPairs = new HashMap<>(); if (clTypes != ClassNode.CLASS_MEMBER) { // iterate enclosing class @@ -298,10 +298,10 @@ public class NestedClassProcessor { List mask = mapVarMasks.get(refClassName).get(constructor.getStringDescriptor()); if (!mapVarFieldPairs.containsKey(refClassName)) { - mapVarFieldPairs.put(refClassName, new HashMap>()); + mapVarFieldPairs.put(refClassName, new HashMap<>()); } - List lstTemp = new ArrayList(); + List 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 mask : mapVarFieldPairs.get(enclosing.getKey()).values()) { if (interPairMask == null) { - interPairMask = new ArrayList(mask); + interPairMask = new ArrayList<>(mask); } else { mergeListSignatures(interPairMask, mask, false); @@ -368,7 +368,7 @@ public class NestedClassProcessor { // merge all constructors for (List mask : enclosing.getValue().values()) { if (interMask == null) { - interMask = new ArrayList(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(interMask) : new ArrayList(); + 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(); + 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 mapNewNames = new HashMap(); // local var names - Map mapNewTypes = new HashMap(); // local var types + Map mapNewNames = new HashMap<>(); // local var names + Map mapNewTypes = new HashMap<>(); // local var types - final Map mapParamsToNewVars = new HashMap(); + final Map 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 mapFieldsToNewVars = new HashMap(); + final Map mapFieldsToNewVars = new HashMap<>(); for (ClassNode classNode = child; classNode != null; classNode = classNode.parent) { for (Entry entry : classNode.mapFieldsToVars.entrySet()) { VarVersionPair newVar = new VarVersionPair(method.counter.getCounterAndIncrement(CounterContainer.VAR_COUNTER), 0); @@ -503,7 +503,7 @@ public class NestedClassProcessor { } } - Set setNewOuterNames = new HashSet(mapNewNames.values()); + Set 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> getMaskLocalVars(ClassWrapper wrapper) { - Map> mapMasks = new HashMap>(); + Map> 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 fields = new ArrayList(); + List 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 setStats = new HashSet(); + Set 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 setStats) { - LinkedList stack = new LinkedList(); + LinkedList 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 setStats) { - List lst = new ArrayList(); + List lst = new ArrayList<>(); Statement retStat = null; if (stat.getExprents() == null) { diff --git a/src/org/jetbrains/java/decompiler/main/rels/NestedMemberAccess.java b/src/org/jetbrains/java/decompiler/main/rels/NestedMemberAccess.java index e7e0f01..a460ef9 100644 --- a/src/org/jetbrains/java/decompiler/main/rels/NestedMemberAccess.java +++ b/src/org/jetbrains/java/decompiler/main/rels/NestedMemberAccess.java @@ -36,7 +36,7 @@ public class NestedMemberAccess { private enum MethodAccess {NORMAL, FIELD_GET, FIELD_SET, METHOD, FUNCTION} private boolean noSynthFlag; - private final Map mapMethodType = new HashMap(); + private final Map mapMethodType = new HashMap<>(); public void propagateMemberAccess(ClassNode root) { @@ -231,8 +231,8 @@ public class NestedMemberAccess { DirectGraph graph = meth.getOrBuildGraph(); - HashSet setVisited = new HashSet(); - LinkedList stack = new LinkedList(); + HashSet setVisited = new HashSet<>(); + LinkedList stack = new LinkedList<>(); stack.add(graph.first); while (!stack.isEmpty()) { // TODO: replace with interface iterator? diff --git a/src/org/jetbrains/java/decompiler/modules/code/DeadCodeHelper.java b/src/org/jetbrains/java/decompiler/modules/code/DeadCodeHelper.java index d79367f..2522489 100644 --- a/src/org/jetbrains/java/decompiler/modules/code/DeadCodeHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/code/DeadCodeHelper.java @@ -30,8 +30,8 @@ public class DeadCodeHelper { public static void removeDeadBlocks(ControlFlowGraph graph) { - LinkedList stack = new LinkedList(); - HashSet setStacked = new HashSet(); + LinkedList stack = new LinkedList<>(); + HashSet setStacked = new HashSet<>(); stack.add(graph.getFirst()); setStacked.add(graph.getFirst()); @@ -39,7 +39,7 @@ public class DeadCodeHelper { while (!stack.isEmpty()) { BasicBlock block = stack.removeFirst(); - List lstSuccs = new ArrayList(block.getSuccs()); + List lstSuccs = new ArrayList<>(block.getSuccs()); lstSuccs.addAll(block.getSuccExceptions()); for (BasicBlock succ : lstSuccs) { @@ -50,7 +50,7 @@ public class DeadCodeHelper { } } - HashSet setAllBlocks = new HashSet(graph.getBlocks()); + HashSet setAllBlocks = new HashSet<>(graph.getBlocks()); setAllBlocks.removeAll(setStacked); for (BasicBlock block : setAllBlocks) { @@ -94,7 +94,7 @@ public class DeadCodeHelper { } } - HashSet setExits = new HashSet(graph.getLast().getPreds()); + HashSet setExits = new HashSet<>(graph.getLast().getPreds()); if (block.getPredExceptions().isEmpty() && (!setExits.contains(block) || block.getPreds().size() == 1)) { @@ -109,15 +109,15 @@ public class DeadCodeHelper { } } - HashSet setPreds = new HashSet(block.getPreds()); - HashSet setSuccs = new HashSet(block.getSuccs()); + HashSet setPreds = new HashSet<>(block.getPreds()); + HashSet setSuccs = new HashSet<>(block.getSuccs()); // collect common exception ranges of predecessors and successors HashSet setCommonExceptionHandlers = null; for (int i = 0; i < 2; ++i) { for (BasicBlock pred : i == 0 ? setPreds : setSuccs) { if (setCommonExceptionHandlers == null) { - setCommonExceptionHandlers = new HashSet(pred.getSuccExceptions()); + setCommonExceptionHandlers = new HashSet<>(pred.getSuccExceptions()); } else { setCommonExceptionHandlers.retainAll(pred.getSuccExceptions()); @@ -159,7 +159,7 @@ public class DeadCodeHelper { BasicBlock pred = block.getPreds().get(0); pred.removeSuccessor(block); - List lstSuccs = new ArrayList(block.getSuccs()); + List lstSuccs = new ArrayList<>(block.getSuccs()); for (BasicBlock succ : lstSuccs) { block.removeSuccessor(succ); pred.addSuccessor(succ); @@ -205,13 +205,13 @@ public class DeadCodeHelper { public static boolean isDominator(ControlFlowGraph graph, BasicBlock block, BasicBlock dom) { - HashSet marked = new HashSet(); + HashSet marked = new HashSet<>(); if (block == dom) { return true; } - LinkedList lstNodes = new LinkedList(); + LinkedList lstNodes = new LinkedList<>(); lstNodes.add(block); while (!lstNodes.isEmpty()) { @@ -262,7 +262,7 @@ public class DeadCodeHelper { public static void connectDummyExitBlock(ControlFlowGraph graph) { BasicBlock exit = graph.getLast(); - for (BasicBlock block : new HashSet(exit.getPreds())) { + for (BasicBlock block : new HashSet<>(exit.getPreds())) { exit.removePredecessor(block); block.addSuccessor(exit); } @@ -311,8 +311,8 @@ public class DeadCodeHelper { if (!block.getPreds().isEmpty()) { - HashSet setPredHandlersUnion = new HashSet(); - HashSet setPredHandlersIntersection = new HashSet(); + HashSet setPredHandlersUnion = new HashSet<>(); + HashSet setPredHandlersIntersection = new HashSet<>(); boolean firstpred = true; for (BasicBlock pred : block.getPreds()) { @@ -339,7 +339,7 @@ public class DeadCodeHelper { } // remove redundant ranges - HashSet setRangesToBeRemoved = new HashSet(block.getSuccExceptions()); + HashSet setRangesToBeRemoved = new HashSet<>(block.getSuccExceptions()); setRangesToBeRemoved.removeAll(setPredHandlersUnion); for (BasicBlock handler : setRangesToBeRemoved) { @@ -369,7 +369,7 @@ public class DeadCodeHelper { } // remove superfluous ranges from successors - for (BasicBlock succ : new HashSet(block.getSuccExceptions())) { + for (BasicBlock succ : new HashSet<>(block.getSuccExceptions())) { if (!bpred.getSuccExceptions().contains(succ)) { ExceptionRangeCFG range = graph.getExceptionRange(succ, block); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/ClearStructHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/ClearStructHelper.java index c6495e6..30d39fb 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/ClearStructHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/ClearStructHelper.java @@ -25,7 +25,7 @@ public class ClearStructHelper { public static void clearStatements(RootStatement root) { - LinkedList stack = new LinkedList(); + LinkedList stack = new LinkedList<>(); stack.add(root); while (!stack.isEmpty()) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/ConcatenationHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/ConcatenationHelper.java index 90d2732..aea5afa 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/ConcatenationHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/ConcatenationHelper.java @@ -70,7 +70,7 @@ public class ConcatenationHelper { // iterate in depth, collecting possible operands - List lstOperands = new ArrayList(); + List lstOperands = new ArrayList<>(); while (true) { @@ -160,7 +160,7 @@ public class ConcatenationHelper { if (constant.type == CodeConstants.CONSTANT_String) { String recipe = ((PrimitiveConstant)constant).getString(); - List res = new ArrayList(); + List res = new ArrayList<>(); StringBuilder acc = new StringBuilder(); int parameterId = 0; for (int i = 0; i < recipe.length(); i++) { @@ -195,7 +195,7 @@ public class ConcatenationHelper { return res; } } - return new ArrayList(parameters); + return new ArrayList<>(parameters); } private static boolean isAppendConcat(InvocationExprent expr, VarType cltype) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/DecHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/DecHelper.java index 9c719db..3dc4cf0 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/DecHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/DecHelper.java @@ -25,9 +25,9 @@ public class DecHelper { public static boolean checkStatementExceptions(List lst) { - Set all = new HashSet(lst); + Set all = new HashSet<>(lst); - Set handlers = new HashSet(); + Set handlers = new HashSet<>(); Set intersection = null; for (Statement stat : lst) { @@ -37,7 +37,7 @@ public class DecHelper { intersection = setNew; } else { - HashSet interclone = new HashSet(intersection); + HashSet interclone = new HashSet<>(intersection); interclone.removeAll(setNew); intersection.retainAll(setNew); @@ -197,7 +197,7 @@ public class DecHelper { public static HashSet getUniquePredExceptions(Statement head) { - HashSet setHandlers = new HashSet(head.getNeighbours(StatEdge.TYPE_EXCEPTION, Statement.DIRECTION_FORWARD)); + HashSet setHandlers = new HashSet<>(head.getNeighbours(StatEdge.TYPE_EXCEPTION, Statement.DIRECTION_FORWARD)); Iterator it = setHandlers.iterator(); while (it.hasNext()) { @@ -209,7 +209,7 @@ public class DecHelper { } public static List copyExprentList(List lst) { - List ret = new ArrayList(); + List ret = new ArrayList<>(); for (Exprent expr : lst) { ret.add(expr.copy()); } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/DomHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/DomHelper.java index 00eea78..ea8e537 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/DomHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/DomHelper.java @@ -35,7 +35,7 @@ public class DomHelper { private static RootStatement graphToStatement(ControlFlowGraph graph) { - VBStyleCollection stats = new VBStyleCollection(); + VBStyleCollection stats = new VBStyleCollection<>(); VBStyleCollection blocks = graph.getBlocks(); for (BasicBlock block : blocks) { @@ -103,14 +103,14 @@ public class DomHelper { public static VBStyleCollection, Integer> calcPostDominators(Statement container) { - HashMap> lists = new HashMap>(); + HashMap> lists = new HashMap<>(); StrongConnectivityHelper schelper = new StrongConnectivityHelper(container); List> components = schelper.getComponents(); List lstStats = container.getPostReversePostOrderList(StrongConnectivityHelper.getExitReps(components)); - FastFixedSetFactory factory = new FastFixedSetFactory(lstStats); + FastFixedSetFactory factory = new FastFixedSetFactory<>(lstStats); FastFixedSet setFlagNodes = factory.spawnEmptySet(); setFlagNodes.setAllElements(); @@ -176,17 +176,17 @@ public class DomHelper { } while (!setFlagNodes.isEmpty()); - VBStyleCollection, Integer> ret = new VBStyleCollection, Integer>(); + VBStyleCollection, Integer> ret = new VBStyleCollection<>(); List lstRevPost = container.getReversePostOrderList(); // sort order crucial! - final HashMap mapSortOrder = new HashMap(); + final HashMap mapSortOrder = new HashMap<>(); for (int i = 0; i < lstRevPost.size(); i++) { mapSortOrder.put(lstRevPost.get(i).id, i); } for (Statement st : lstStats) { - List lstPosts = new ArrayList(); + List lstPosts = new ArrayList<>(); for (Statement stt : lists.get(st)) { lstPosts.add(stt.id); } @@ -207,7 +207,7 @@ public class DomHelper { RootStatement root = graphToStatement(graph); - if (!processStatement(root, new HashMap>())) { + if (!processStatement(root, new HashMap<>())) { // try { // DotExporter.toDotFile(root.getFirst().getStats().get(13), new File("c:\\Temp\\stat1.dot")); @@ -217,7 +217,7 @@ public class DomHelper { throw new RuntimeException("parsing failure!"); } - LabelHelper.lowContinueLabels(root, new HashSet()); + LabelHelper.lowContinueLabels(root, new HashSet<>()); SequenceHelper.condenseSequences(root); root.buildMonitorFlags(); @@ -287,7 +287,7 @@ public class DomHelper { SynchronizedStatement sync = new SynchronizedStatement(current, ca.getFirst(), ca.getHandler()); sync.setAllParent(); - for (StatEdge edge : new HashSet(ca.getLabelEdges())) { + for (StatEdge edge : new HashSet<>(ca.getLabelEdges())) { sync.addLabeledEdge(edge); } @@ -357,7 +357,7 @@ public class DomHelper { // DotExporter.toDotFile(general, new File("c:\\Temp\\stat1.dot")); // } catch(Exception ex) {ex.printStackTrace();} - mapExtPost = new HashMap>(); + mapExtPost = new HashMap<>(); mapRefreshed = true; } @@ -378,7 +378,7 @@ public class DomHelper { Statement stat = findGeneralStatement(general, forceall, mapExtPost); if (stat != null) { - boolean complete = processStatement(stat, general.getFirst() == stat ? mapExtPost : new HashMap>()); + boolean complete = processStatement(stat, general.getFirst() == stat ? mapExtPost : new HashMap<>()); if (complete) { // replace general purpose statement with simple one @@ -388,7 +388,7 @@ public class DomHelper { return false; } - mapExtPost = new HashMap>(); + mapExtPost = new HashMap<>(); mapRefreshed = true; reducibility = 0; } @@ -409,7 +409,7 @@ public class DomHelper { break; } else { - mapExtPost = new HashMap>(); + mapExtPost = new HashMap<>(); } } @@ -427,13 +427,13 @@ public class DomHelper { } if (forceall) { - vbPost = new VBStyleCollection, Integer>(); + vbPost = new VBStyleCollection<>(); List lstAll = stat.getPostReversePostOrderList(); for (Statement st : lstAll) { Set set = mapExtPost.get(st.id); if (set != null) { - vbPost.addWithKey(new ArrayList(set), st.id); // FIXME: sort order!! + vbPost.addWithKey(new ArrayList<>(set), st.id); // FIXME: sort order!! } } @@ -443,7 +443,7 @@ public class DomHelper { for (Integer id : setFirst) { List lst = vbPost.getWithKey(id); if (lst == null) { - vbPost.addWithKey(lst = new ArrayList(), id); + vbPost.addWithKey(lst = new ArrayList<>(), id); } lst.add(id); } @@ -482,11 +482,11 @@ public class DomHelper { boolean same = (post == head); - HashSet setNodes = new HashSet(); - HashSet setPreds = new HashSet(); + HashSet setNodes = new HashSet<>(); + HashSet setPreds = new HashSet<>(); // collect statement nodes - HashSet setHandlers = new HashSet(); + HashSet setHandlers = new HashSet<>(); setHandlers.add(head); while (true) { @@ -504,7 +504,7 @@ public class DomHelper { } if (addhd) { - LinkedList lstStack = new LinkedList(); + LinkedList lstStack = new LinkedList<>(); lstStack.add(handler); while (!lstStack.isEmpty()) { @@ -618,14 +618,14 @@ public class DomHelper { // update the postdominator map if (!mapExtPost.isEmpty()) { - HashSet setOldNodes = new HashSet(); + HashSet setOldNodes = new HashSet<>(); for (Statement old : result.getStats()) { setOldNodes.add(old.id); } Integer newid = result.id; - for (Integer key : new ArrayList(mapExtPost.keySet())) { + for (Integer key : new ArrayList<>(mapExtPost.keySet())) { Set set = mapExtPost.get(key); int oldsize = set.size(); @@ -634,7 +634,7 @@ public class DomHelper { if (setOldNodes.contains(key)) { Set setNew = mapExtPost.get(newid); if (setNew == null) { - mapExtPost.put(newid, setNew = new HashSet()); + mapExtPost.put(newid, setNew = new HashSet<>()); } setNew.addAll(set); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/EliminateLoopsHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/EliminateLoopsHelper.java index 16f7da0..3bad6c6 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/EliminateLoopsHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/EliminateLoopsHelper.java @@ -76,7 +76,7 @@ public class EliminateLoopsHelper { } // collect relevant break edges - List lstBreakEdges = new ArrayList(); + List lstBreakEdges = new ArrayList<>(); for (StatEdge edge : loop.getLabelEdges()) { if (edge.getType() == StatEdge.TYPE_BREAK) { // all break edges are explicit because of LOOP_DO type lstBreakEdges.add(edge); @@ -99,8 +99,8 @@ public class EliminateLoopsHelper { if (!lstBreakEdges.isEmpty()) { if (firstok) { - HashMap statLabeled = new HashMap(); - List lstEdgeClosures = new ArrayList(); + HashMap statLabeled = new HashMap<>(); + List lstEdgeClosures = new ArrayList<>(); for (StatEdge edge : lstBreakEdges) { Statement minclosure = LowBreakHelper.getMinClosure(loopcontent, edge.getSource()); @@ -193,7 +193,7 @@ public class EliminateLoopsHelper { private static void eliminateLoop(Statement loop, Statement parentloop) { // move continue edges to the parent loop - List lst = new ArrayList(loop.getLabelEdges()); + List lst = new ArrayList<>(loop.getLabelEdges()); for (StatEdge edge : lst) { loop.removePredecessor(edge); edge.getSource().changeEdgeNode(Statement.DIRECTION_FORWARD, edge, parentloop); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/ExitHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/ExitHelper.java index 6d0d381..26a3b23 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/ExitHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/ExitHelper.java @@ -61,7 +61,7 @@ public class ExitHelper { set.remove(secondlast); if (set.isEmpty()) { - last.setExprents(new ArrayList()); + last.setExprents(new ArrayList<>()); found = true; break; } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java index 71e2231..5931826 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java @@ -46,7 +46,7 @@ public class ExprProcessor implements CodeConstants { public static final String UNKNOWN_TYPE_STRING = ""; public static final String NULL_TYPE_STRING = ""; - private static final Map mapConsts = new HashMap(); + private static final Map mapConsts = new HashMap<>(); static { mapConsts.put(opc_arraylength, FunctionExprent.FUNCTION_ARRAY_LENGTH); mapConsts.put(opc_checkcast, FunctionExprent.FUNCTION_CAST); @@ -120,32 +120,32 @@ public class ExprProcessor implements CodeConstants { DirectGraph dgraph = flatthelper.buildDirectGraph(root); // collect finally entry points - Set setFinallyShortRangeEntryPoints = new HashSet(); + Set setFinallyShortRangeEntryPoints = new HashSet<>(); for (List lst : dgraph.mapShortRangeFinallyPaths.values()) { for (FinallyPathWrapper finwrap : lst) { setFinallyShortRangeEntryPoints.add(finwrap.entry); } } - Set setFinallyLongRangeEntryPaths = new HashSet(); + Set setFinallyLongRangeEntryPaths = new HashSet<>(); for (List lst : dgraph.mapLongRangeFinallyPaths.values()) { for (FinallyPathWrapper finwrap : lst) { setFinallyLongRangeEntryPaths.add(finwrap.source + "##" + finwrap.entry); } } - Map mapCatch = new HashMap(); + Map mapCatch = new HashMap<>(); collectCatchVars(root, flatthelper, mapCatch); - Map> mapData = new HashMap>(); + Map> mapData = new HashMap<>(); - LinkedList stack = new LinkedList(); - LinkedList> stackEntryPoint = new LinkedList>(); + LinkedList stack = new LinkedList<>(); + LinkedList> stackEntryPoint = new LinkedList<>(); stack.add(dgraph.first); - stackEntryPoint.add(new LinkedList()); + stackEntryPoint.add(new LinkedList<>()); - Map map = new HashMap(); + Map map = new HashMap<>(); map.put(null, new PrimitiveExprsList()); mapData.put(dgraph.first, map); @@ -187,10 +187,10 @@ public class ExprProcessor implements CodeConstants { Map mapSucc = mapData.get(nd); if (mapSucc == null) { - mapData.put(nd, mapSucc = new HashMap()); + mapData.put(nd, mapSucc = new HashMap<>()); } - LinkedList ndentrypoints = new LinkedList(entrypoints); + LinkedList ndentrypoints = new LinkedList<>(entrypoints); if (setFinallyLongRangeEntryPaths.contains(node.id + "##" + nd.id)) { ndentrypoints.addLast(node.id); @@ -641,7 +641,7 @@ public class ExprProcessor implements CodeConstants { int base = VarExprent.STACK_BASE + stack.size(); - LinkedList lst = new LinkedList(); + LinkedList lst = new LinkedList<>(); for (int i = -1; i >= offset; i--) { Exprent varex = stack.pop(); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java index d3e1d04..0123691 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java @@ -46,8 +46,8 @@ import java.util.*; import java.util.Map.Entry; public class FinallyProcessor { - private final Map finallyBlockIDs = new HashMap(); - private final Map catchallBlockIDs = new HashMap(); + private final Map finallyBlockIDs = new HashMap<>(); + private final Map catchallBlockIDs = new HashMap<>(); private final MethodDescriptor methodDescriptor; private final VarProcessor varProcessor; @@ -64,7 +64,7 @@ public class FinallyProcessor { private boolean processStatementEx(StructMethod mt, RootStatement root, ControlFlowGraph graph) { int bytecode_version = mt.getClassStruct().getBytecodeVersion(); - LinkedList stack = new LinkedList(); + LinkedList stack = new LinkedList<>(); stack.add(root); while (!stack.isEmpty()) { @@ -191,7 +191,7 @@ public class FinallyProcessor { } private Record getFinallyInformation(StructMethod mt, RootStatement root, CatchAllStatement fstat) { - Map mapLast = new HashMap(); + Map mapLast = new HashMap<>(); BasicBlockStatement firstBlockStatement = fstat.getHandler().getBasichead(); BasicBlock firstBasicBlock = firstBlockStatement.getBlock(); @@ -220,10 +220,10 @@ public class FinallyProcessor { FlattenStatementsHelper flatthelper = new FlattenStatementsHelper(); DirectGraph dgraph = flatthelper.buildDirectGraph(root); - LinkedList stack = new LinkedList(); + LinkedList stack = new LinkedList<>(); stack.add(dgraph.first); - Set setVisited = new HashSet(); + Set setVisited = new HashSet<>(); while (!stack.isEmpty()) { @@ -374,7 +374,7 @@ public class FinallyProcessor { Record information, int bytecode_version) { - Set setCopy = new HashSet(setTry); + Set setCopy = new HashSet<>(setTry); int finallytype = information.firstCode; Map mapLast = information.mapLast; @@ -464,7 +464,7 @@ public class FinallyProcessor { setCopy.add(newhead); setCopy.add(newheadinit); - for (BasicBlock hd : new HashSet(newheadinit.getSuccExceptions())) { + for (BasicBlock hd : new HashSet<>(newheadinit.getSuccExceptions())) { ExceptionRangeCFG range = graph.getExceptionRange(hd, newheadinit); if (setCopy.containsAll(range.getProtectedRange())) { @@ -477,7 +477,7 @@ public class FinallyProcessor { private static void insertBlockBefore(ControlFlowGraph graph, BasicBlock oldblock, BasicBlock newblock) { - List lstTemp = new ArrayList(); + List lstTemp = new ArrayList<>(); lstTemp.addAll(oldblock.getPreds()); lstTemp.addAll(oldblock.getPredExceptions()); @@ -510,7 +510,7 @@ public class FinallyProcessor { private static HashSet getAllBasicBlocks(Statement stat) { - List lst = new LinkedList(); + List lst = new LinkedList<>(); lst.add(stat); int index = 0; @@ -527,7 +527,7 @@ public class FinallyProcessor { } while (index < lst.size()); - HashSet res = new HashSet(); + HashSet res = new HashSet<>(); for (Statement st : lst) { res.add(((BasicBlockStatement)st).getBlock()); @@ -569,7 +569,7 @@ public class FinallyProcessor { } // identify start blocks - HashSet startBlocks = new HashSet(); + HashSet startBlocks = new HashSet<>(); for (BasicBlock block : tryBlocks) { startBlocks.addAll(block.getSuccs()); } @@ -578,7 +578,7 @@ public class FinallyProcessor { startBlocks.remove(graph.getLast()); startBlocks.removeAll(tryBlocks); - List lstAreas = new ArrayList(); + List lstAreas = new ArrayList<>(); for (BasicBlock start : startBlocks) { @@ -648,17 +648,17 @@ public class FinallyProcessor { public BlockStackEntry(BasicBlock blockCatch, BasicBlock blockSample, List lstStoreVars) { this.blockCatch = blockCatch; this.blockSample = blockSample; - this.lstStoreVars = new ArrayList(lstStoreVars); + this.lstStoreVars = new ArrayList<>(lstStoreVars); } } - List stack = new LinkedList(); + List stack = new LinkedList<>(); - Set setSample = new HashSet(); + Set setSample = new HashSet<>(); - Map mapNext = new HashMap(); + Map mapNext = new HashMap<>(); - stack.add(new BlockStackEntry(startCatch, startSample, new ArrayList())); + stack.add(new BlockStackEntry(startCatch, startSample, new ArrayList<>())); while (!stack.isEmpty()) { @@ -719,7 +719,7 @@ public class FinallyProcessor { if (instrCatch.opcode == CodeConstants.opc_astore && instrSample.opcode == CodeConstants.opc_astore) { - lst = new ArrayList(lst); + lst = new ArrayList<>(lst); lst.add(new int[]{instrCatch.getOperand(0), instrSample.getOperand(0)}); } } @@ -738,7 +738,7 @@ public class FinallyProcessor { } if (isLastBlock) { - Set setSuccs = new HashSet(blockSample.getSuccs()); + Set setSuccs = new HashSet<>(blockSample.getSuccs()); setSuccs.removeAll(setSample); for (BlockStackEntry stackent : stack) { @@ -753,7 +753,7 @@ public class FinallyProcessor { } } - return new Area(startSample, setSample, getUniqueNext(graph, new HashSet(mapNext.values()))); + return new Area(startSample, setSample, getUniqueNext(graph, new HashSet<>(mapNext.values()))); } private static BasicBlock getUniqueNext(ControlFlowGraph graph, Set setNext) { @@ -887,7 +887,7 @@ public class FinallyProcessor { if (seqPattern.length() < seqSample.length()) { // split in two blocks SimpleInstructionSequence seq = new SimpleInstructionSequence(); - LinkedList oldOffsets = new LinkedList(); + LinkedList oldOffsets = new LinkedList<>(); for (int i = seqSample.length() - 1; i >= seqPattern.length(); i--) { seq.addInstruction(0, seqSample.getInstr(i), -1); oldOffsets.addFirst(sample.getOldOffset(i)); @@ -898,7 +898,7 @@ public class FinallyProcessor { newblock.setSeq(seq); newblock.getInstrOldOffsets().addAll(oldOffsets); - List lstTemp = new ArrayList(); + List lstTemp = new ArrayList<>(); lstTemp.addAll(sample.getSuccs()); // move successors @@ -976,14 +976,14 @@ public class FinallyProcessor { } // collect common exception ranges of predecessors and successors - Set setCommonExceptionHandlers = new HashSet(next.getSuccExceptions()); + Set setCommonExceptionHandlers = new HashSet<>(next.getSuccExceptions()); for (BasicBlock pred : start.getPreds()) { setCommonExceptionHandlers.retainAll(pred.getSuccExceptions()); } boolean is_outside_range = false; - Set setPredecessors = new HashSet(start.getPreds()); + Set setPredecessors = new HashSet<>(start.getPreds()); // replace start with next for (BasicBlock pred : setPredecessors) { @@ -1005,7 +1005,7 @@ public class FinallyProcessor { is_outside_range = true; } - Set setRemovedExceptionRanges = new HashSet(); + Set setRemovedExceptionRanges = new HashSet<>(); for (BasicBlock handler : block.getSuccExceptions()) { setRemovedExceptionRanges.add(graph.getExceptionRange(handler, block)); } @@ -1020,7 +1020,7 @@ public class FinallyProcessor { // shift extern edges on splitted blocks if (block.getSeq().isEmpty() && block.getSuccs().size() == 1) { BasicBlock succs = block.getSuccs().get(0); - for (BasicBlock pred : new ArrayList(block.getPreds())) { + for (BasicBlock pred : new ArrayList<>(block.getPreds())) { if (!setBlocks.contains(pred)) { pred.replaceSuccessor(block, succs); } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/IfHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/IfHelper.java index 3adf70c..3a88aca 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/IfHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/IfHelper.java @@ -34,7 +34,7 @@ public class IfHelper { public static boolean mergeAllIfs(RootStatement root) { - boolean res = mergeAllIfsRec(root, new HashSet()); + boolean res = mergeAllIfsRec(root, new HashSet<>()); if (res) { SequenceHelper.condenseSequences(root); @@ -88,7 +88,7 @@ public class IfHelper { boolean updated = false; - List lst = new ArrayList(); + List lst = new ArrayList<>(); if (statement.type == Statement.TYPE_IF) { lst.add(statement); } @@ -196,7 +196,7 @@ public class IfHelper { // merge if conditions IfExprent statexpr = ifparent.getHeadexprent(); - List lstOperands = new ArrayList(); + List lstOperands = new ArrayList<>(); lstOperands.add(statexpr.getCondition()); lstOperands.add(ifchild.getHeadexprent().getCondition()); @@ -250,7 +250,7 @@ public class IfHelper { // merge if conditions IfExprent statexpr = ifparent.getHeadexprent(); - List lstOperands = new ArrayList(); + List lstOperands = new ArrayList<>(); lstOperands.add(statexpr.getCondition()); lstOperands.add(new FunctionExprent(FunctionExprent.FUNCTION_BOOL_NOT, ifchild.getHeadexprent().getCondition(), null)); statexpr.setCondition(new FunctionExprent(FunctionExprent.FUNCTION_CADD, lstOperands, null)); @@ -305,7 +305,7 @@ public class IfHelper { // merge if conditions IfExprent statexpr = secondif.getHeadexprent(); - List lstOperands = new ArrayList(); + List lstOperands = new ArrayList<>(); lstOperands.add(firstif.getHeadexprent().getCondition()); if (path == 2) { @@ -509,7 +509,7 @@ public class IfHelper { SequenceStatement sequence = (SequenceStatement)parent; // build and cut the new else statement - List lst = new ArrayList(); + List lst = new ArrayList<>(); for (int i = sequence.getStats().size() - 1; i >= 0; i--) { Statement sttemp = sequence.getStats().get(i); if (sttemp == ifstat) { @@ -597,7 +597,7 @@ public class IfHelper { SequenceStatement sequence = (SequenceStatement)parent; // build and cut the new else statement - List lst = new ArrayList(); + List lst = new ArrayList<>(); for (int i = sequence.getStats().size() - 1; i >= 0; i--) { Statement sttemp = sequence.getStats().get(i); if (sttemp == ifstat) { @@ -735,8 +735,8 @@ public class IfHelper { private static class IfNode { public final Statement value; - public final List succs = new ArrayList(); - public final List edgetypes = new ArrayList(); + public final List succs = new ArrayList<>(); + public final List edgetypes = new ArrayList<>(); public IfNode(Statement value) { this.value = value; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/InlineSingleBlockHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/InlineSingleBlockHelper.java index adeda02..205e25c 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/InlineSingleBlockHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/InlineSingleBlockHelper.java @@ -68,7 +68,7 @@ public class InlineSingleBlockHelper { Statement parent = source.getParent(); source.removeSuccessor(edge); - List lst = new ArrayList(); + List lst = new ArrayList<>(); for (int i = seq.getStats().size() - 1; i >= index; i--) { lst.add(0, seq.getStats().remove(i)); } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/LabelHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/LabelHelper.java index 26cc638..bba1484 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/LabelHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/LabelHelper.java @@ -33,7 +33,7 @@ public class LabelHelper { liftClosures(root); - lowContinueLabels(root, new HashSet()); + lowContinueLabels(root, new HashSet<>()); lowClosures(root); } @@ -63,7 +63,7 @@ public class LabelHelper { if (dest.type != Statement.TYPE_DUMMYEXIT) { Statement parent = dest.getParent(); - List lst = new ArrayList(); + List lst = new ArrayList<>(); if (parent.type == Statement.TYPE_SEQUENCE) { lst.addAll(parent.getStats()); } @@ -131,14 +131,14 @@ public class LabelHelper { lowContinueLabels(st, edges); } else { - lowContinueLabels(st, new HashSet()); + lowContinueLabels(st, new HashSet<>()); } } } public static void lowClosures(Statement stat) { - for (StatEdge edge : new ArrayList(stat.getLabelEdges())) { + for (StatEdge edge : new ArrayList<>(stat.getLabelEdges())) { if (edge.getType() == StatEdge.TYPE_BREAK) { // FIXME: ? for (Statement st : stat.getStats()) { @@ -181,7 +181,7 @@ public class LabelHelper { private static HashMap> setExplicitEdges(Statement stat) { - HashMap> mapEdges = new HashMap>(); + HashMap> mapEdges = new HashMap<>(); if (stat.getExprents() != null) { return mapEdges; @@ -279,7 +279,7 @@ public class LabelHelper { Statement stlast = swst.getCaseStatements().get(last); if (stlast.getExprents() != null && stlast.getExprents().isEmpty()) { StatEdge edge = stlast.getAllSuccessorEdges().get(0); - mapEdges.put(edge.getDestination(), new ArrayList(Arrays.asList(new StatEdge[]{edge}))); + mapEdges.put(edge.getDestination(), new ArrayList<>(Arrays.asList(new StatEdge[]{edge}))); } else { mapEdges = setExplicitEdges(stlast); @@ -340,7 +340,7 @@ public class LabelHelper { edge.explicit = false; } - mapEdges.put(newedge.getDestination(), new ArrayList(Arrays.asList(new StatEdge[]{newedge}))); + mapEdges.put(newedge.getDestination(), new ArrayList<>(Arrays.asList(new StatEdge[]{newedge}))); } } } @@ -388,7 +388,7 @@ public class LabelHelper { } if (statedge != null) { - mapEdges.put(statedge.getDestination(), new ArrayList(Arrays.asList(new StatEdge[]{statedge}))); + mapEdges.put(statedge.getDestination(), new ArrayList<>(Arrays.asList(new StatEdge[]{statedge}))); } } @@ -422,8 +422,8 @@ public class LabelHelper { private static HashSet[] processStatementLabel(Statement stat) { - HashSet setBreak = new HashSet(); - HashSet setContinue = new HashSet(); + HashSet setBreak = new HashSet<>(); + HashSet setContinue = new HashSet<>(); if (stat.getExprents() == null) { for (Statement st : stat.getStats()) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/LoopExtractHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/LoopExtractHelper.java index d5c9e8f..1fac826 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/LoopExtractHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/LoopExtractHelper.java @@ -189,7 +189,7 @@ public class LoopExtractHelper { loop.addSuccessor(new StatEdge(StatEdge.TYPE_REGULAR, loop, target)); - for (StatEdge edge : new ArrayList(block.getLabelEdges())) { + for (StatEdge edge : new ArrayList<>(block.getLabelEdges())) { if (edge.getType() == StatEdge.TYPE_CONTINUE || edge == ifedge) { loop.addLabeledEdge(edge); } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/MergeHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/MergeHelper.java index 71d3d79..0bc723d 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/MergeHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/MergeHelper.java @@ -185,7 +185,7 @@ public class MergeHelper { if (firstif == stat.getFirst()) { BasicBlockStatement bstat = new BasicBlockStatement(new BasicBlock( DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER))); - bstat.setExprents(new ArrayList()); + bstat.setExprents(new ArrayList<>()); stat.replaceStatement(firstif, bstat); } else { @@ -224,7 +224,7 @@ public class MergeHelper { if (firstif.getIfstat() == null) { BasicBlockStatement bstat = new BasicBlockStatement(new BasicBlock( DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER))); - bstat.setExprents(new ArrayList()); + bstat.setExprents(new ArrayList<>()); ifedge.setSource(bstat); bstat.addSuccessor(ifedge); @@ -382,7 +382,7 @@ public class MergeHelper { if (stat == dostat.getFirst()) { BasicBlockStatement bstat = new BasicBlockStatement(new BasicBlock( DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER))); - bstat.setExprents(new ArrayList()); + bstat.setExprents(new ArrayList<>()); dostat.replaceStatement(stat, bstat); } else { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/PPandMMHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/PPandMMHelper.java index 4eb366b..2371a72 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/PPandMMHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/PPandMMHelper.java @@ -38,10 +38,10 @@ public class PPandMMHelper { FlattenStatementsHelper flatthelper = new FlattenStatementsHelper(); DirectGraph dgraph = flatthelper.buildDirectGraph(root); - LinkedList stack = new LinkedList(); + LinkedList stack = new LinkedList<>(); stack.add(dgraph.first); - HashSet setVisited = new HashSet(); + HashSet setVisited = new HashSet<>(); boolean res = false; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/PrimitiveExprsList.java b/src/org/jetbrains/java/decompiler/modules/decompiler/PrimitiveExprsList.java index 0a1831e..fff1841 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/PrimitiveExprsList.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/PrimitiveExprsList.java @@ -22,7 +22,7 @@ import java.util.List; public class PrimitiveExprsList { - private final List lstExprents = new ArrayList(); + private final List lstExprents = new ArrayList<>(); private ExprentStack stack = new ExprentStack(); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/SecondaryFunctionsHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/SecondaryFunctionsHelper.java index 12aecbb..f95d2c3 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/SecondaryFunctionsHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/SecondaryFunctionsHelper.java @@ -43,7 +43,7 @@ public class SecondaryFunctionsHelper { FunctionExprent.FUNCTION_CADD }; - private static final HashMap mapNumComparisons = new HashMap(); + private static final HashMap mapNumComparisons = new HashMap<>(); static { mapNumComparisons.put(FunctionExprent.FUNCTION_EQ, @@ -102,7 +102,7 @@ public class SecondaryFunctionsHelper { while (replaced) { replaced = false; - List lstObjects = new ArrayList(stat.getExprents() == null ? stat.getSequentialObjects() : stat.getExprents()); + List lstObjects = new ArrayList<>(stat.getExprents() == null ? stat.getSequentialObjects() : stat.getExprents()); for (int i = 0; i < lstObjects.size(); i++) { Object obj = lstObjects.get(i); @@ -229,7 +229,7 @@ public class SecondaryFunctionsHelper { } if (val == -1) { - List lstBitNotOperand = new ArrayList(); + List lstBitNotOperand = new ArrayList<>(); lstBitNotOperand.add(lstOperands.get(1 - i)); return new FunctionExprent(FunctionExprent.FUNCTION_BIT_NOT, lstBitNotOperand, fexpr.bytecode); } @@ -250,7 +250,7 @@ public class SecondaryFunctionsHelper { return lstOperands.get(1 - i); } else { - List lstNotOperand = new ArrayList(); + List lstNotOperand = new ArrayList<>(); lstNotOperand.add(lstOperands.get(1 - i)); return new FunctionExprent(FunctionExprent.FUNCTION_BOOL_NOT, lstNotOperand, fexpr.bytecode); } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/SequenceHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/SequenceHelper.java index 75bbd39..05c7bd5 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/SequenceHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/SequenceHelper.java @@ -39,7 +39,7 @@ public class SequenceHelper { if (stat.type == Statement.TYPE_SEQUENCE) { - List lst = new ArrayList(); + List lst = new ArrayList<>(); lst.addAll(stat.getStats()); boolean unfolded = false; @@ -84,7 +84,7 @@ public class SequenceHelper { st.removeSuccessor(edge); } - for (StatEdge edge : new HashSet(st.getLabelEdges())) { + for (StatEdge edge : new HashSet<>(st.getLabelEdges())) { if (edge.getSource() != last) { last.addLabeledEdge(edge); } @@ -302,7 +302,7 @@ public class SequenceHelper { BasicBlockStatement bstat = new BasicBlockStatement(new BasicBlock( DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.STATEMENT_COUNTER))); if (stat.getExprents() == null) { - bstat.setExprents(new ArrayList()); + bstat.setExprents(new ArrayList<>()); } else { bstat.setExprents(DecHelper.copyExprentList(stat.getExprents())); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/SimplifyExprentsHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/SimplifyExprentsHelper.java index ddf6865..28b76e9 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/SimplifyExprentsHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/SimplifyExprentsHelper.java @@ -310,7 +310,7 @@ public class SimplifyExprentsHelper { VarExprent arrvar = (VarExprent)as.getLeft(); - HashMap mapInit = new HashMap(); + HashMap mapInit = new HashMap<>(); int i = 1; while (index + i < list.size() && i <= size) { @@ -350,7 +350,7 @@ public class SimplifyExprentsHelper { if ((arrvar.isStack() && fraction > 0) || (size <= 7 && fraction >= 0.3) || (size > 7 && fraction >= 0.7)) { - List lstRet = new ArrayList(); + List lstRet = new ArrayList<>(); VarType arrtype = newex.getNewType().decreaseArrayDim(); @@ -813,7 +813,7 @@ public class SimplifyExprentsHelper { } if (found) { - List data = new ArrayList(); + List data = new ArrayList<>(); data.addAll(stif.getFirst().getExprents()); data.add(new AssignmentExprent(ifvar, new FunctionExprent(FunctionExprent.FUNCTION_IIF, @@ -854,7 +854,7 @@ public class SimplifyExprentsHelper { return false; } - List data = new ArrayList(); + List data = new ArrayList<>(); data.addAll(stif.getFirst().getExprents()); data.add(new ExitExprent(ifex.getExitType(), new FunctionExprent(FunctionExprent.FUNCTION_IIF, @@ -918,7 +918,7 @@ public class SimplifyExprentsHelper { assfirst.replaceExprent(assfirst.getRight(), new ConstExprent(VarType.VARTYPE_CLASS, class_name, null)); - List data = new ArrayList(); + List data = new ArrayList<>(); data.addAll(stat.getFirst().getExprents()); stat.setExprents(data); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/StackVarsProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/StackVarsProcessor.java index 62d3465..ea52cb3 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/StackVarsProcessor.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/StackVarsProcessor.java @@ -39,7 +39,7 @@ public class StackVarsProcessor { public void simplifyStackVars(RootStatement root, StructMethod mt, StructClass cl) { - HashSet setReorderedIfs = new HashSet(); + HashSet setReorderedIfs = new HashSet<>(); SSAUConstructorSparseEx ssau = null; @@ -149,12 +149,12 @@ public class StackVarsProcessor { boolean res = false; - HashSet setVisited = new HashSet(); - LinkedList stack = new LinkedList(); - LinkedList> stackMaps = new LinkedList>(); + HashSet setVisited = new HashSet<>(); + LinkedList stack = new LinkedList<>(); + LinkedList> stackMaps = new LinkedList<>(); stack.add(dgraph.first); - stackMaps.add(new HashMap()); + stackMaps.add(new HashMap<>()); while (!stack.isEmpty()) { @@ -166,7 +166,7 @@ public class StackVarsProcessor { } setVisited.add(nd); - List> lstLists = new ArrayList>(); + List> lstLists = new ArrayList<>(); if (!nd.exprents.isEmpty()) { lstLists.add(nd.exprents); @@ -211,7 +211,7 @@ public class StackVarsProcessor { for (DirectNode ndx : nd.succs) { stack.add(ndx); - stackMaps.add(new HashMap(mapVarValues)); + stackMaps.add(new HashMap<>(mapVarValues)); } // make sure the 3 special exprent lists in a loop (init, condition, increment) are not empty @@ -329,7 +329,7 @@ public class StackVarsProcessor { VarVersionPair leftpaar = new VarVersionPair(left); - List usedVers = new ArrayList(); + List usedVers = new ArrayList<>(); boolean notdom = getUsedVersions(ssau, leftpaar, usedVers); if (!notdom && usedVers.isEmpty()) { @@ -395,7 +395,7 @@ public class StackVarsProcessor { boolean verreplaced = false; - HashSet setTempUsedVers = new HashSet(); + HashSet setTempUsedVers = new HashSet<>(); for (VarVersionNode usedvar : usedVers) { VarVersionPair usedver = new VarVersionPair(usedvar.var, usedvar.version); @@ -440,9 +440,9 @@ public class StackVarsProcessor { private static HashSet getAllVersions(Exprent exprent) { - HashSet res = new HashSet(); + HashSet res = new HashSet<>(); - List listTemp = new ArrayList(exprent.getAllExprents(true)); + List listTemp = new ArrayList<>(exprent.getAllExprents(true)); listTemp.add(exprent); for (Exprent expr : listTemp) { @@ -523,7 +523,7 @@ public class StackVarsProcessor { VarVersionPair leftpaar = new VarVersionPair(left); - List usedVers = new ArrayList(); + List usedVers = new ArrayList<>(); boolean notdom = getUsedVersions(ssau, leftpaar, usedVers); if (!notdom && usedVers.isEmpty()) { @@ -557,7 +557,7 @@ public class StackVarsProcessor { boolean vernotreplaced = false; - HashSet setTempUsedVers = new HashSet(); + HashSet setTempUsedVers = new HashSet<>(); for (VarVersionNode usedvar : usedVers) { VarVersionPair usedver = new VarVersionPair(usedvar.var, usedvar.version); @@ -594,11 +594,11 @@ public class StackVarsProcessor { VarVersionsGraph ssuversions = ssa.getSsuversions(); VarVersionNode varnode = ssuversions.nodes.getWithKey(var); - HashSet setVisited = new HashSet(); + HashSet setVisited = new HashSet<>(); - HashSet setNotDoms = new HashSet(); + HashSet setNotDoms = new HashSet<>(); - LinkedList stack = new LinkedList(); + LinkedList stack = new LinkedList<>(); stack.add(varnode); while (!stack.isEmpty()) { @@ -663,7 +663,7 @@ public class StackVarsProcessor { return false; } - HashSet domset = new HashSet(); + HashSet domset = new HashSet<>(); for (VarVersionPair verpaar : ent.getValue()) { domset.add(ssuversions.nodes.getWithKey(verpaar)); } @@ -691,7 +691,7 @@ public class StackVarsProcessor { Exprent exprent, SSAUConstructorSparseEx ssau) { - HashMap> map = new HashMap>(); + HashMap> map = new HashMap<>(); SFormsFastMapDirect mapLiveVars = ssau.getLiveVarVersionsMap(leftvar); List lst = exprent.getAllExprents(true); @@ -702,7 +702,7 @@ public class StackVarsProcessor { int varindex = ((VarExprent)expr).getIndex(); if (leftvar.var != varindex) { if (mapLiveVars.containsKey(varindex)) { - HashSet verset = new HashSet(); + HashSet verset = new HashSet<>(); for (Integer vers : mapLiveVars.get(varindex)) { verset.add(new VarVersionPair(varindex, vers.intValue())); } @@ -720,7 +720,7 @@ public class StackVarsProcessor { if (ssau.getMapFieldVars().containsKey(expr.id)) { int varindex = ssau.getMapFieldVars().get(expr.id); if (mapLiveVars.containsKey(varindex)) { - HashSet verset = new HashSet(); + HashSet verset = new HashSet<>(); for (Integer vers : mapLiveVars.get(varindex)) { verset.add(new VarVersionPair(varindex, vers.intValue())); } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/StatEdge.java b/src/org/jetbrains/java/decompiler/modules/decompiler/StatEdge.java index 26d427b..8d5e762 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/StatEdge.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/StatEdge.java @@ -66,7 +66,7 @@ public class StatEdge { public StatEdge(Statement source, Statement destination, List exceptions) { this(TYPE_EXCEPTION, source, destination); if (exceptions != null) { - this.exceptions = new ArrayList(exceptions); + this.exceptions = new ArrayList<>(exceptions); } } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/StrongConnectivityHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/StrongConnectivityHelper.java index 23f778d..047accd 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/StrongConnectivityHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/StrongConnectivityHelper.java @@ -92,8 +92,8 @@ public class StrongConnectivityHelper { public List> findComponents(Statement stat) { - components = new ArrayList>(); - setProcessed = new HashSet(); + components = new ArrayList<>(); + setProcessed = new HashSet<>(); visitTree(stat.getFirst()); @@ -115,7 +115,7 @@ public class StrongConnectivityHelper { public static boolean isExitComponent(List lst) { - HashSet set = new HashSet(); + HashSet set = new HashSet<>(); for (Statement stat : lst) { set.addAll(stat.getNeighbours(StatEdge.TYPE_REGULAR, Statement.DIRECTION_FORWARD)); } @@ -126,7 +126,7 @@ public class StrongConnectivityHelper { public static List getExitReps(List> lst) { - List res = new ArrayList(); + List res = new ArrayList<>(); for (List comp : lst) { if (isExitComponent(comp)) { @@ -142,11 +142,11 @@ public class StrongConnectivityHelper { // ***************************************************************************** private void visitTree(Statement stat) { - lstack = new ListStack(); + lstack = new ListStack<>(); ncounter = 0; - tset = new HashSet(); - dfsnummap = new HashMap(); - lowmap = new HashMap(); + tset = new HashSet<>(); + dfsnummap = new HashMap<>(); + lowmap = new HashMap<>(); visit(stat); @@ -181,7 +181,7 @@ public class StrongConnectivityHelper { if (lowmap.get(stat).intValue() == dfsnummap.get(stat).intValue()) { - List lst = new ArrayList(); + List lst = new ArrayList<>(); Statement v; do { v = lstack.pop(); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DominatorEngine.java b/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DominatorEngine.java index a61d44c..608d56c 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DominatorEngine.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DominatorEngine.java @@ -25,7 +25,7 @@ public class DominatorEngine { private final Statement statement; - private final VBStyleCollection colOrderedIDoms = new VBStyleCollection(); + private final VBStyleCollection colOrderedIDoms = new VBStyleCollection<>(); public DominatorEngine(Statement statement) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DominatorTreeExceptionFilter.java b/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DominatorTreeExceptionFilter.java index 89e6849..59b6b15 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DominatorTreeExceptionFilter.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DominatorTreeExceptionFilter.java @@ -27,16 +27,16 @@ public class DominatorTreeExceptionFilter { private final Statement statement; // idom, nodes - private final Map> mapTreeBranches = new HashMap>(); + private final Map> mapTreeBranches = new HashMap<>(); // handler, range nodes - private final Map> mapExceptionRanges = new HashMap>(); + private final Map> mapExceptionRanges = new HashMap<>(); // handler, head dom - private Map mapExceptionDoms = new HashMap(); + private Map mapExceptionDoms = new HashMap<>(); // statement, handler, exit nodes - private final Map> mapExceptionRangeUniqueExit = new HashMap>(); + private final Map> mapExceptionRangeUniqueExit = new HashMap<>(); private DominatorEngine domEngine; @@ -86,7 +86,7 @@ public class DominatorTreeExceptionFilter { Set set = mapTreeBranches.get(idom); if (set == null) { - mapTreeBranches.put(idom, set = new HashSet()); + mapTreeBranches.put(idom, set = new HashSet<>()); } set.add(key); } @@ -101,7 +101,7 @@ public class DominatorTreeExceptionFilter { List lstPreds = stat.getNeighbours(StatEdge.TYPE_EXCEPTION, Statement.DIRECTION_BACKWARD); if (!lstPreds.isEmpty()) { - Set set = new HashSet(); + Set set = new HashSet<>(); for (Statement st : lstPreds) { set.add(st.id); @@ -116,7 +116,7 @@ public class DominatorTreeExceptionFilter { private Map buildExceptionDoms(Integer id) { - Map map = new HashMap(); + Map map = new HashMap<>(); Set children = mapTreeBranches.get(id); if (children != null) { @@ -140,7 +140,7 @@ public class DominatorTreeExceptionFilter { private void buildFilter(Integer id) { - Map map = new HashMap(); + Map map = new HashMap<>(); Set children = mapTreeBranches.get(id); if (children != null) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/FastExtendedPostdominanceHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/FastExtendedPostdominanceHelper.java index 52338f9..f37aedc 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/FastExtendedPostdominanceHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/FastExtendedPostdominanceHelper.java @@ -28,9 +28,9 @@ public class FastExtendedPostdominanceHelper { private List lstReversePostOrderList; - private HashMap> mapSupportPoints = new HashMap>(); + private HashMap> mapSupportPoints = new HashMap<>(); - private final HashMap> mapExtPostdominators = new HashMap>(); + private final HashMap> mapExtPostdominators = new HashMap<>(); private Statement statement; @@ -40,11 +40,11 @@ public class FastExtendedPostdominanceHelper { this.statement = statement; - HashSet set = new HashSet(); + HashSet set = new HashSet<>(); for (Statement st : statement.getStats()) { set.add(st.id); } - this.factory = new FastFixedSetFactory(set); + this.factory = new FastFixedSetFactory<>(set); lstReversePostOrderList = statement.getReversePostOrderList(); @@ -65,7 +65,7 @@ public class FastExtendedPostdominanceHelper { filterOnDominance(filter); - HashMap> res = new HashMap>(); + HashMap> res = new HashMap<>(); for (Entry> entry : mapExtPostdominators.entrySet()) { res.put(entry.getKey(), entry.getValue().toPlainSet()); } @@ -78,17 +78,17 @@ public class FastExtendedPostdominanceHelper { DominatorEngine engine = filter.getDomEngine(); - for (Integer head : new HashSet(mapExtPostdominators.keySet())) { + for (Integer head : new HashSet<>(mapExtPostdominators.keySet())) { FastFixedSet setPostdoms = mapExtPostdominators.get(head); - LinkedList stack = new LinkedList(); - LinkedList> stackPath = new LinkedList>(); + LinkedList stack = new LinkedList<>(); + LinkedList> stackPath = new LinkedList<>(); stack.add(statement.getStats().getWithKey(head)); stackPath.add(factory.spawnEmptySet()); - Set setVisited = new HashSet(); + Set setVisited = new HashSet<>(); setVisited.add(stack.getFirst()); @@ -134,7 +134,7 @@ public class FastExtendedPostdominanceHelper { private void filterOnExceptionRanges(DominatorTreeExceptionFilter filter) { - for (Integer head : new HashSet(mapExtPostdominators.keySet())) { + for (Integer head : new HashSet<>(mapExtPostdominators.keySet())) { FastFixedSet set = mapExtPostdominators.get(head); for (Iterator it = set.iterator(); it.hasNext(); ) { @@ -151,7 +151,7 @@ public class FastExtendedPostdominanceHelper { private void removeErroneousNodes() { - mapSupportPoints = new HashMap>(); + mapSupportPoints = new HashMap<>(); calcReachabilitySuppPoints(StatEdge.TYPE_REGULAR); @@ -161,7 +161,7 @@ public class FastExtendedPostdominanceHelper { Integer nodeid = node.id; FastFixedSet setReachability = mapSets.get(nodeid); - List> lstPredSets = new ArrayList>(); + List> lstPredSets = new ArrayList<>(); for (StatEdge prededge : node.getPredecessorEdges(StatEdge.TYPE_REGULAR)) { FastFixedSet setPred = mapSets.get(prededge.getSource().id); @@ -285,7 +285,7 @@ public class FastExtendedPostdominanceHelper { boolean iterate = false; - HashMap> mapSets = new HashMap>(); + HashMap> mapSets = new HashMap<>(); for (Statement stat : lstReversePostOrderList) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/GenericDominatorEngine.java b/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/GenericDominatorEngine.java index fa5ccf3..d1830f3 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/GenericDominatorEngine.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/GenericDominatorEngine.java @@ -24,7 +24,7 @@ public class GenericDominatorEngine { private final IGraph graph; - private final VBStyleCollection colOrderedIDoms = new VBStyleCollection(); + private final VBStyleCollection colOrderedIDoms = new VBStyleCollection<>(); private Set setRoots; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/ExceptionDeobfuscator.java b/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/ExceptionDeobfuscator.java index 7614807..0826e8b 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/ExceptionDeobfuscator.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/ExceptionDeobfuscator.java @@ -48,7 +48,7 @@ public class ExceptionDeobfuscator { public static void restorePopRanges(ControlFlowGraph graph) { - List lstRanges = new ArrayList(); + List lstRanges = new ArrayList<>(); // aggregate ranges for (ExceptionRangeCFG range : graph.getExceptions()) { @@ -63,7 +63,7 @@ public class ExceptionDeobfuscator { if (!found) { // doesn't matter, which range chosen - lstRanges.add(new Range(range.getHandler(), range.getUniqueExceptionsString(), new HashSet(range.getProtectedRange()), range)); + lstRanges.add(new Range(range.getHandler(), range.getUniqueExceptionsString(), new HashSet<>(range.getProtectedRange()), range)); } } @@ -81,13 +81,13 @@ public class ExceptionDeobfuscator { if (firstinstr.opcode == CodeConstants.opc_pop || firstinstr.opcode == CodeConstants.opc_astore) { - Set setrange = new HashSet(range.protectedRange); + Set setrange = new HashSet<>(range.protectedRange); for (Range range_super : lstRanges) { // finally or strict superset if (range != range_super) { - Set setrange_super = new HashSet(range_super.protectedRange); + Set setrange_super = new HashSet<>(range_super.protectedRange); if (!setrange.contains(range_super.handler) && !setrange_super.contains(handler) && (range_super.uniqueStr == null || setrange_super.containsAll(setrange))) { @@ -113,7 +113,7 @@ public class ExceptionDeobfuscator { graph.getBlocks().addWithKey(newblock, newblock.id); - List lstTemp = new ArrayList(); + List lstTemp = new ArrayList<>(); lstTemp.addAll(handler.getPreds()); lstTemp.addAll(handler.getPredExceptions()); @@ -159,7 +159,7 @@ public class ExceptionDeobfuscator { public static void insertEmptyExceptionHandlerBlocks(ControlFlowGraph graph) { - Set setVisited = new HashSet(); + Set setVisited = new HashSet<>(); for (ExceptionRangeCFG range : graph.getExceptions()) { BasicBlock handler = range.getHandler(); @@ -172,7 +172,7 @@ public class ExceptionDeobfuscator { BasicBlock emptyblock = new BasicBlock(++graph.last_id); graph.getBlocks().addWithKey(emptyblock, emptyblock.id); - List lstTemp = new ArrayList(); + List lstTemp = new ArrayList<>(); // only exception predecessors considered lstTemp.addAll(handler.getPredExceptions()); @@ -231,7 +231,7 @@ public class ExceptionDeobfuscator { } public Set getRoots() { - return new HashSet(Arrays.asList(new IGraphNode[]{graph.getFirst()})); + return new HashSet<>(Arrays.asList(new IGraphNode[]{graph.getFirst()})); } }); @@ -264,10 +264,10 @@ public class ExceptionDeobfuscator { private static List getReachableBlocksRestricted(ExceptionRangeCFG range, GenericDominatorEngine engine) { - List lstRes = new ArrayList(); + List lstRes = new ArrayList<>(); - LinkedList stack = new LinkedList(); - Set setVisited = new HashSet(); + LinkedList stack = new LinkedList<>(); + Set setVisited = new HashSet<>(); BasicBlock handler = range.getHandler(); stack.addFirst(handler); @@ -280,7 +280,7 @@ public class ExceptionDeobfuscator { if (range.getProtectedRange().contains(block) && engine.isDominator(block, handler)) { lstRes.add(block); - List lstSuccs = new ArrayList(block.getSuccs()); + List lstSuccs = new ArrayList<>(block.getSuccs()); lstSuccs.addAll(block.getSuccExceptions()); for (BasicBlock succ : lstSuccs) { @@ -297,20 +297,20 @@ public class ExceptionDeobfuscator { public static boolean hasObfuscatedExceptions(ControlFlowGraph graph) { - Map> mapRanges = new HashMap>(); + Map> mapRanges = new HashMap<>(); for (ExceptionRangeCFG range : graph.getExceptions()) { Set set = mapRanges.get(range.getHandler()); if (set == null) { - mapRanges.put(range.getHandler(), set = new HashSet()); + mapRanges.put(range.getHandler(), set = new HashSet<>()); } set.addAll(range.getProtectedRange()); } for (Entry> ent : mapRanges.entrySet()) { - Set setEntries = new HashSet(); + Set setEntries = new HashSet<>(); for (BasicBlock block : ent.getValue()) { - Set setTemp = new HashSet(block.getPreds()); + Set setTemp = new HashSet<>(block.getPreds()); setTemp.removeAll(ent.getValue()); if (!setTemp.isEmpty()) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/IrreducibleCFGDeobfuscator.java b/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/IrreducibleCFGDeobfuscator.java index 42ba76f..12840f2 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/IrreducibleCFGDeobfuscator.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/IrreducibleCFGDeobfuscator.java @@ -31,15 +31,15 @@ public class IrreducibleCFGDeobfuscator { class Node { public Integer id; - public final Set preds = new HashSet(); - public final Set succs = new HashSet(); + public final Set preds = new HashSet<>(); + public final Set succs = new HashSet<>(); public Node(Integer id) { this.id = id; } } - HashMap mapNodes = new HashMap(); + HashMap mapNodes = new HashMap<>(); // checking exceptions and creating nodes for (Statement stat : statement.getStats()) { @@ -145,7 +145,7 @@ public class IrreducibleCFGDeobfuscator { StatEdge enteredge = splitnode.getPredecessorEdges(StatEdge.TYPE_REGULAR).iterator().next(); // copy the smallest statement - Statement splitcopy = copyStatement(splitnode, null, new HashMap()); + Statement splitcopy = copyStatement(splitnode, null, new HashMap<>()); initCopiedStatement(splitcopy); // insert the copy diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ArrayExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ArrayExprent.java index c8db797..3590b48 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ArrayExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ArrayExprent.java @@ -68,7 +68,7 @@ public class ArrayExprent extends Exprent { } public List getAllExprents() { - List lst = new ArrayList(); + List lst = new ArrayList<>(); lst.add(array); lst.add(index); return lst; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/AssignmentExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/AssignmentExprent.java index 95ebdc5..957f3f5 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/AssignmentExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/AssignmentExprent.java @@ -87,7 +87,7 @@ public class AssignmentExprent extends Exprent { @Override public List getAllExprents() { - List lst = new ArrayList(); + List lst = new ArrayList<>(); lst.add(left); lst.add(right); return lst; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java index e618235..e82fec7 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java @@ -110,7 +110,7 @@ public class ConstExprent extends Exprent { } public List getAllExprents() { - return new ArrayList(); + return new ArrayList<>(); } @Override diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ExitExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ExitExprent.java index c6b962c..abfc4ab 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ExitExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/ExitExprent.java @@ -70,7 +70,7 @@ public class ExitExprent extends Exprent { @Override public List getAllExprents() { - List lst = new ArrayList(); + List lst = new ArrayList<>(); if (value != null) { lst.add(value); } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/Exprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/Exprent.java index 77b35b3..a530915 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/Exprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/Exprent.java @@ -76,7 +76,7 @@ public class Exprent implements IMatchable { } public boolean containsExprent(Exprent exprent) { - List listTemp = new ArrayList(getAllExprents(true)); + List listTemp = new ArrayList<>(getAllExprents(true)); listTemp.add(this); for (Exprent lstExpr : listTemp) { @@ -102,7 +102,7 @@ public class Exprent implements IMatchable { List lstAllExprents = getAllExprents(true); lstAllExprents.add(this); - Set set = new HashSet(); + Set set = new HashSet<>(); for (Exprent expr : lstAllExprents) { if (expr.type == EXPRENT_VAR) { set.add(new VarVersionPair((VarExprent)expr)); @@ -128,7 +128,7 @@ public class Exprent implements IMatchable { public void addBytecodeOffsets(Collection bytecodeOffsets) { if (bytecodeOffsets != null && !bytecodeOffsets.isEmpty()) { if (bytecode == null) { - bytecode = new HashSet(bytecodeOffsets); + bytecode = new HashSet<>(bytecodeOffsets); } else { bytecode.addAll(bytecodeOffsets); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FieldExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FieldExprent.java index 5e6a6b5..f1c65d1 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FieldExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FieldExprent.java @@ -71,7 +71,7 @@ public class FieldExprent extends Exprent { @Override public List getAllExprents() { - List lst = new ArrayList(); + List lst = new ArrayList<>(); if (instance != null) { lst.add(instance); } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java index 48206a7..faaa6d2 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java @@ -191,7 +191,7 @@ public class FunctionExprent extends Exprent { 3 // FUNCTION_STR_CONCAT = 49; }; - private static final Set ASSOCIATIVITY = new HashSet(Arrays.asList( + private static final Set ASSOCIATIVITY = new HashSet<>(Arrays.asList( FUNCTION_ADD, FUNCTION_MUL, FUNCTION_AND, FUNCTION_OR, FUNCTION_XOR, FUNCTION_CADD, FUNCTION_COR, FUNCTION_STR_CONCAT)); private int funcType; @@ -199,7 +199,7 @@ public class FunctionExprent extends Exprent { private final List lstOperands; public FunctionExprent(int funcType, ListStack stack, Set bytecodeOffsets) { - this(funcType, new ArrayList(), bytecodeOffsets); + this(funcType, new ArrayList<>(), bytecodeOffsets); if (funcType >= FUNCTION_BIT_NOT && funcType <= FUNCTION_PPI && funcType != FUNCTION_CAST && funcType != FUNCTION_INSTANCEOF) { lstOperands.add(stack.pop()); @@ -223,7 +223,7 @@ public class FunctionExprent extends Exprent { } public FunctionExprent(int funcType, Exprent operand, Set bytecodeOffsets) { - this(funcType, new ArrayList(1), bytecodeOffsets); + this(funcType, new ArrayList<>(1), bytecodeOffsets); lstOperands.add(operand); } @@ -413,14 +413,14 @@ public class FunctionExprent extends Exprent { @Override public List getAllExprents() { - List lst = new ArrayList(); + List lst = new ArrayList<>(); lst.addAll(lstOperands); return lst; } @Override public Exprent copy() { - List lst = new ArrayList(); + List lst = new ArrayList<>(); for (Exprent expr : lstOperands) { lst.add(expr.copy()); } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/IfExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/IfExprent.java index 059270f..be4d6f6 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/IfExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/IfExprent.java @@ -107,7 +107,7 @@ public class IfExprent extends Exprent { @Override public List getAllExprents() { - List lst = new ArrayList(); + List lst = new ArrayList<>(); lst.add(condition); return lst; } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java index 1b8188a..94c1b5d 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java @@ -65,7 +65,7 @@ public class InvocationExprent extends Exprent { private String stringDescriptor; private String invokeDynamicClassSuffix; private int invocationTyp = INVOKE_VIRTUAL; - private List lstParameters = new ArrayList(); + private List lstParameters = new ArrayList<>(); private List bootstrapArguments; public InvocationExprent() { @@ -162,7 +162,7 @@ public class InvocationExprent extends Exprent { invokeDynamicClassSuffix = expr.getInvokeDynamicClassSuffix(); stringDescriptor = expr.getStringDescriptor(); descriptor = expr.getDescriptor(); - lstParameters = new ArrayList(expr.getLstParameters()); + lstParameters = new ArrayList<>(expr.getLstParameters()); ExprProcessor.copyEntries(lstParameters); addBytecodeOffsets(expr.bytecode); @@ -192,7 +192,7 @@ public class InvocationExprent extends Exprent { @Override public List getAllExprents() { - List lst = new ArrayList(); + List lst = new ArrayList<>(); if (instance != null) { lst.add(instance); } @@ -321,7 +321,7 @@ public class InvocationExprent extends Exprent { } else { if (newNode.type == ClassNode.CLASS_MEMBER && (newNode.access & CodeConstants.ACC_STATIC) == 0) { // non-static member class - sigFields = new ArrayList(Collections.nCopies(lstParameters.size(), (VarVersionPair)null)); + sigFields = new ArrayList<>(Collections.nCopies(lstParameters.size(), (VarVersionPair)null)); sigFields.set(0, new VarVersionPair(-1, 0)); } } @@ -358,7 +358,7 @@ public class InvocationExprent extends Exprent { if (cl == null) return EMPTY_BIT_SET; // check number of matches - List matches = new ArrayList(); + List matches = new ArrayList<>(); nextMethod: for (StructMethod mt : cl.getMethods()) { if (name.equals(mt.getName())) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/MonitorExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/MonitorExprent.java index 0ece9aa..1546064 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/MonitorExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/MonitorExprent.java @@ -46,7 +46,7 @@ public class MonitorExprent extends Exprent { @Override public List getAllExprents() { - List lst = new ArrayList(); + List lst = new ArrayList<>(); lst.add(value); return lst; } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/NewExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/NewExprent.java index 1edd0e4..b6a67d2 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/NewExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/NewExprent.java @@ -38,8 +38,8 @@ import java.util.Set; public class NewExprent extends Exprent { private InvocationExprent constructor; private final VarType newType; - private List lstDims = new ArrayList(); - private List lstArrayElements = new ArrayList(); + private List lstDims = new ArrayList<>(); + private List lstArrayElements = new ArrayList<>(); private boolean directArrayInit; private boolean anonymous; private boolean lambda; @@ -70,7 +70,7 @@ public class NewExprent extends Exprent { } private static List getDimensions(int arrayDim, ListStack stack) { - List lstDims = new ArrayList(); + List lstDims = new ArrayList<>(); for (int i = 0; i < arrayDim; i++) { lstDims.add(0, stack.pop()); } @@ -111,7 +111,7 @@ public class NewExprent extends Exprent { @Override public List getAllExprents() { - List lst = new ArrayList(); + List lst = new ArrayList<>(); if (newType.arrayDim == 0) { if (constructor != null) { Exprent constructor_instance = constructor.getInstance(); @@ -133,7 +133,7 @@ public class NewExprent extends Exprent { @Override public Exprent copy() { - List lst = new ArrayList(); + List lst = new ArrayList<>(); for (Exprent expr : lstDims) { lst.add(expr.copy()); } @@ -199,7 +199,7 @@ public class NewExprent extends Exprent { else { if (newNode.type == ClassNode.CLASS_MEMBER && (newNode.access & CodeConstants.ACC_STATIC) == 0 && !constructor.getLstParameters().isEmpty()) { // member non-static class invoked with enclosing class instance - sigFields = new ArrayList(Collections.nCopies(constructor.getLstParameters().size(), (VarVersionPair)null)); + sigFields = new ArrayList<>(Collections.nCopies(constructor.getLstParameters().size(), (VarVersionPair)null)); sigFields.set(0, new VarVersionPair(-1, 0)); } } @@ -304,7 +304,7 @@ public class NewExprent extends Exprent { } else if (newNode.type == ClassNode.CLASS_MEMBER && (newNode.access & CodeConstants.ACC_STATIC) == 0 && !constructor.getLstParameters().isEmpty()) { // member non-static class invoked with enclosing class instance - sigFields = new ArrayList(Collections.nCopies(lstParameters.size(), (VarVersionPair)null)); + sigFields = new ArrayList<>(Collections.nCopies(lstParameters.size(), (VarVersionPair)null)); sigFields.set(0, new VarVersionPair(-1, 0)); } } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/SwitchExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/SwitchExprent.java index fd77112..27730a9 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/SwitchExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/SwitchExprent.java @@ -28,7 +28,7 @@ import java.util.Set; public class SwitchExprent extends Exprent { private Exprent value; - private List> caseValues = new ArrayList>(); + private List> caseValues = new ArrayList<>(); public SwitchExprent(Exprent value, Set bytecodeOffsets) { super(EXPRENT_SWITCH); @@ -41,9 +41,9 @@ public class SwitchExprent extends Exprent { public Exprent copy() { SwitchExprent swExpr = new SwitchExprent(value.copy(), bytecode); - List> lstCaseValues = new ArrayList>(); + List> lstCaseValues = new ArrayList<>(); for (List lst : caseValues) { - lstCaseValues.add(new ArrayList(lst)); + lstCaseValues.add(new ArrayList<>(lst)); } swExpr.setCaseValues(lstCaseValues); @@ -80,7 +80,7 @@ public class SwitchExprent extends Exprent { @Override public List getAllExprents() { - List lst = new ArrayList(); + List lst = new ArrayList<>(); lst.add(value); return lst; } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java index 4436cb5..fdd8bb9 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java @@ -67,7 +67,7 @@ public class VarExprent extends Exprent { @Override public List getAllExprents() { - return new ArrayList(); + return new ArrayList<>(); } @Override diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/DirectGraph.java b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/DirectGraph.java index abd844c..413cdf6 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/DirectGraph.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/DirectGraph.java @@ -27,24 +27,24 @@ import java.util.List; public class DirectGraph { - public final VBStyleCollection nodes = new VBStyleCollection(); + public final VBStyleCollection nodes = new VBStyleCollection<>(); public DirectNode first; // exit, [source, destination] - public final HashMap> mapShortRangeFinallyPaths = new HashMap>(); + public final HashMap> mapShortRangeFinallyPaths = new HashMap<>(); // exit, [source, destination] - public final HashMap> mapLongRangeFinallyPaths = new HashMap>(); + public final HashMap> mapLongRangeFinallyPaths = new HashMap<>(); // negative if branches (recorded for handling of && and ||) - public final HashMap mapNegIfBranch = new HashMap(); + public final HashMap mapNegIfBranch = new HashMap<>(); // nodes, that are exception exits of a finally block with monitor variable - public final HashMap mapFinallyMonitorExceptionPathExits = new HashMap(); + public final HashMap mapFinallyMonitorExceptionPathExits = new HashMap<>(); public void sortReversePostOrder() { - LinkedList res = new LinkedList(); + LinkedList res = new LinkedList<>(); addToReversePostOrderListIterative(first, res); nodes.clear(); @@ -55,10 +55,10 @@ public class DirectGraph { private static void addToReversePostOrderListIterative(DirectNode root, List lst) { - LinkedList stackNode = new LinkedList(); - LinkedList stackIndex = new LinkedList(); + LinkedList stackNode = new LinkedList<>(); + LinkedList stackIndex = new LinkedList<>(); - HashSet setVisited = new HashSet(); + HashSet setVisited = new HashSet<>(); stackNode.add(root); stackIndex.add(0); @@ -94,10 +94,10 @@ public class DirectGraph { public boolean iterateExprents(ExprentIterator iter) { - LinkedList stack = new LinkedList(); + LinkedList stack = new LinkedList<>(); stack.add(first); - HashSet setVisited = new HashSet(); + HashSet setVisited = new HashSet<>(); while (!stack.isEmpty()) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/DirectNode.java b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/DirectNode.java index 8a39531..b71330a 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/DirectNode.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/DirectNode.java @@ -40,11 +40,11 @@ public class DirectNode { public final Statement statement; - public List exprents = new ArrayList(); + public List exprents = new ArrayList<>(); - public final List succs = new ArrayList(); + public final List succs = new ArrayList<>(); - public final List preds = new ArrayList(); + public final List preds = new ArrayList<>(); public DirectNode(int type, Statement statement, String id) { this.type = type; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/FlattenStatementsHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/FlattenStatementsHelper.java index 971ace5..43c63f6 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/FlattenStatementsHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/FlattenStatementsHelper.java @@ -26,19 +26,19 @@ import java.util.Map.Entry; public class FlattenStatementsHelper { // statement.id, node.id(direct), node.id(continue) - private final Map mapDestinationNodes = new HashMap(); + private final Map mapDestinationNodes = new HashMap<>(); // node.id(source), statement.id(destination), edge type - private final List listEdges = new ArrayList(); + private final List listEdges = new ArrayList<>(); // node.id(exit), [node.id(source), statement.id(destination)] - private final Map> mapShortRangeFinallyPathIds = new HashMap>(); + private final Map> mapShortRangeFinallyPathIds = new HashMap<>(); // node.id(exit), [node.id(source), statement.id(destination)] - private final Map> mapLongRangeFinallyPathIds = new HashMap>(); + private final Map> mapLongRangeFinallyPathIds = new HashMap<>(); // positive if branches - private final Map mapPosIfBranch = new HashMap(); + private final Map mapPosIfBranch = new HashMap<>(); private DirectGraph graph; @@ -55,7 +55,7 @@ public class FlattenStatementsHelper { // dummy exit node Statement dummyexit = root.getDummyExit(); DirectNode node = new DirectNode(DirectNode.NODE_DIRECT, dummyexit, dummyexit.id.toString()); - node.exprents = new ArrayList(); + node.exprents = new ArrayList<>(); graph.nodes.addWithKey(node, node.id); mapDestinationNodes.put(dummyexit.id, new String[]{node.id, null}); @@ -85,9 +85,9 @@ public class FlattenStatementsHelper { } } - LinkedList lstStackStatements = new LinkedList(); + LinkedList lstStackStatements = new LinkedList<>(); - lstStackStatements.add(new StatementStackEntry(root, new LinkedList(), null)); + lstStackStatements.add(new StatementStackEntry(root, new LinkedList<>(), null)); mainloop: while (!lstStackStatements.isEmpty()) { @@ -100,7 +100,7 @@ public class FlattenStatementsHelper { DirectNode node, nd; - List lstSuccEdges = new ArrayList(); + List lstSuccEdges = new ArrayList<>(); DirectNode sourcenode = null; if (statEntry.succEdges == null) { @@ -143,14 +143,14 @@ public class FlattenStatementsHelper { mapDestinationNodes.put(stat.id, new String[]{firstnd.id, null}); graph.nodes.putWithKey(firstnd, firstnd.id); - LinkedList lst = new LinkedList(); + LinkedList lst = new LinkedList<>(); for (Statement st : stat.getStats()) { listEdges.add(new Edge(firstnd.id, st.id, StatEdge.TYPE_REGULAR)); LinkedList stack = stackFinally; if (stat.type == Statement.TYPE_CATCHALL && ((CatchAllStatement)stat).isFinally()) { - stack = new LinkedList(stackFinally); + stack = new LinkedList<>(stackFinally); if (st == stat.getFirst()) { // catch head stack.add(new StackEntry((CatchAllStatement)stat, Boolean.FALSE)); @@ -306,7 +306,7 @@ public class FlattenStatementsHelper { StatEdge edge = lstSuccEdges.get(edgeindex); - LinkedList stack = new LinkedList(stackFinally); + LinkedList stack = new LinkedList<>(stackFinally); int edgetype = edge.getType(); Statement destination = edge.getDestination(); @@ -417,14 +417,14 @@ public class FlattenStatementsHelper { List lst = mapShortRangeFinallyPathIds.get(sourcenode.id); if (lst == null) { - mapShortRangeFinallyPathIds.put(sourcenode.id, lst = new ArrayList()); + mapShortRangeFinallyPathIds.put(sourcenode.id, lst = new ArrayList<>()); } lst.add(new String[]{finallyShortRangeSource.id, destination.id.toString(), finallyShortRangeEntry.id.toString(), isFinallyMonitorExceptionPath ? "1" : null, isContinueEdge ? "1" : null}); lst = mapLongRangeFinallyPathIds.get(sourcenode.id); if (lst == null) { - mapLongRangeFinallyPathIds.put(sourcenode.id, lst = new ArrayList()); + mapLongRangeFinallyPathIds.put(sourcenode.id, lst = new ArrayList<>()); } lst.add(new String[]{finallyLongRangeSource.id, destination.id.toString(), finallyLongRangeEntry.id.toString(), isContinueEdge ? "1" : null}); @@ -458,7 +458,7 @@ public class FlattenStatementsHelper { for (int i = 0; i < 2; i++) { for (Entry> ent : (i == 0 ? mapShortRangeFinallyPathIds : mapLongRangeFinallyPathIds).entrySet()) { - List newLst = new ArrayList(); + List newLst = new ArrayList<>(); List lst = ent.getValue(); for (String[] arr : lst) { @@ -477,8 +477,8 @@ public class FlattenStatementsHelper { if (!newLst.isEmpty()) { (i == 0 ? graph.mapShortRangeFinallyPaths : graph.mapLongRangeFinallyPaths).put(ent.getKey(), - new ArrayList( - new HashSet(newLst))); + new ArrayList<>( + new HashSet<>(newLst))); } } } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAConstructorSparseEx.java b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAConstructorSparseEx.java index 76a973f..7aff2d2 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAConstructorSparseEx.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAConstructorSparseEx.java @@ -42,24 +42,24 @@ import java.util.Map.Entry; public class SSAConstructorSparseEx { // node id, var, version - private final HashMap inVarVersions = new HashMap(); + private final HashMap inVarVersions = new HashMap<>(); // node id, var, version (direct branch) - private final HashMap outVarVersions = new HashMap(); + private final HashMap outVarVersions = new HashMap<>(); // node id, var, version (negative branch) - private final HashMap outNegVarVersions = new HashMap(); + private final HashMap outNegVarVersions = new HashMap<>(); // node id, var, version - private final HashMap extraVarVersions = new HashMap(); + private final HashMap extraVarVersions = new HashMap<>(); // (var, version), version - private final HashMap> phi = new HashMap>(); + private final HashMap> phi = new HashMap<>(); // var, version - private final HashMap lastversion = new HashMap(); + private final HashMap lastversion = new HashMap<>(); - private final List startVars = new ArrayList(); + private final List startVars = new ArrayList<>(); // set factory private FastSparseSetFactory factory; @@ -73,18 +73,18 @@ public class SSAConstructorSparseEx { // DotExporter.toDotFile(dgraph, new File("c:\\Temp\\gr12_my.dot")); // } catch(Exception ex) {ex.printStackTrace();} - HashSet setInit = new HashSet(); + HashSet setInit = new HashSet<>(); for (int i = 0; i < 64; i++) { setInit.add(i); } - factory = new FastSparseSetFactory(setInit); + factory = new FastSparseSetFactory<>(setInit); SFormsFastMapDirect firstmap = createFirstMap(mt); extraVarVersions.put(dgraph.first.id, firstmap); setCatchMaps(root, dgraph, flatthelper); - HashSet updated = new HashSet(); + HashSet updated = new HashSet<>(); do { // System.out.println("~~~~~~~~~~~~~ \r\n"+root.toJava()); ssaStatements(dgraph, updated); @@ -348,7 +348,7 @@ public class SSAConstructorSparseEx { String exceptionDest = dgraph.mapFinallyMonitorExceptionPathExits.get(predid); boolean isExceptionMonitorExit = (exceptionDest != null && !nodeid.equals(exceptionDest)); - HashSet setLongPathWrapper = new HashSet(); + HashSet setLongPathWrapper = new HashSet<>(); for (FinallyPathWrapper finwraplong : dgraph.mapLongRangeFinallyPaths.get(predid)) { setLongPathWrapper.add(finwraplong.destination + "##" + finwraplong.source); } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAUConstructorSparseEx.java b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAUConstructorSparseEx.java index 95cefcf..5beb232 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAUConstructorSparseEx.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAUConstructorSparseEx.java @@ -40,42 +40,42 @@ import java.util.Map.Entry; public class SSAUConstructorSparseEx { // node id, var, version - private final HashMap inVarVersions = new HashMap(); + private final HashMap inVarVersions = new HashMap<>(); //private HashMap>> inVarVersions = new HashMap>>(); // node id, var, version (direct branch) - private final HashMap outVarVersions = new HashMap(); + private final HashMap outVarVersions = new HashMap<>(); //private HashMap>> outVarVersions = new HashMap>>(); // node id, var, version (negative branch) - private final HashMap outNegVarVersions = new HashMap(); + private final HashMap outNegVarVersions = new HashMap<>(); //private HashMap>> outNegVarVersions = new HashMap>>(); // node id, var, version - private final HashMap extraVarVersions = new HashMap(); + private final HashMap extraVarVersions = new HashMap<>(); //private HashMap>> extraVarVersions = new HashMap>>(); // (var, version), version - private final HashMap> phi = new HashMap>(); + private final HashMap> phi = new HashMap<>(); // var, version - private final HashMap lastversion = new HashMap(); + private final HashMap lastversion = new HashMap<>(); // version, protected ranges (catch, finally) - private final HashMap mapVersionFirstRange = new HashMap(); + private final HashMap mapVersionFirstRange = new HashMap<>(); // version, version - private final HashMap phantomppnodes = new HashMap(); // ++ and -- + private final HashMap phantomppnodes = new HashMap<>(); // ++ and -- // node.id, version, version private final HashMap> phantomexitnodes = - new HashMap>(); // finally exits + new HashMap<>(); // finally exits // versions memory dependencies private final VarVersionsGraph ssuversions = new VarVersionsGraph(); // field access vars (exprent id, var id) - private final HashMap mapFieldVars = new HashMap(); + private final HashMap mapFieldVars = new HashMap<>(); // field access counter private int fieldvarcounter = -1; @@ -88,11 +88,11 @@ public class SSAUConstructorSparseEx { FlattenStatementsHelper flatthelper = new FlattenStatementsHelper(); DirectGraph dgraph = flatthelper.buildDirectGraph(root); - HashSet setInit = new HashSet(); + HashSet setInit = new HashSet<>(); for (int i = 0; i < 64; i++) { setInit.add(i); } - factory = new FastSparseSetFactory(setInit); + factory = new FastSparseSetFactory<>(setInit); extraVarVersions.put(dgraph.first.id, createFirstMap(mt, root)); @@ -102,7 +102,7 @@ public class SSAUConstructorSparseEx { // DotExporter.toDotFile(dgraph, new File("c:\\Temp\\gr12_my.dot")); // } catch(Exception ex) {ex.printStackTrace();} - HashSet updated = new HashSet(); + HashSet updated = new HashSet<>(); do { // System.out.println("~~~~~~~~~~~~~ \r\n"+root.toJava()); ssaStatements(dgraph, updated, false); @@ -426,14 +426,14 @@ public class SSAUConstructorSparseEx { private void createOrUpdatePhiNode(VarVersionPair phivar, FastSparseSet vers, Statement stat) { FastSparseSet versCopy = vers.getCopy(); - HashSet phiVers = new HashSet(); + HashSet phiVers = new HashSet<>(); // take into account the corresponding mm/pp node if existing int ppvers = phantomppnodes.containsKey(phivar) ? phantomppnodes.get(phivar).version : -1; // ssu graph VarVersionNode phinode = ssuversions.nodes.getWithKey(phivar); - List lstPreds = new ArrayList(phinode.preds); + List lstPreds = new ArrayList<>(phinode.preds); if (lstPreds.size() == 1) { // not yet a phi node VarVersionEdge edge = lstPreds.get(0); @@ -454,8 +454,8 @@ public class SSAUConstructorSparseEx { } } - List colnodes = new ArrayList(); - List colpaars = new ArrayList(); + List colnodes = new ArrayList<>(); + List colpaars = new ArrayList<>(); for (Integer ver : versCopy) { @@ -571,7 +571,7 @@ public class SSAUConstructorSparseEx { String exceptionDest = dgraph.mapFinallyMonitorExceptionPathExits.get(predid); boolean isExceptionMonitorExit = (exceptionDest != null && !nodeid.equals(exceptionDest)); - HashSet setLongPathWrapper = new HashSet(); + HashSet setLongPathWrapper = new HashSet<>(); for (List lstwrapper : dgraph.mapLongRangeFinallyPaths.values()) { for (FinallyPathWrapper finwraplong : lstwrapper) { setLongPathWrapper.add(finwraplong.destination + "##" + finwraplong.source); @@ -635,7 +635,7 @@ public class SSAUConstructorSparseEx { // replace phi versions with corresponding phantom ones HashMap mapPhantom = phantomexitnodes.get(predid); if (mapPhantom == null) { - mapPhantom = new HashMap(); + mapPhantom = new HashMap<>(); } SFormsFastMapDirect mapExitVar = mapNew.getCopy(); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java index 812ed10..4b06411 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java @@ -40,7 +40,7 @@ public class CatchAllStatement extends Statement { private VarExprent monitor; - private final List vars = new ArrayList(); + private final List vars = new ArrayList<>(); // ***************************************************************************** // constructors diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchStatement.java index 8d56042..db6b79d 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchStatement.java @@ -34,9 +34,9 @@ import java.util.List; public class CatchStatement extends Statement { - private final List> exctstrings = new ArrayList>(); + private final List> exctstrings = new ArrayList<>(); - private final List vars = new ArrayList(); + private final List vars = new ArrayList<>(); // ***************************************************************************** // constructors @@ -58,7 +58,7 @@ public class CatchStatement extends Statement { if (setHandlers.contains(stat)) { stats.addWithKey(stat, stat.id); - exctstrings.add(new ArrayList(edge.getExceptions())); + exctstrings.add(new ArrayList<>(edge.getExceptions())); vars.add(new VarExprent(DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.VAR_COUNTER), new VarType(CodeConstants.TYPE_OBJECT, 0, edge.getExceptions().get(0)), @@ -133,7 +133,7 @@ public class CatchStatement extends Statement { } if (hnextcount != 1 && !setHandlers.isEmpty()) { - List lst = new ArrayList(); + List lst = new ArrayList<>(); lst.add(head); lst.addAll(setHandlers); @@ -204,7 +204,7 @@ public class CatchStatement extends Statement { CatchStatement cs = new CatchStatement(); for (List exc : this.exctstrings) { - cs.exctstrings.add(new ArrayList(exc)); + cs.exctstrings.add(new ArrayList<>(exc)); cs.vars.add(new VarExprent(DecompilerContext.getCounterContainer().getCounterAndIncrement(CounterContainer.VAR_COUNTER), new VarType(CodeConstants.TYPE_OBJECT, 0, exc.get(0)), (VarProcessor)DecompilerContext.getProperty(DecompilerContext.CURRENT_VAR_PROCESSOR))); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/DoStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/DoStatement.java index ef5ea76..3339218 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/DoStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/DoStatement.java @@ -34,9 +34,9 @@ public class DoStatement extends Statement { private int looptype; - private final List initExprent = new ArrayList(); - private final List conditionExprent = new ArrayList(); - private final List incExprent = new ArrayList(); + private final List initExprent = new ArrayList<>(); + private final List conditionExprent = new ArrayList<>(); + private final List incExprent = new ArrayList<>(); // ***************************************************************************** // constructors @@ -142,7 +142,7 @@ public class DoStatement extends Statement { public List getSequentialObjects() { - List lst = new ArrayList(); + List lst = new ArrayList<>(); switch (looptype) { case LOOP_FOR: diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/DummyExitStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/DummyExitStatement.java index ba82182..f74e745 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/DummyExitStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/DummyExitStatement.java @@ -32,7 +32,7 @@ public class DummyExitStatement extends Statement { public void addBytecodeOffsets(Collection bytecodeOffsets) { if (bytecodeOffsets != null && !bytecodeOffsets.isEmpty()) { if (bytecode == null) { - bytecode = new HashSet(bytecodeOffsets); + bytecode = new HashSet<>(bytecodeOffsets); } else { bytecode.addAll(bytecodeOffsets); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/GeneralStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/GeneralStatement.java index 4f22cf7..b2321e5 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/GeneralStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/GeneralStatement.java @@ -39,7 +39,7 @@ public class GeneralStatement extends Statement { first = head; stats.addWithKey(head, head.id); - HashSet set = new HashSet(statements); + HashSet set = new HashSet<>(statements); set.remove(head); for (Statement st : set) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java index ab48ce1..9cb7ddb 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java @@ -52,7 +52,7 @@ public class IfStatement extends Statement { private boolean iffflag; - private final List headexprent = new ArrayList(); // contains IfExprent + private final List headexprent = new ArrayList<>(); // contains IfExprent // ***************************************************************************** // constructors @@ -181,7 +181,7 @@ public class IfStatement extends Statement { boolean ok = (regsize < 2); if (!ok) { - List lst = new ArrayList(); + List lst = new ArrayList<>(); if (DecHelper.isChoiceStatement(head, lst)) { p = lst.remove(0); @@ -295,7 +295,7 @@ public class IfStatement extends Statement { public List getSequentialObjects() { - List lst = new ArrayList(stats); + List lst = new ArrayList<>(stats); lst.add(1, headexprent.get(0)); return lst; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/Statement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/Statement.java index 5efa6cf..a199c28 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/Statement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/Statement.java @@ -73,14 +73,14 @@ public class Statement implements IMatchable { // private fields // ***************************************************************************** - private final Map> mapSuccEdges = new HashMap>(); - private final Map> mapPredEdges = new HashMap>(); + private final Map> mapSuccEdges = new HashMap<>(); + private final Map> mapPredEdges = new HashMap<>(); - private final Map> mapSuccStates = new HashMap>(); - private final Map> mapPredStates = new HashMap>(); + private final Map> mapSuccStates = new HashMap<>(); + private final Map> mapPredStates = new HashMap<>(); // statement as graph - protected final VBStyleCollection stats = new VBStyleCollection(); + protected final VBStyleCollection stats = new VBStyleCollection<>(); protected Statement parent; @@ -88,9 +88,9 @@ public class Statement implements IMatchable { protected List exprents; - protected final HashSet labelEdges = new HashSet(); + protected final HashSet labelEdges = new HashSet<>(); - protected final List varDefinitions = new ArrayList(); + protected final List varDefinitions = new ArrayList<>(); // copied statement, s. deobfuscating of irreducible CFGs private boolean copied = false; @@ -106,7 +106,7 @@ public class Statement implements IMatchable { protected boolean containsMonitorExit; - protected HashSet continueSet = new HashSet(); + protected HashSet continueSet = new HashSet<>(); // ***************************************************************************** // initializers @@ -143,7 +143,7 @@ public class Statement implements IMatchable { List lst = map.get(STATEDGE_DIRECT_ALL); if (lst != null) { - map.put(STATEDGE_ALL, new ArrayList(lst)); + map.put(STATEDGE_ALL, new ArrayList<>(lst)); } else { map.remove(STATEDGE_ALL); @@ -186,7 +186,7 @@ public class Statement implements IMatchable { } // exception edges - Set setHandlers = new HashSet(head.getNeighbours(StatEdge.TYPE_EXCEPTION, DIRECTION_FORWARD)); + Set setHandlers = new HashSet<>(head.getNeighbours(StatEdge.TYPE_EXCEPTION, DIRECTION_FORWARD)); for (Statement node : setNodes) { setHandlers.retainAll(node.getNeighbours(StatEdge.TYPE_EXCEPTION, DIRECTION_FORWARD)); } @@ -260,13 +260,13 @@ public class Statement implements IMatchable { List lst = mapEdges.get(edgetype); if (lst == null) { - mapEdges.put(edgetype, lst = new ArrayList()); + mapEdges.put(edgetype, lst = new ArrayList<>()); } lst.add(edge); List lstStates = mapStates.get(edgetype); if (lstStates == null) { - mapStates.put(edgetype, lstStates = new ArrayList()); + mapStates.put(edgetype, lstStates = new ArrayList<>()); } lstStates.add(direction == DIRECTION_BACKWARD ? edge.getSource() : edge.getDestination()); } @@ -442,7 +442,7 @@ public class Statement implements IMatchable { } public List getReversePostOrderList(Statement stat) { - List res = new ArrayList(); + List res = new ArrayList<>(); addToReversePostOrderListIterative(stat, res); @@ -455,14 +455,14 @@ public class Statement implements IMatchable { public List getPostReversePostOrderList(List lstexits) { - List res = new ArrayList(); + List res = new ArrayList<>(); if (lstexits == null) { StrongConnectivityHelper schelper = new StrongConnectivityHelper(this); lstexits = StrongConnectivityHelper.getExitReps(schelper.getComponents()); } - HashSet setVisited = new HashSet(); + HashSet setVisited = new HashSet<>(); for (Statement exit : lstexits) { addToPostReversePostOrderList(exit, res, setVisited); @@ -500,7 +500,7 @@ public class Statement implements IMatchable { // TODO: make obsolete and remove public List getSequentialObjects() { - return new ArrayList(stats); + return new ArrayList<>(stats); } public void initExprents() { @@ -546,7 +546,7 @@ public class Statement implements IMatchable { first = newstat; } - List lst = new ArrayList(oldstat.getLabelEdges()); + List lst = new ArrayList<>(oldstat.getLabelEdges()); for (int i = lst.size() - 1; i >= 0; i--) { StatEdge edge = lst.get(i); @@ -573,9 +573,9 @@ public class Statement implements IMatchable { private static void addToReversePostOrderListIterative(Statement root, List lst) { - LinkedList stackNode = new LinkedList(); - LinkedList stackIndex = new LinkedList(); - HashSet setVisited = new HashSet(); + LinkedList stackNode = new LinkedList<>(); + LinkedList stackIndex = new LinkedList<>(); + HashSet setVisited = new HashSet<>(); stackNode.add(root); stackIndex.add(0); @@ -697,10 +697,10 @@ public class Statement implements IMatchable { List res; if ((type & (type - 1)) == 0) { res = map.get(type); - res = res == null ? new ArrayList() : new ArrayList(res); + res = res == null ? new ArrayList<>() : new ArrayList<>(res); } else { - res = new ArrayList(); + res = new ArrayList<>(); for (int edgetype : StatEdge.TYPES) { if ((type & edgetype) != 0) { List lst = map.get(edgetype); @@ -721,10 +721,10 @@ public class Statement implements IMatchable { List res; if ((type & (type - 1)) == 0) { res = map.get(type); - res = res == null ? new ArrayList() : new ArrayList(res); + res = res == null ? new ArrayList<>() : new ArrayList<>(res); } else { - res = new ArrayList(); + res = new ArrayList<>(); for (int edgetype : StatEdge.TYPES) { if ((type & edgetype) != 0) { List lst = map.get(edgetype); @@ -739,7 +739,7 @@ public class Statement implements IMatchable { } public Set getNeighboursSet(int type, int direction) { - return new HashSet(getNeighbours(type, direction)); + return new HashSet<>(getNeighbours(type, direction)); } public List getSuccessorEdges(int type) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SwitchStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SwitchStatement.java index 5916490..d3cc7f2 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SwitchStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SwitchStatement.java @@ -37,15 +37,15 @@ public class SwitchStatement extends Statement { // private fields // ***************************************************************************** - private List caseStatements = new ArrayList(); + private List caseStatements = new ArrayList<>(); - private List> caseEdges = new ArrayList>(); + private List> caseEdges = new ArrayList<>(); - private List> caseValues = new ArrayList>(); + private List> caseValues = new ArrayList<>(); private StatEdge default_edge; - private final List headexprent = new ArrayList(); + private final List headexprent = new ArrayList<>(); // ***************************************************************************** // constructors @@ -65,7 +65,7 @@ public class SwitchStatement extends Statement { stats.addWithKey(head, head.id); // find post node - Set lstNodes = new HashSet(head.getNeighbours(StatEdge.TYPE_REGULAR, DIRECTION_FORWARD)); + Set lstNodes = new HashSet<>(head.getNeighbours(StatEdge.TYPE_REGULAR, DIRECTION_FORWARD)); // cluster nodes if (poststat != null) { @@ -88,7 +88,7 @@ public class SwitchStatement extends Statement { if (head.type == Statement.TYPE_BASICBLOCK && head.getLastBasicType() == Statement.LASTBASICTYPE_SWITCH) { - List lst = new ArrayList(); + List lst = new ArrayList<>(); if (DecHelper.isChoiceStatement(head, lst)) { Statement post = lst.remove(0); @@ -160,7 +160,7 @@ public class SwitchStatement extends Statement { public List getSequentialObjects() { - List lst = new ArrayList(stats); + List lst = new ArrayList<>(stats); lst.add(1, headexprent.get(0)); return lst; @@ -200,7 +200,7 @@ public class SwitchStatement extends Statement { public void sortEdgesAndNodes() { - HashMap mapEdgeIndex = new HashMap(); + HashMap mapEdgeIndex = new HashMap<>(); List lstFirstSuccs = first.getSuccessorEdges(STATEDGE_DIRECT_ALL); for (int i = 0; i < lstFirstSuccs.size(); i++) { @@ -211,15 +211,15 @@ public class SwitchStatement extends Statement { BasicBlockStatement bbstat = (BasicBlockStatement)first; int[] values = ((SwitchInstruction)bbstat.getBlock().getLastInstruction()).getValues(); - List nodes = new ArrayList(); - List> edges = new ArrayList>(); + List nodes = new ArrayList<>(); + List> edges = new ArrayList<>(); // collect regular edges for (int i = 1; i < stats.size(); i++) { Statement stat = stats.get(i); - List lst = new ArrayList(); + List lst = new ArrayList<>(); for (StatEdge edge : stat.getPredecessorEdges(StatEdge.TYPE_REGULAR)) { if (edge.getSource() == first) { lst.add(mapEdgeIndex.get(edge)); @@ -236,7 +236,7 @@ public class SwitchStatement extends Statement { while (!lstExitEdges.isEmpty()) { StatEdge edge = lstExitEdges.get(0); - List lst = new ArrayList(); + List lst = new ArrayList<>(); for (int i = lstExitEdges.size() - 1; i >= 0; i--) { StatEdge edgeTemp = lstExitEdges.get(i); if (edgeTemp.getDestination() == edge.getDestination() && edgeTemp.getType() == edge.getType()) { @@ -265,7 +265,7 @@ public class SwitchStatement extends Statement { Statement stat = nodes.get(index); if (stat != null) { - HashSet setPreds = new HashSet(stat.getNeighbours(StatEdge.TYPE_REGULAR, DIRECTION_BACKWARD)); + HashSet setPreds = new HashSet<>(stat.getNeighbours(StatEdge.TYPE_REGULAR, DIRECTION_BACKWARD)); setPreds.remove(first); if (!setPreds.isEmpty()) { @@ -293,12 +293,12 @@ public class SwitchStatement extends Statement { } // translate indices back into edges - List> lstEdges = new ArrayList>(); - List> lstValues = new ArrayList>(); + List> lstEdges = new ArrayList<>(); + List> lstValues = new ArrayList<>(); for (List lst : edges) { - List lste = new ArrayList(); - List lstv = new ArrayList(); + List lste = new ArrayList<>(); + List lstv = new ArrayList<>(); List lstSuccs = first.getSuccessorEdges(STATEDGE_DIRECT_ALL); for (Integer in : lst) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SynchronizedStatement.java b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SynchronizedStatement.java index b71531f..04b03fe 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SynchronizedStatement.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/stats/SynchronizedStatement.java @@ -32,7 +32,7 @@ public class SynchronizedStatement extends Statement { private Statement body; - private final List headexprent = new ArrayList(); + private final List headexprent = new ArrayList<>(); // ***************************************************************************** // constructors @@ -106,7 +106,7 @@ public class SynchronizedStatement extends Statement { public List getSequentialObjects() { - List lst = new ArrayList(stats); + List lst = new ArrayList<>(stats); lst.add(1, headexprent.get(0)); return lst; diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/CheckTypesResult.java b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/CheckTypesResult.java index 12bcc32..883a684 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/CheckTypesResult.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/CheckTypesResult.java @@ -23,9 +23,9 @@ import java.util.List; public class CheckTypesResult { - private final List lstMaxTypeExprents = new ArrayList(); + private final List lstMaxTypeExprents = new ArrayList<>(); - private final List lstMinTypeExprents = new ArrayList(); + private final List lstMinTypeExprents = new ArrayList<>(); public void addMaxTypeExprent(Exprent exprent, VarType type) { lstMaxTypeExprents.add(new ExprentTypePair(exprent, type, null)); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.java b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.java index 23b1c5e..a0a14cb 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.java @@ -45,9 +45,9 @@ public class VarDefinitionHelper { public VarDefinitionHelper(Statement root, StructMethod mt, VarProcessor varproc) { - mapVarDefStatements = new HashMap(); - mapStatementVars = new HashMap>(); - implDefVars = new HashSet(); + mapVarDefStatements = new HashMap<>(); + mapStatementVars = new HashMap<>(); + implDefVars = new HashSet<>(); this.varproc = varproc; @@ -92,7 +92,7 @@ public class VarDefinitionHelper { } // catch variables are implicitly defined - LinkedList stack = new LinkedList(); + LinkedList stack = new LinkedList<>(); stack.add(root); while (!stack.isEmpty()) { @@ -211,7 +211,7 @@ public class VarDefinitionHelper { private Statement findFirstBlock(Statement stat, Integer varindex) { - LinkedList stack = new LinkedList(); + LinkedList stack = new LinkedList<>(); stack.add(stat); while (!stack.isEmpty()) { @@ -251,15 +251,15 @@ public class VarDefinitionHelper { private Set initStatement(Statement stat) { - HashMap mapCount = new HashMap(); + HashMap mapCount = new HashMap<>(); List condlst; if (stat.getExprents() == null) { // recurse on children statements - List childVars = new ArrayList(); - List currVars = new ArrayList(); + List childVars = new ArrayList<>(); + List currVars = new ArrayList<>(); for (Object obj : stat.getSequentialObjects()) { if (obj instanceof Statement) { @@ -306,7 +306,7 @@ public class VarDefinitionHelper { } - HashSet set = new HashSet(mapCount.keySet()); + HashSet set = new HashSet<>(mapCount.keySet()); // put all variables defined in this statement into the set for (Entry en : mapCount.entrySet()) { @@ -322,8 +322,8 @@ public class VarDefinitionHelper { private static List getAllVars(List lst) { - List res = new ArrayList(); - List listTemp = new ArrayList(); + List res = new ArrayList<>(); + List listTemp = new ArrayList<>(); for (Exprent expr : lst) { listTemp.addAll(expr.getAllExprents(true)); diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarProcessor.java index 2ba0490..5483f78 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarProcessor.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarProcessor.java @@ -29,10 +29,10 @@ import java.util.Map.Entry; public class VarProcessor { private final StructMethod method; private final MethodDescriptor methodDescriptor; - private Map mapVarNames = new HashMap(); + private Map mapVarNames = new HashMap<>(); private VarVersionsProcessor varVersions; - private final Map thisVars = new HashMap(); - private final Set externalVars = new HashSet(); + private final Map thisVars = new HashMap<>(); + private final Set externalVars = new HashSet<>(); public VarProcessor(StructMethod mt, MethodDescriptor md) { method = mt; @@ -45,7 +45,7 @@ public class VarProcessor { } public void setVarDefinitions(Statement root) { - mapVarNames = new HashMap(); + mapVarNames = new HashMap<>(); new VarDefinitionHelper(root, method, this).setVarDefinitions(); } @@ -56,10 +56,10 @@ public class VarProcessor { Map mapOriginalVarIndices = varVersions.getMapOriginalVarIndices(); - List listVars = new ArrayList(mapVarNames.keySet()); + List listVars = new ArrayList<>(mapVarNames.keySet()); Collections.sort(listVars, (o1, o2) -> o1.var - o2.var); - Map mapNames = new HashMap(); + Map mapNames = new HashMap<>(); for (VarVersionPair pair : listVars) { String name = mapVarNames.get(pair); @@ -84,7 +84,7 @@ public class VarProcessor { } public void refreshVarNames(VarNamesCollector vc) { - Map tempVarNames = new HashMap(mapVarNames); + Map tempVarNames = new HashMap<>(mapVarNames); for (Entry ent : tempVarNames.entrySet()) { mapVarNames.put(ent.getKey(), vc.getFreeName(ent.getValue())); } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarTypeProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarTypeProcessor.java index ea95ed0..a142eee 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarTypeProcessor.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarTypeProcessor.java @@ -40,9 +40,9 @@ public class VarTypeProcessor { private final StructMethod method; private final MethodDescriptor methodDescriptor; - private final Map mapExprentMinTypes = new HashMap(); - private final Map mapExprentMaxTypes = new HashMap(); - private final Map mapFinalVars = new HashMap(); + private final Map mapExprentMinTypes = new HashMap<>(); + private final Map mapExprentMaxTypes = new HashMap<>(); + private final Map mapFinalVars = new HashMap<>(); public VarTypeProcessor(StructMethod mt, MethodDescriptor md) { method = mt; @@ -78,7 +78,7 @@ public class VarTypeProcessor { } // catch variables - LinkedList stack = new LinkedList(); + LinkedList stack = new LinkedList<>(); stack.add(root); while (!stack.isEmpty()) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionNode.java b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionNode.java index 9b57833..d0010ca 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionNode.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionNode.java @@ -31,9 +31,9 @@ public class VarVersionNode implements IGraphNode { public final int version; - public final Set succs = new HashSet(); + public final Set succs = new HashSet<>(); - public final Set preds = new HashSet(); + public final Set preds = new HashSet<>(); public int flags; @@ -50,7 +50,7 @@ public class VarVersionNode implements IGraphNode { } public List getPredecessors() { - List lst = new ArrayList(preds.size()); + List lst = new ArrayList<>(preds.size()); for (VarVersionEdge edge : preds) { lst.add(edge.source); } diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionsGraph.java b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionsGraph.java index 8cc11fa..5fd619c 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionsGraph.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionsGraph.java @@ -27,7 +27,7 @@ public class VarVersionsGraph { public int counter = 0; - public final VBStyleCollection nodes = new VBStyleCollection(); + public final VBStyleCollection nodes = new VBStyleCollection<>(); private GenericDominatorEngine engine; @@ -48,13 +48,13 @@ public class VarVersionsGraph { } else { - HashSet marked = new HashSet(); + HashSet marked = new HashSet<>(); if (domnodes.contains(node)) { return true; } - LinkedList lstNodes = new LinkedList(); + LinkedList lstNodes = new LinkedList<>(); lstNodes.add(node); while (!lstNodes.isEmpty()) { @@ -85,7 +85,7 @@ public class VarVersionsGraph { public void initDominators() { - final HashSet roots = new HashSet(); + final HashSet roots = new HashSet<>(); for (VarVersionNode node : nodes) { if (node.preds.isEmpty()) { @@ -108,12 +108,12 @@ public class VarVersionsGraph { private static LinkedList getReversedPostOrder(Collection roots) { - LinkedList lst = new LinkedList(); - HashSet setVisited = new HashSet(); + LinkedList lst = new LinkedList<>(); + HashSet setVisited = new HashSet<>(); for (VarVersionNode root : roots) { - LinkedList lstTemp = new LinkedList(); + LinkedList lstTemp = new LinkedList<>(); addToReversePostOrderListIterative(root, lstTemp, setVisited); lst.addAll(lstTemp); @@ -124,10 +124,10 @@ public class VarVersionsGraph { private static void addToReversePostOrderListIterative(VarVersionNode root, List lst, HashSet setVisited) { - HashMap> mapNodeSuccs = new HashMap>(); + HashMap> mapNodeSuccs = new HashMap<>(); - LinkedList stackNode = new LinkedList(); - LinkedList stackIndex = new LinkedList(); + LinkedList stackNode = new LinkedList<>(); + LinkedList stackIndex = new LinkedList<>(); stackNode.add(root); stackIndex.add(0); @@ -141,7 +141,7 @@ public class VarVersionsGraph { List lstSuccs = mapNodeSuccs.get(node); if (lstSuccs == null) { - mapNodeSuccs.put(node, lstSuccs = new ArrayList(node.succs)); + mapNodeSuccs.put(node, lstSuccs = new ArrayList<>(node.succs)); } for (; index < lstSuccs.size(); index++) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionsProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionsProcessor.java index cadaf83..e68282e 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionsProcessor.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionsProcessor.java @@ -35,7 +35,7 @@ import java.util.Map.Entry; public class VarVersionsProcessor { private final StructMethod method; - private Map mapOriginalVarIndices = new HashMap(); + private Map mapOriginalVarIndices = new HashMap<>(); private VarTypeProcessor typeProcessor; public VarVersionsProcessor(StructMethod mt, MethodDescriptor md) { @@ -65,9 +65,9 @@ public class VarVersionsProcessor { private static void mergePhiVersions(SSAConstructorSparseEx ssa, DirectGraph graph) { // collect phi versions - List> lst = new ArrayList>(); + List> lst = new ArrayList<>(); for (Entry> ent : ssa.getPhi().entrySet()) { - Set set = new HashSet(); + Set set = new HashSet<>(); set.add(ent.getKey()); for (Integer version : ent.getValue()) { set.add(new VarVersionPair(ent.getKey().var, version.intValue())); @@ -75,7 +75,7 @@ public class VarVersionsProcessor { for (int i = lst.size() - 1; i >= 0; i--) { Set tset = lst.get(i); - Set intersection = new HashSet(set); + Set intersection = new HashSet<>(set); intersection.retainAll(tset); if (!intersection.isEmpty()) { @@ -87,7 +87,7 @@ public class VarVersionsProcessor { lst.add(set); } - Map phiVersions = new HashMap(); + Map phiVersions = new HashMap<>(); for (Set set : lst) { int min = Integer.MAX_VALUE; for (VarVersionPair paar : set) { @@ -130,7 +130,7 @@ public class VarVersionsProcessor { Map mapExprentMaxTypes = typeProcessor.getMapExprentMaxTypes(); Map mapExprentMinTypes = typeProcessor.getMapExprentMinTypes(); - Set set = new HashSet(mapExprentMinTypes.keySet()); + Set set = new HashSet<>(mapExprentMinTypes.keySet()); for (VarVersionPair paar : set) { VarType type = mapExprentMinTypes.get(paar); VarType maxType = mapExprentMaxTypes.get(paar); @@ -156,13 +156,13 @@ public class VarVersionsProcessor { Map mapExprentMaxTypes = typeProcessor.getMapExprentMaxTypes(); Map mapExprentMinTypes = typeProcessor.getMapExprentMinTypes(); - Map> mapVarVersions = new HashMap>(); + Map> mapVarVersions = new HashMap<>(); for (VarVersionPair pair : mapExprentMinTypes.keySet()) { if (pair.version >= 0) { // don't merge constants Set set = mapVarVersions.get(pair.var); if (set == null) { - set = new HashSet(); + set = new HashSet<>(); mapVarVersions.put(pair.var, set); } set.add(pair.version); @@ -171,12 +171,12 @@ public class VarVersionsProcessor { boolean is_method_static = mt.hasModifier(CodeConstants.ACC_STATIC); - Map mapMergedVersions = new HashMap(); + Map mapMergedVersions = new HashMap<>(); for (Entry> ent : mapVarVersions.entrySet()) { if (ent.getValue().size() > 1) { - List lstVersions = new ArrayList(ent.getValue()); + List lstVersions = new ArrayList<>(ent.getValue()); Collections.sort(lstVersions); for (int i = 0; i < lstVersions.size(); i++) { @@ -234,11 +234,11 @@ public class VarVersionsProcessor { CounterContainer counters = DecompilerContext.getCounterContainer(); - final Map mapVarPaar = new HashMap(); - Map mapOriginalVarIndices = new HashMap(); + final Map mapVarPaar = new HashMap<>(); + Map mapOriginalVarIndices = new HashMap<>(); // map var-version pairs on new var indexes - Set set = new HashSet(mapExprentMinTypes.keySet()); + Set set = new HashSet<>(mapExprentMinTypes.keySet()); for (VarVersionPair pair : set) { if (pair.version >= 0) { diff --git a/src/org/jetbrains/java/decompiler/modules/renamer/ClassWrapperNode.java b/src/org/jetbrains/java/decompiler/modules/renamer/ClassWrapperNode.java index 566508b..ce2a5c1 100644 --- a/src/org/jetbrains/java/decompiler/modules/renamer/ClassWrapperNode.java +++ b/src/org/jetbrains/java/decompiler/modules/renamer/ClassWrapperNode.java @@ -26,7 +26,7 @@ public class ClassWrapperNode { private ClassWrapperNode superclass; - private final List subclasses = new ArrayList(); + private final List subclasses = new ArrayList<>(); public ClassWrapperNode(StructClass cl) { this.classStruct = cl; diff --git a/src/org/jetbrains/java/decompiler/modules/renamer/ConverterHelper.java b/src/org/jetbrains/java/decompiler/modules/renamer/ConverterHelper.java index 8a431df..71dc351 100644 --- a/src/org/jetbrains/java/decompiler/modules/renamer/ConverterHelper.java +++ b/src/org/jetbrains/java/decompiler/modules/renamer/ConverterHelper.java @@ -23,12 +23,12 @@ import java.util.Set; public class ConverterHelper implements IIdentifierRenamer { - private static final Set KEYWORDS = new HashSet(Arrays.asList( + private static final Set KEYWORDS = new HashSet<>(Arrays.asList( "abstract", "do", "if", "package", "synchronized", "boolean", "double", "implements", "private", "this", "break", "else", "import", "protected", "throw", "byte", "extends", "instanceof", "public", "throws", "case", "false", "int", "return", "transient", "catch", "final", "interface", "short", "true", "char", "finally", "long", "static", "try", "class", "float", "native", "strictfp", "void", "const", "for", "new", "super", "volatile", "continue", "goto", "null", "switch", "while", "default", "assert", "enum")); - private static final Set RESERVED_WINDOWS_NAMESPACE = new HashSet(Arrays.asList( + private static final Set RESERVED_WINDOWS_NAMESPACE = new HashSet<>(Arrays.asList( "aux", "prn", "aux", "nul", "com1", "com2", "com3", "com4", "com5", "com6", "com7", "com8", "com9", "lpt1", "lpt2", "lpt3", "lpt4", "lpt5", "lpt6", "lpt7", "lpt8", "lpt9")); @@ -36,7 +36,7 @@ public class ConverterHelper implements IIdentifierRenamer { private int classCounter = 0; private int fieldCounter = 0; private int methodCounter = 0; - private final Set setNonStandardClassNames = new HashSet(); + private final Set setNonStandardClassNames = new HashSet<>(); @Override public boolean toBeRenamed(Type elementType, String className, String element, String descriptor) { diff --git a/src/org/jetbrains/java/decompiler/modules/renamer/IdentifierConverter.java b/src/org/jetbrains/java/decompiler/modules/renamer/IdentifierConverter.java index ee268e6..223065a 100644 --- a/src/org/jetbrains/java/decompiler/modules/renamer/IdentifierConverter.java +++ b/src/org/jetbrains/java/decompiler/modules/renamer/IdentifierConverter.java @@ -36,9 +36,9 @@ public class IdentifierConverter implements NewClassNameBuilder { private StructContext context; private IIdentifierRenamer helper; private PoolInterceptor interceptor; - private List rootClasses = new ArrayList(); - private List rootInterfaces = new ArrayList(); - private Map> interfaceNameMaps = new HashMap>(); + private List rootClasses = new ArrayList<>(); + private List rootInterfaces = new ArrayList<>(); + private Map> interfaceNameMaps = new HashMap<>(); public void rename(StructContext context) { try { @@ -76,11 +76,11 @@ public class IdentifierConverter implements NewClassNameBuilder { private void renameClasses() { List lstClasses = getReversePostOrderListIterative(rootClasses); - Map> classNameMaps = new HashMap>(); + Map> classNameMaps = new HashMap<>(); for (ClassWrapperNode node : lstClasses) { StructClass cl = node.getClassStruct(); - Map names = new HashMap(); + Map names = new HashMap<>(); // merge information on super class if (cl.superClass != null) { @@ -113,7 +113,7 @@ public class IdentifierConverter implements NewClassNameBuilder { } private Map processExternalInterface(StructClass cl) { - Map names = new HashMap(); + Map names = new HashMap<>(); for (String ifName : cl.getInterfaceNames()) { Map mapInt = interfaceNameMaps.get(ifName); @@ -135,13 +135,13 @@ public class IdentifierConverter implements NewClassNameBuilder { private void renameInterfaces() { List lstInterfaces = getReversePostOrderListIterative(rootInterfaces); - Map> interfaceNameMaps = new HashMap>(); + Map> interfaceNameMaps = new HashMap<>(); // rename methods and fields for (ClassWrapperNode node : lstInterfaces) { StructClass cl = node.getClassStruct(); - Map names = new HashMap(); + Map names = new HashMap<>(); // merge information on super interfaces for (String ifName : cl.getInterfaceNames()) { @@ -161,7 +161,7 @@ public class IdentifierConverter implements NewClassNameBuilder { private void renameAllClasses() { // order not important - List lstAllClasses = new ArrayList(getReversePostOrderListIterative(rootInterfaces)); + List lstAllClasses = new ArrayList<>(getReversePostOrderListIterative(rootInterfaces)); lstAllClasses.addAll(getReversePostOrderListIterative(rootClasses)); // rename all interfaces and classes @@ -203,7 +203,7 @@ public class IdentifierConverter implements NewClassNameBuilder { } // methods - HashSet setMethodNames = new HashSet(); + HashSet setMethodNames = new HashSet<>(); for (StructMethod md : cl.getMethods()) { setMethodNames.add(md.getName()); } @@ -250,7 +250,7 @@ public class IdentifierConverter implements NewClassNameBuilder { // fields // FIXME: should overloaded fields become the same name? - HashSet setFieldNames = new HashSet(); + HashSet setFieldNames = new HashSet<>(); for (StructField fd : cl.getFields()) { setFieldNames.add(fd.getName()); } @@ -286,12 +286,12 @@ public class IdentifierConverter implements NewClassNameBuilder { } private static List getReversePostOrderListIterative(List roots) { - List res = new ArrayList(); + List res = new ArrayList<>(); - LinkedList stackNode = new LinkedList(); - LinkedList stackIndex = new LinkedList(); + LinkedList stackNode = new LinkedList<>(); + LinkedList stackIndex = new LinkedList<>(); - Set setVisited = new HashSet(); + Set setVisited = new HashSet<>(); for (ClassWrapperNode root : roots) { stackNode.add(root); @@ -326,19 +326,19 @@ public class IdentifierConverter implements NewClassNameBuilder { } private void buildInheritanceTree() { - Map nodes = new HashMap(); + Map nodes = new HashMap<>(); Map classes = context.getClasses(); - List rootClasses = new ArrayList(); - List rootInterfaces = new ArrayList(); + List rootClasses = new ArrayList<>(); + List rootInterfaces = new ArrayList<>(); for (StructClass cl : classes.values()) { if (!cl.isOwn()) { continue; } - LinkedList stack = new LinkedList(); - LinkedList stackSubNodes = new LinkedList(); + LinkedList stack = new LinkedList<>(); + LinkedList stackSubNodes = new LinkedList<>(); stack.add(cl); stackSubNodes.add(null); diff --git a/src/org/jetbrains/java/decompiler/modules/renamer/PoolInterceptor.java b/src/org/jetbrains/java/decompiler/modules/renamer/PoolInterceptor.java index 7d589cc..9b4b6c6 100644 --- a/src/org/jetbrains/java/decompiler/modules/renamer/PoolInterceptor.java +++ b/src/org/jetbrains/java/decompiler/modules/renamer/PoolInterceptor.java @@ -23,9 +23,9 @@ public class PoolInterceptor { private final IIdentifierRenamer helper; - private final HashMap mapOldToNewNames = new HashMap(); + private final HashMap mapOldToNewNames = new HashMap<>(); - private final HashMap mapNewToOldNames = new HashMap(); + private final HashMap mapNewToOldNames = new HashMap<>(); public PoolInterceptor(IIdentifierRenamer helper) { this.helper = helper; diff --git a/src/org/jetbrains/java/decompiler/struct/ContextUnit.java b/src/org/jetbrains/java/decompiler/struct/ContextUnit.java index 69125e1..38c9487 100644 --- a/src/org/jetbrains/java/decompiler/struct/ContextUnit.java +++ b/src/org/jetbrains/java/decompiler/struct/ContextUnit.java @@ -42,11 +42,11 @@ public class ContextUnit { private final IResultSaver resultSaver; private final IDecompiledData decompiledData; - private final List classEntries = new ArrayList(); // class file or jar/zip entry - private final List dirEntries = new ArrayList(); - private final List otherEntries = new ArrayList(); + private final List classEntries = new ArrayList<>(); // class file or jar/zip entry + private final List dirEntries = new ArrayList<>(); + private final List otherEntries = new ArrayList<>(); - private List classes = new ArrayList(); + private List 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 lstClasses = new ArrayList(); + List lstClasses = new ArrayList<>(); for (StructClass cl : classes) { String oldName = cl.qualifiedName; diff --git a/src/org/jetbrains/java/decompiler/struct/StructClass.java b/src/org/jetbrains/java/decompiler/struct/StructClass.java index 9a355ab..33dc178 100644 --- a/src/org/jetbrains/java/decompiler/struct/StructClass.java +++ b/src/org/jetbrains/java/decompiler/struct/StructClass.java @@ -93,7 +93,7 @@ public class StructClass extends StructMember { // fields length = in.readUnsignedShort(); - fields = new VBStyleCollection(); + 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(); + 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())); diff --git a/src/org/jetbrains/java/decompiler/struct/StructContext.java b/src/org/jetbrains/java/decompiler/struct/StructContext.java index d47de60..f11e4a4 100644 --- a/src/org/jetbrains/java/decompiler/struct/StructContext.java +++ b/src/org/jetbrains/java/decompiler/struct/StructContext.java @@ -35,8 +35,8 @@ public class StructContext { private final IResultSaver saver; private final IDecompiledData decompiledData; private final LazyLoader loader; - private final Map units = new HashMap(); - private final Map classes = new HashMap(); + private final Map units = new HashMap<>(); + private final Map classes = new HashMap<>(); public StructContext(IResultSaver saver, IDecompiledData decompiledData, LazyLoader loader) { this.saver = saver; diff --git a/src/org/jetbrains/java/decompiler/struct/StructMember.java b/src/org/jetbrains/java/decompiler/struct/StructMember.java index bc8b931..3bc93a1 100644 --- a/src/org/jetbrains/java/decompiler/struct/StructMember.java +++ b/src/org/jetbrains/java/decompiler/struct/StructMember.java @@ -47,7 +47,7 @@ public class StructMember { } protected VBStyleCollection readAttributes(DataInputFullStream in, ConstantPool pool) throws IOException { - VBStyleCollection attributes = new VBStyleCollection(); + VBStyleCollection attributes = new VBStyleCollection<>(); int length = in.readUnsignedShort(); for (int i = 0; i < length; i++) { diff --git a/src/org/jetbrains/java/decompiler/struct/StructMethod.java b/src/org/jetbrains/java/decompiler/struct/StructMethod.java index 48362f3..d398c5e 100644 --- a/src/org/jetbrains/java/decompiler/struct/StructMethod.java +++ b/src/org/jetbrains/java/decompiler/struct/StructMethod.java @@ -119,7 +119,7 @@ public class StructMethod extends StructMember { @SuppressWarnings("AssignmentToForLoopParameter") private InstructionSequence parseBytecode(DataInputFullStream in, int length, ConstantPool pool) throws IOException { - VBStyleCollection instructions = new VBStyleCollection(); + VBStyleCollection instructions = new VBStyleCollection<>(); int bytecode_version = classStruct.getBytecodeVersion(); @@ -137,7 +137,7 @@ public class StructMethod extends StructMember { opcode = in.readUnsignedByte(); } - List operands = new ArrayList(); + List 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 lstHandlers = new ArrayList(); + List lstHandlers = new ArrayList<>(); int exception_count = in.readUnsignedShort(); for (int i = 0; i < exception_count; i++) { diff --git a/src/org/jetbrains/java/decompiler/struct/attr/StructAnnotationAttribute.java b/src/org/jetbrains/java/decompiler/struct/attr/StructAnnotationAttribute.java index 1380427..55c138c 100644 --- a/src/org/jetbrains/java/decompiler/struct/attr/StructAnnotationAttribute.java +++ b/src/org/jetbrains/java/decompiler/struct/attr/StructAnnotationAttribute.java @@ -39,7 +39,7 @@ public class StructAnnotationAttribute extends StructGeneralAttribute { public static List parseAnnotations(ConstantPool pool, DataInputStream data) throws IOException { int len = data.readUnsignedShort(); if (len > 0) { - List annotations = new ArrayList(len); + List 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 values; int len = data.readUnsignedShort(); if (len > 0) { - names = new ArrayList(len); - values = new ArrayList(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 elements = Collections.emptyList(); int len = data.readUnsignedShort(); if (len > 0) { - elements = new ArrayList(len); + elements = new ArrayList<>(len); for (int i = 0; i < len; i++) { elements.add(parseAnnotationElement(data, pool)); } diff --git a/src/org/jetbrains/java/decompiler/struct/attr/StructAnnotationParameterAttribute.java b/src/org/jetbrains/java/decompiler/struct/attr/StructAnnotationParameterAttribute.java index a33c7bb..cee629c 100644 --- a/src/org/jetbrains/java/decompiler/struct/attr/StructAnnotationParameterAttribute.java +++ b/src/org/jetbrains/java/decompiler/struct/attr/StructAnnotationParameterAttribute.java @@ -34,7 +34,7 @@ public class StructAnnotationParameterAttribute extends StructGeneralAttribute { int len = data.readUnsignedByte(); if (len > 0) { - paramAnnotations = new ArrayList>(len); + paramAnnotations = new ArrayList<>(len); for (int i = 0; i < len; i++) { List annotations = StructAnnotationAttribute.parseAnnotations(pool, data); paramAnnotations.add(annotations); diff --git a/src/org/jetbrains/java/decompiler/struct/attr/StructBootstrapMethodsAttribute.java b/src/org/jetbrains/java/decompiler/struct/attr/StructBootstrapMethodsAttribute.java index 597bc7a..f9b5561 100644 --- a/src/org/jetbrains/java/decompiler/struct/attr/StructBootstrapMethodsAttribute.java +++ b/src/org/jetbrains/java/decompiler/struct/attr/StructBootstrapMethodsAttribute.java @@ -26,8 +26,8 @@ import java.util.List; public class StructBootstrapMethodsAttribute extends StructGeneralAttribute { - private final List methodRefs = new ArrayList(); - private final List> methodArguments = new ArrayList>(); + private final List methodRefs = new ArrayList<>(); + private final List> 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 list_arguments = new ArrayList(); + List list_arguments = new ArrayList<>(); for (int j = 0; j < num_bootstrap_arguments; ++j) { int bootstrap_argument_ref = data.readUnsignedShort(); diff --git a/src/org/jetbrains/java/decompiler/struct/attr/StructExceptionsAttribute.java b/src/org/jetbrains/java/decompiler/struct/attr/StructExceptionsAttribute.java index 5eda047..946fa3c 100644 --- a/src/org/jetbrains/java/decompiler/struct/attr/StructExceptionsAttribute.java +++ b/src/org/jetbrains/java/decompiler/struct/attr/StructExceptionsAttribute.java @@ -32,7 +32,7 @@ public class StructExceptionsAttribute extends StructGeneralAttribute { DataInputStream data = stream(); int len = data.readUnsignedShort(); if (len > 0) { - throwsExceptions = new ArrayList(len); + throwsExceptions = new ArrayList<>(len); for (int i = 0; i < len; i++) { throwsExceptions.add(data.readUnsignedShort()); } diff --git a/src/org/jetbrains/java/decompiler/struct/attr/StructInnerClassesAttribute.java b/src/org/jetbrains/java/decompiler/struct/attr/StructInnerClassesAttribute.java index 3c9f760..f576ecf 100644 --- a/src/org/jetbrains/java/decompiler/struct/attr/StructInnerClassesAttribute.java +++ b/src/org/jetbrains/java/decompiler/struct/attr/StructInnerClassesAttribute.java @@ -52,7 +52,7 @@ public class StructInnerClassesAttribute extends StructGeneralAttribute { int len = data.readUnsignedShort(); if (len > 0) { - entries = new ArrayList(len); + entries = new ArrayList<>(len); for (int i = 0; i < len; i++) { int innerNameIdx = data.readUnsignedShort(); diff --git a/src/org/jetbrains/java/decompiler/struct/attr/StructLocalVariableTableAttribute.java b/src/org/jetbrains/java/decompiler/struct/attr/StructLocalVariableTableAttribute.java index fceae35..b57d0cf 100644 --- a/src/org/jetbrains/java/decompiler/struct/attr/StructLocalVariableTableAttribute.java +++ b/src/org/jetbrains/java/decompiler/struct/attr/StructLocalVariableTableAttribute.java @@ -43,7 +43,7 @@ public class StructLocalVariableTableAttribute extends StructGeneralAttribute { int len = data.readUnsignedShort(); if (len > 0) { - mapVarNames = new HashMap(len); + mapVarNames = new HashMap<>(len); for (int i = 0; i < len; i++) { data.discard(4); int nameIndex = data.readUnsignedShort(); diff --git a/src/org/jetbrains/java/decompiler/struct/consts/ConstantPool.java b/src/org/jetbrains/java/decompiler/struct/consts/ConstantPool.java index a204910..8f07b4c 100644 --- a/src/org/jetbrains/java/decompiler/struct/consts/ConstantPool.java +++ b/src/org/jetbrains/java/decompiler/struct/consts/ConstantPool.java @@ -40,7 +40,7 @@ public class ConstantPool implements NewClassNameBuilder { public ConstantPool(DataInputStream in) throws IOException { int size = in.readUnsignedShort(); - pool = new ArrayList(size); + pool = new ArrayList<>(size); BitSet[] nextPass = {new BitSet(size), new BitSet(size), new BitSet(size)}; // first dummy constant diff --git a/src/org/jetbrains/java/decompiler/struct/gen/DataPoint.java b/src/org/jetbrains/java/decompiler/struct/gen/DataPoint.java index 506a51f..546c5a5 100644 --- a/src/org/jetbrains/java/decompiler/struct/gen/DataPoint.java +++ b/src/org/jetbrains/java/decompiler/struct/gen/DataPoint.java @@ -24,9 +24,9 @@ import java.util.List; public class DataPoint { - private List localVariables = new ArrayList(); + private List localVariables = new ArrayList<>(); - private ListStack stack = new ListStack(); + private ListStack 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(localVariables)); + point.setLocalVariables(new ArrayList<>(localVariables)); point.setStack(stack.clone()); return point; } diff --git a/src/org/jetbrains/java/decompiler/struct/gen/MethodDescriptor.java b/src/org/jetbrains/java/decompiler/struct/gen/MethodDescriptor.java index 2465382..3b5abb4 100644 --- a/src/org/jetbrains/java/decompiler/struct/gen/MethodDescriptor.java +++ b/src/org/jetbrains/java/decompiler/struct/gen/MethodDescriptor.java @@ -41,7 +41,7 @@ public class MethodDescriptor { if (parenth > 1) { String parameters = descriptor.substring(1, parenth); - List lst = new ArrayList(); + List lst = new ArrayList<>(); int indexFrom = -1, ind, len = parameters.length(), index = 0; while (index < len) { diff --git a/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericClassDescriptor.java b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericClassDescriptor.java index 2ff2954..077814c 100644 --- a/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericClassDescriptor.java +++ b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericClassDescriptor.java @@ -22,9 +22,9 @@ public class GenericClassDescriptor { public GenericType superclass; - public final List superinterfaces = new ArrayList(); + public final List superinterfaces = new ArrayList<>(); - public final List fparameters = new ArrayList(); + public final List fparameters = new ArrayList<>(); - public final List> fbounds = new ArrayList>(); + public final List> fbounds = new ArrayList<>(); } diff --git a/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericMain.java b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericMain.java index 509783a..a5760a3 100644 --- a/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericMain.java +++ b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericMain.java @@ -142,7 +142,7 @@ public class GenericMain { String param = value.substring(0, to); value = value.substring(to + 1); - List lstBounds = new ArrayList(); + List lstBounds = new ArrayList<>(); while (true) { if (value.charAt(0) == ':') { diff --git a/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericMethodDescriptor.java b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericMethodDescriptor.java index 7ef9399..2d38084 100644 --- a/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericMethodDescriptor.java +++ b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericMethodDescriptor.java @@ -20,13 +20,13 @@ import java.util.List; public class GenericMethodDescriptor { - public final List fparameters = new ArrayList(); + public final List fparameters = new ArrayList<>(); - public final List> fbounds = new ArrayList>(); + public final List> fbounds = new ArrayList<>(); - public final List params = new ArrayList(); + public final List params = new ArrayList<>(); public GenericType ret; - public final List exceptions = new ArrayList(); + public final List exceptions = new ArrayList<>(); } diff --git a/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericType.java b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericType.java index d3b3896..ee71f5b 100644 --- a/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericType.java +++ b/src/org/jetbrains/java/decompiler/struct/gen/generics/GenericType.java @@ -32,9 +32,9 @@ public class GenericType { public final int arrayDim; public final String value; - private final List enclosingClasses = new ArrayList(); - private final List arguments = new ArrayList(); - private final List wildcards = new ArrayList(); + private final List enclosingClasses = new ArrayList<>(); + private final List arguments = new ArrayList<>(); + private final List wildcards = new ArrayList<>(); public GenericType(int type, int arrayDim, String value) { this.type = type; diff --git a/src/org/jetbrains/java/decompiler/struct/lazy/LazyLoader.java b/src/org/jetbrains/java/decompiler/struct/lazy/LazyLoader.java index 40944c1..e0bf3cb 100644 --- a/src/org/jetbrains/java/decompiler/struct/lazy/LazyLoader.java +++ b/src/org/jetbrains/java/decompiler/struct/lazy/LazyLoader.java @@ -27,7 +27,7 @@ import java.util.Map; public class LazyLoader { - private final Map mapClassLinks = new HashMap(); + private final Map mapClassLinks = new HashMap<>(); private final IBytecodeProvider provider; public LazyLoader(IBytecodeProvider provider) { diff --git a/src/org/jetbrains/java/decompiler/struct/match/MatchEngine.java b/src/org/jetbrains/java/decompiler/struct/match/MatchEngine.java index bdef810..a222d67 100644 --- a/src/org/jetbrains/java/decompiler/struct/match/MatchEngine.java +++ b/src/org/jetbrains/java/decompiler/struct/match/MatchEngine.java @@ -36,16 +36,16 @@ public class MatchEngine { private MatchNode rootNode = null; - private final Map variables = new HashMap(); + private final Map variables = new HashMap<>(); - private static final Map stat_properties = new HashMap(); - private static final Map expr_properties = new HashMap(); - private static final Map stat_type = new HashMap(); - private static final Map expr_type = new HashMap(); - private static final Map expr_func_type = new HashMap(); - private static final Map expr_exit_type = new HashMap(); - private static final Map stat_if_type = new HashMap(); - private static final Map expr_const_type = new HashMap(); + private static final Map stat_properties = new HashMap<>(); + private static final Map expr_properties = new HashMap<>(); + private static final Map stat_type = new HashMap<>(); + private static final Map expr_type = new HashMap<>(); + private static final Map expr_func_type = new HashMap<>(); + private static final Map expr_exit_type = new HashMap<>(); + private static final Map stat_if_type = new HashMap<>(); + private static final Map 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 stack = new LinkedList(); + LinkedList stack = new LinkedList<>(); for(String line : lines) { - List properties = new ArrayList(Arrays.asList(line.split("\\s+"))); // split on any number of whitespaces + List properties = new ArrayList<>(Arrays.asList(line.split("\\s+"))); // split on any number of whitespaces if(properties.get(0).isEmpty()) { properties.remove(0); } diff --git a/src/org/jetbrains/java/decompiler/struct/match/MatchNode.java b/src/org/jetbrains/java/decompiler/struct/match/MatchNode.java index f922a3c..8d52aa9 100644 --- a/src/org/jetbrains/java/decompiler/struct/match/MatchNode.java +++ b/src/org/jetbrains/java/decompiler/struct/match/MatchNode.java @@ -48,9 +48,9 @@ public class MatchNode { private final int type; - private final Map rules = new HashMap(); + private final Map rules = new HashMap<>(); - private final List children = new ArrayList(); + private final List children = new ArrayList<>(); public MatchNode(int type) { diff --git a/src/org/jetbrains/java/decompiler/util/FastFixedSetFactory.java b/src/org/jetbrains/java/decompiler/util/FastFixedSetFactory.java index 09ce36b..cd568a8 100644 --- a/src/org/jetbrains/java/decompiler/util/FastFixedSetFactory.java +++ b/src/org/jetbrains/java/decompiler/util/FastFixedSetFactory.java @@ -19,7 +19,7 @@ import java.util.*; public class FastFixedSetFactory { - private final VBStyleCollection colValuesInternal = new VBStyleCollection(); + private final VBStyleCollection colValuesInternal = new VBStyleCollection<>(); private final int dataLength; @@ -46,7 +46,7 @@ public class FastFixedSetFactory { } public FastFixedSet spawnEmptySet() { - return new FastFixedSet(this); + return new FastFixedSet<>(this); } private int getDataLength() { @@ -74,7 +74,7 @@ public class FastFixedSetFactory { public FastFixedSet getCopy() { - FastFixedSet copy = new FastFixedSet(factory); + FastFixedSet copy = new FastFixedSet<>(factory); int arrlength = data.length; int[] cpdata = new int[arrlength]; @@ -201,15 +201,15 @@ public class FastFixedSetFactory { } public Iterator iterator() { - return new FastFixedSetIterator(this); + return new FastFixedSetIterator<>(this); } public Set toPlainSet() { - return toPlainCollection(new HashSet()); + return toPlainCollection(new HashSet<>()); } public List toPlainList() { - return toPlainCollection(new ArrayList()); + return toPlainCollection(new ArrayList<>()); } diff --git a/src/org/jetbrains/java/decompiler/util/FastSetFactory.java b/src/org/jetbrains/java/decompiler/util/FastSetFactory.java index ab80150..94ddfce 100644 --- a/src/org/jetbrains/java/decompiler/util/FastSetFactory.java +++ b/src/org/jetbrains/java/decompiler/util/FastSetFactory.java @@ -22,7 +22,7 @@ import java.util.Set; public class FastSetFactory { - private final VBStyleCollection colValuesInternal = new VBStyleCollection(); + private final VBStyleCollection colValuesInternal = new VBStyleCollection<>(); private int lastBlock; @@ -71,7 +71,7 @@ public class FastSetFactory { } public FastSet spawnEmptySet() { - return new FastSet(this); + return new FastSet<>(this); } public int getLastBlock() { @@ -103,7 +103,7 @@ public class FastSetFactory { public FastSet getCopy() { - FastSet copy = new FastSet(factory); + FastSet copy = new FastSet<>(factory); int arrlength = data.length; int[] cpdata = new int[arrlength]; @@ -363,11 +363,11 @@ public class FastSetFactory { } public Iterator iterator() { - return new FastSetIterator(this); + return new FastSetIterator<>(this); } public Set toPlainSet() { - HashSet set = new HashSet(); + HashSet set = new HashSet<>(); int[] intdata = data; diff --git a/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java b/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java index a4ad9ac..563a404 100644 --- a/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java +++ b/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java @@ -22,7 +22,7 @@ import java.util.Set; public class FastSparseSetFactory { - private final VBStyleCollection colValuesInternal = new VBStyleCollection(); + private final VBStyleCollection colValuesInternal = new VBStyleCollection<>(); private int lastBlock; @@ -71,7 +71,7 @@ public class FastSparseSetFactory { } public FastSparseSet spawnEmptySet() { - return new FastSparseSet(this); + return new FastSparseSet<>(this); } public int getLastBlock() { @@ -123,7 +123,7 @@ public class FastSparseSetFactory { System.arraycopy(data, 0, cpdata, 0, arrlength); System.arraycopy(next, 0, cpnext, 0, arrlength); - return new FastSparseSet(factory, cpdata, cpnext); + return new FastSparseSet<>(factory, cpdata, cpnext); } private int[] ensureCapacity(int index) { @@ -410,11 +410,11 @@ public class FastSparseSetFactory { } public Iterator iterator() { - return new FastSparseSetIterator(this); + return new FastSparseSetIterator<>(this); } public Set toPlainSet() { - HashSet set = new HashSet(); + HashSet set = new HashSet<>(); int[] intdata = data; diff --git a/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java b/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java index 5576aa1..a70f0b3 100644 --- a/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java +++ b/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java @@ -88,7 +88,7 @@ public class InterpreterUtil { return false; } - HashSet set = new HashSet(c1); + HashSet set = new HashSet<>(c1); set.removeAll(c2); return (set.size() == 0); } diff --git a/src/org/jetbrains/java/decompiler/util/ListStack.java b/src/org/jetbrains/java/decompiler/util/ListStack.java index 19c2416..b4aa978 100644 --- a/src/org/jetbrains/java/decompiler/util/ListStack.java +++ b/src/org/jetbrains/java/decompiler/util/ListStack.java @@ -30,7 +30,7 @@ public class ListStack extends ArrayList { } public ListStack clone() { - ListStack newstack = new ListStack(this); + ListStack newstack = new ListStack<>(this); newstack.pointer = this.pointer; return newstack; } diff --git a/src/org/jetbrains/java/decompiler/util/SFormsFastMapDirect.java b/src/org/jetbrains/java/decompiler/util/SFormsFastMapDirect.java index fd9d5c4..0537e4e 100644 --- a/src/org/jetbrains/java/decompiler/util/SFormsFastMapDirect.java +++ b/src/org/jetbrains/java/decompiler/util/SFormsFastMapDirect.java @@ -353,7 +353,7 @@ public class SFormsFastMapDirect { } public List>> entryList() { - List>> list = new ArrayList>>(); + List>> list = new ArrayList<>(); for (int i = 2; i >= 0; i--) { int ikey = 0; diff --git a/src/org/jetbrains/java/decompiler/util/VBStyleCollection.java b/src/org/jetbrains/java/decompiler/util/VBStyleCollection.java index cdc1762..000581d 100644 --- a/src/org/jetbrains/java/decompiler/util/VBStyleCollection.java +++ b/src/org/jetbrains/java/decompiler/util/VBStyleCollection.java @@ -22,9 +22,9 @@ import java.util.HashMap; public class VBStyleCollection extends ArrayList { - private HashMap map = new HashMap(); + private HashMap map = new HashMap<>(); - private ArrayList lstKeys = new ArrayList(); + private ArrayList lstKeys = new ArrayList<>(); public VBStyleCollection() { super(); @@ -32,8 +32,8 @@ public class VBStyleCollection extends ArrayList { public VBStyleCollection(int initialCapacity) { super(initialCapacity); - lstKeys = new ArrayList(initialCapacity); - map = new HashMap(initialCapacity); + lstKeys = new ArrayList<>(initialCapacity); + map = new HashMap<>(initialCapacity); } public VBStyleCollection(Collection c) { @@ -150,10 +150,10 @@ public class VBStyleCollection extends ArrayList { } public VBStyleCollection clone() { - VBStyleCollection c = new VBStyleCollection(); - c.addAll(new ArrayList(this)); - c.setMap(new HashMap(map)); - c.setLstKeys(new ArrayList(lstKeys)); + VBStyleCollection c = new VBStyleCollection<>(); + c.addAll(new ArrayList<>(this)); + c.setMap(new HashMap<>(map)); + c.setLstKeys(new ArrayList<>(lstKeys)); return c; } diff --git a/test/org/jetbrains/java/decompiler/DecompilerTestFixture.java b/test/org/jetbrains/java/decompiler/DecompilerTestFixture.java index 1621142..df27781 100644 --- a/test/org/jetbrains/java/decompiler/DecompilerTestFixture.java +++ b/test/org/jetbrains/java/decompiler/DecompilerTestFixture.java @@ -52,7 +52,7 @@ public class DecompilerTestFixture { targetDir = new File(tempDir, "decompiled"); assertThat(targetDir.mkdirs()).isTrue(); - Map options = new HashMap(); + Map options = new HashMap<>(); options.put(IFernflowerPreferences.LOG_LEVEL, "warn"); options.put(IFernflowerPreferences.DECOMPILE_GENERIC_SIGNATURES, "1"); options.put(IFernflowerPreferences.REMOVE_SYNTHETIC, "1"); diff --git a/test/org/jetbrains/java/decompiler/SingleClassesTest.java b/test/org/jetbrains/java/decompiler/SingleClassesTest.java index f715f4f..d571281 100644 --- a/test/org/jetbrains/java/decompiler/SingleClassesTest.java +++ b/test/org/jetbrains/java/decompiler/SingleClassesTest.java @@ -118,7 +118,7 @@ public class SingleClassesTest { } private static List collectClasses(File classFile) { - List files = new ArrayList(); + List files = new ArrayList<>(); files.add(classFile); File parent = classFile.getParentFile();