explicit types to diamonds

master
Anna.Kozlova 8 years ago
parent 21668f8479
commit 947fae191f
  1. 2
      src/org/jetbrains/java/decompiler/code/InstructionSequence.java
  2. 12
      src/org/jetbrains/java/decompiler/code/cfg/BasicBlock.java
  3. 56
      src/org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.java
  4. 6
      src/org/jetbrains/java/decompiler/code/cfg/ExceptionRangeCFG.java
  5. 4
      src/org/jetbrains/java/decompiler/main/AssertProcessor.java
  6. 4
      src/org/jetbrains/java/decompiler/main/ClassReference14Processor.java
  7. 24
      src/org/jetbrains/java/decompiler/main/ClassesProcessor.java
  8. 4
      src/org/jetbrains/java/decompiler/main/DecompilerContext.java
  9. 4
      src/org/jetbrains/java/decompiler/main/InitializerProcessor.java
  10. 14
      src/org/jetbrains/java/decompiler/main/TextBuffer.java
  11. 6
      src/org/jetbrains/java/decompiler/main/collectors/BytecodeMappingTracer.java
  12. 14
      src/org/jetbrains/java/decompiler/main/collectors/BytecodeSourceMapper.java
  13. 8
      src/org/jetbrains/java/decompiler/main/collectors/ImportCollector.java
  14. 2
      src/org/jetbrains/java/decompiler/main/collectors/VarNamesCollector.java
  15. 12
      src/org/jetbrains/java/decompiler/main/decompiler/ConsoleDecompiler.java
  16. 10
      src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java
  17. 2
      src/org/jetbrains/java/decompiler/main/rels/LambdaProcessor.java
  18. 2
      src/org/jetbrains/java/decompiler/main/rels/MethodWrapper.java
  19. 44
      src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java
  20. 6
      src/org/jetbrains/java/decompiler/main/rels/NestedMemberAccess.java
  21. 32
      src/org/jetbrains/java/decompiler/modules/code/DeadCodeHelper.java
  22. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/ClearStructHelper.java
  23. 6
      src/org/jetbrains/java/decompiler/modules/decompiler/ConcatenationHelper.java
  24. 10
      src/org/jetbrains/java/decompiler/modules/decompiler/DecHelper.java
  25. 46
      src/org/jetbrains/java/decompiler/modules/decompiler/DomHelper.java
  26. 8
      src/org/jetbrains/java/decompiler/modules/decompiler/EliminateLoopsHelper.java
  27. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/ExitHelper.java
  28. 24
      src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java
  29. 54
      src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java
  30. 18
      src/org/jetbrains/java/decompiler/modules/decompiler/IfHelper.java
  31. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/InlineSingleBlockHelper.java
  32. 20
      src/org/jetbrains/java/decompiler/modules/decompiler/LabelHelper.java
  33. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/LoopExtractHelper.java
  34. 6
      src/org/jetbrains/java/decompiler/modules/decompiler/MergeHelper.java
  35. 4
      src/org/jetbrains/java/decompiler/modules/decompiler/PPandMMHelper.java
  36. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/PrimitiveExprsList.java
  37. 8
      src/org/jetbrains/java/decompiler/modules/decompiler/SecondaryFunctionsHelper.java
  38. 6
      src/org/jetbrains/java/decompiler/modules/decompiler/SequenceHelper.java
  39. 10
      src/org/jetbrains/java/decompiler/modules/decompiler/SimplifyExprentsHelper.java
  40. 40
      src/org/jetbrains/java/decompiler/modules/decompiler/StackVarsProcessor.java
  41. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/StatEdge.java
  42. 18
      src/org/jetbrains/java/decompiler/modules/decompiler/StrongConnectivityHelper.java
  43. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DominatorEngine.java
  44. 16
      src/org/jetbrains/java/decompiler/modules/decompiler/decompose/DominatorTreeExceptionFilter.java
  45. 26
      src/org/jetbrains/java/decompiler/modules/decompiler/decompose/FastExtendedPostdominanceHelper.java
  46. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/decompose/GenericDominatorEngine.java
  47. 32
      src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/ExceptionDeobfuscator.java
  48. 8
      src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/IrreducibleCFGDeobfuscator.java
  49. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/ArrayExprent.java
  50. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/AssignmentExprent.java
  51. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/ConstExprent.java
  52. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/ExitExprent.java
  53. 6
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/Exprent.java
  54. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/FieldExprent.java
  55. 10
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java
  56. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/IfExprent.java
  57. 10
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/InvocationExprent.java
  58. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/MonitorExprent.java
  59. 14
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/NewExprent.java
  60. 8
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/SwitchExprent.java
  61. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/VarExprent.java
  62. 22
      src/org/jetbrains/java/decompiler/modules/decompiler/sforms/DirectGraph.java
  63. 6
      src/org/jetbrains/java/decompiler/modules/decompiler/sforms/DirectNode.java
  64. 34
      src/org/jetbrains/java/decompiler/modules/decompiler/sforms/FlattenStatementsHelper.java
  65. 22
      src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAConstructorSparseEx.java
  66. 38
      src/org/jetbrains/java/decompiler/modules/decompiler/sforms/SSAUConstructorSparseEx.java
  67. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchAllStatement.java
  68. 10
      src/org/jetbrains/java/decompiler/modules/decompiler/stats/CatchStatement.java
  69. 8
      src/org/jetbrains/java/decompiler/modules/decompiler/stats/DoStatement.java
  70. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/stats/DummyExitStatement.java
  71. 2
      src/org/jetbrains/java/decompiler/modules/decompiler/stats/GeneralStatement.java
  72. 6
      src/org/jetbrains/java/decompiler/modules/decompiler/stats/IfStatement.java
  73. 50
      src/org/jetbrains/java/decompiler/modules/decompiler/stats/Statement.java
  74. 34
      src/org/jetbrains/java/decompiler/modules/decompiler/stats/SwitchStatement.java
  75. 4
      src/org/jetbrains/java/decompiler/modules/decompiler/stats/SynchronizedStatement.java
  76. 4
      src/org/jetbrains/java/decompiler/modules/decompiler/vars/CheckTypesResult.java
  77. 22
      src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarDefinitionHelper.java
  78. 14
      src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarProcessor.java
  79. 8
      src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarTypeProcessor.java
  80. 6
      src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionNode.java
  81. 22
      src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionsGraph.java
  82. 26
      src/org/jetbrains/java/decompiler/modules/decompiler/vars/VarVersionsProcessor.java
  83. 2
      src/org/jetbrains/java/decompiler/modules/renamer/ClassWrapperNode.java
  84. 6
      src/org/jetbrains/java/decompiler/modules/renamer/ConverterHelper.java
  85. 40
      src/org/jetbrains/java/decompiler/modules/renamer/IdentifierConverter.java
  86. 4
      src/org/jetbrains/java/decompiler/modules/renamer/PoolInterceptor.java
  87. 10
      src/org/jetbrains/java/decompiler/struct/ContextUnit.java
  88. 4
      src/org/jetbrains/java/decompiler/struct/StructClass.java
  89. 4
      src/org/jetbrains/java/decompiler/struct/StructContext.java
  90. 2
      src/org/jetbrains/java/decompiler/struct/StructMember.java
  91. 6
      src/org/jetbrains/java/decompiler/struct/StructMethod.java
  92. 8
      src/org/jetbrains/java/decompiler/struct/attr/StructAnnotationAttribute.java
  93. 2
      src/org/jetbrains/java/decompiler/struct/attr/StructAnnotationParameterAttribute.java
  94. 6
      src/org/jetbrains/java/decompiler/struct/attr/StructBootstrapMethodsAttribute.java
  95. 2
      src/org/jetbrains/java/decompiler/struct/attr/StructExceptionsAttribute.java
  96. 2
      src/org/jetbrains/java/decompiler/struct/attr/StructInnerClassesAttribute.java
  97. 2
      src/org/jetbrains/java/decompiler/struct/attr/StructLocalVariableTableAttribute.java
  98. 2
      src/org/jetbrains/java/decompiler/struct/consts/ConstantPool.java
  99. 6
      src/org/jetbrains/java/decompiler/struct/gen/DataPoint.java
  100. 2
      src/org/jetbrains/java/decompiler/struct/gen/MethodDescriptor.java
  101. Some files were not shown because too many files have changed in this diff Show More

@ -41,7 +41,7 @@ public abstract class InstructionSequence {
protected ExceptionTable exceptionTable = ExceptionTable.EMPTY;
protected InstructionSequence() {
this(new VBStyleCollection<Instruction, Integer>());
this(new VBStyleCollection<>());
}
protected InstructionSequence(VBStyleCollection<Instruction, Integer> collinstr) {

@ -40,15 +40,15 @@ public class BasicBlock implements IGraphNode {
private InstructionSequence seq = new SimpleInstructionSequence();
private List<BasicBlock> preds = new ArrayList<BasicBlock>();
private List<BasicBlock> preds = new ArrayList<>();
private List<BasicBlock> succs = new ArrayList<BasicBlock>();
private List<BasicBlock> succs = new ArrayList<>();
private final List<Integer> instrOldOffsets = new ArrayList<Integer>();
private final List<Integer> instrOldOffsets = new ArrayList<>();
private List<BasicBlock> predExceptions = new ArrayList<BasicBlock>();
private List<BasicBlock> predExceptions = new ArrayList<>();
private List<BasicBlock> succExceptions = new ArrayList<BasicBlock>();
private List<BasicBlock> succExceptions = new ArrayList<>();
public BasicBlock(int id) {
this.id = id;
@ -216,7 +216,7 @@ public class BasicBlock implements IGraphNode {
}
public List<? extends IGraphNode> getPredecessors() {
List<BasicBlock> lst = new ArrayList<BasicBlock>(preds);
List<BasicBlock> lst = new ArrayList<>(preds);
lst.addAll(predExceptions);
return lst;
}

@ -47,7 +47,7 @@ public class ControlFlowGraph implements CodeConstants {
private Map<BasicBlock, BasicBlock> subroutines;
private Set<BasicBlock> finallyExits = new HashSet<BasicBlock>();
private Set<BasicBlock> finallyExits = new HashSet<>();
// *****************************************************************************
// constructors
@ -225,7 +225,7 @@ public class ControlFlowGraph implements CodeConstants {
short[] states = findStartInstructions(instrseq);
Map<Integer, BasicBlock> mapInstrBlocks = new HashMap<Integer, BasicBlock>();
Map<Integer, BasicBlock> mapInstrBlocks = new HashMap<>();
VBStyleCollection<BasicBlock, Integer> 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<Integer> excSet = new HashSet<Integer>();
Set<Integer> 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<Integer, BasicBlock> mapInstrBlocks) {
VBStyleCollection<BasicBlock, Integer> col = new VBStyleCollection<BasicBlock, Integer>();
VBStyleCollection<BasicBlock, Integer> col = new VBStyleCollection<>();
InstructionSequence currseq = null;
List<Integer> lstOffs = null;
@ -367,9 +367,9 @@ public class ControlFlowGraph implements CodeConstants {
private void setExceptionEdges(InstructionSequence instrseq, Map<Integer, BasicBlock> instrBlocks) {
exceptions = new ArrayList<ExceptionRangeCFG>();
exceptions = new ArrayList<>();
Map<String, ExceptionRangeCFG> mapRanges = new HashMap<String, ExceptionRangeCFG>();
Map<String, ExceptionRangeCFG> mapRanges = new HashMap<>();
for (ExceptionHandler handler : instrseq.getExceptionTable().getHandlers()) {
@ -385,7 +385,7 @@ public class ControlFlowGraph implements CodeConstants {
}
else {
List<BasicBlock> protectedRange = new ArrayList<BasicBlock>();
List<BasicBlock> 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<BasicBlock, BasicBlock> subroutines = new HashMap<BasicBlock, BasicBlock>();
final Map<BasicBlock, BasicBlock> subroutines = new HashMap<>();
for (BasicBlock block : blocks) {
if (block.getSeq().getLastInstr().opcode == CodeConstants.opc_jsr) {
LinkedList<BasicBlock> stack = new LinkedList<BasicBlock>();
LinkedList<LinkedList<BasicBlock>> stackJsrStacks = new LinkedList<LinkedList<BasicBlock>>();
LinkedList<BasicBlock> stack = new LinkedList<>();
LinkedList<LinkedList<BasicBlock>> stackJsrStacks = new LinkedList<>();
Set<BasicBlock> setVisited = new HashSet<BasicBlock>();
Set<BasicBlock> setVisited = new HashSet<>();
stack.add(block);
stackJsrStacks.add(new LinkedList<BasicBlock>());
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<BasicBlock>(jsrstack));
stackJsrStacks.add(new LinkedList<>(jsrstack));
}
}
}
@ -480,7 +480,7 @@ public class ControlFlowGraph implements CodeConstants {
private int processJsrRanges() {
List<JsrRecord> lstJsrAll = new ArrayList<JsrRecord>();
List<JsrRecord> lstJsrAll = new ArrayList<>();
// get all jsr ranges
for (Entry<BasicBlock, BasicBlock> ent : subroutines.entrySet()) {
@ -492,7 +492,7 @@ public class ControlFlowGraph implements CodeConstants {
// sort ranges
// FIXME: better sort order
List<JsrRecord> lstJsr = new ArrayList<JsrRecord>();
List<JsrRecord> 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<BasicBlock> set1 = arr1.range;
if (!set.contains(arr1.jsr) && !set1.contains(arr.jsr)) { // rang 0 doesn't contain entry 1 and vice versa
Set<BasicBlock> setc = new HashSet<BasicBlock>(set);
Set<BasicBlock> setc = new HashSet<>(set);
setc.retainAll(set1);
if (!setc.isEmpty()) {
@ -530,9 +530,9 @@ public class ControlFlowGraph implements CodeConstants {
private Set<BasicBlock> getJsrRange(BasicBlock jsr, BasicBlock ret) {
Set<BasicBlock> blocks = new HashSet<BasicBlock>();
Set<BasicBlock> blocks = new HashSet<>();
List<BasicBlock> lstNodes = new LinkedList<BasicBlock>();
List<BasicBlock> 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<BasicBlock> common_blocks) {
List<BasicBlock> lstNodes = new LinkedList<BasicBlock>();
Map<Integer, BasicBlock> mapNewNodes = new HashMap<Integer, BasicBlock>();
List<BasicBlock> lstNodes = new LinkedList<>();
Map<Integer, BasicBlock> 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<BasicBlock> lstRange = range.getProtectedRange();
HashSet<BasicBlock> setBoth = new HashSet<BasicBlock>(common_blocks);
HashSet<BasicBlock> setBoth = new HashSet<>(common_blocks);
setBoth.retainAll(lstRange);
if (setBoth.size() > 0) {
List<BasicBlock> lstNewRange;
if (setBoth.size() == lstRange.size()) {
lstNewRange = new ArrayList<BasicBlock>();
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<VarType>(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<BasicBlock> getReversePostOrder() {
List<BasicBlock> res = new LinkedList<BasicBlock>();
List<BasicBlock> res = new LinkedList<>();
addToReversePostOrderListIterative(first, res);
return res;
@ -782,10 +782,10 @@ public class ControlFlowGraph implements CodeConstants {
private static void addToReversePostOrderListIterative(BasicBlock root, List<BasicBlock> lst) {
LinkedList<BasicBlock> stackNode = new LinkedList<BasicBlock>();
LinkedList<Integer> stackIndex = new LinkedList<Integer>();
LinkedList<BasicBlock> stackNode = new LinkedList<>();
LinkedList<Integer> stackIndex = new LinkedList<>();
Set<BasicBlock> setVisited = new HashSet<BasicBlock>();
Set<BasicBlock> setVisited = new HashSet<>();
stackNode.add(root);
stackIndex.add(0);
@ -797,7 +797,7 @@ public class ControlFlowGraph implements CodeConstants {
setVisited.add(node);
List<BasicBlock> lstSuccs = new ArrayList<BasicBlock>(node.getSuccs());
List<BasicBlock> lstSuccs = new ArrayList<>(node.getSuccs());
lstSuccs.addAll(node.getSuccExceptions());
for (; index < lstSuccs.size(); index++) {

@ -24,7 +24,7 @@ import java.util.Set;
public class ExceptionRangeCFG {
private List<BasicBlock> protectedRange = new ArrayList<BasicBlock>(); // FIXME: replace with set
private List<BasicBlock> 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<String>(exceptionType);
this.exceptionTypes = new ArrayList<>(exceptionType);
}
}
@ -105,7 +105,7 @@ public class ExceptionRangeCFG {
return null;
}
Set<String> setExceptionStrings = new HashSet<String>();
Set<String> setExceptionStrings = new HashSet<>();
for (String exceptionType : exceptionTypes) { // normalize order
setExceptionStrings.add(exceptionType);

@ -169,7 +169,7 @@ public class AssertProcessor {
return false;
}
List<Exprent> lstParams = new ArrayList<Exprent>();
List<Exprent> lstParams = new ArrayList<>();
Exprent ascond = null, retcond = null;
if (exprres[0] != null) {
@ -196,7 +196,7 @@ public class AssertProcessor {
first.removeSuccessor(stat.getIfEdge());
first.removeSuccessor(stat.getElseEdge());
List<Statement> lstStatements = new ArrayList<Statement>();
List<Statement> lstStatements = new ArrayList<>();
if (first.getExprents() != null && !first.getExprents().isEmpty()) {
lstStatements.add(first);
}

@ -74,12 +74,12 @@ public class ClassReference14Processor {
public static void processClassReferences(ClassNode node) {
// find the synthetic method Class class$(String) if present
HashMap<ClassWrapper, MethodWrapper> mapClassMeths = new HashMap<ClassWrapper, MethodWrapper>();
HashMap<ClassWrapper, MethodWrapper> mapClassMeths = new HashMap<>();
mapClassMethods(node, mapClassMeths);
if (mapClassMeths.isEmpty()) {
return;
}
HashSet<ClassWrapper> setFound = new HashSet<ClassWrapper>();
HashSet<ClassWrapper> setFound = new HashSet<>();
processClassRec(node, mapClassMeths, setFound);
if (!setFound.isEmpty()) {

@ -42,7 +42,7 @@ import java.util.Map.Entry;
public class ClassesProcessor {
public static final int AVERAGE_CLASS_SIZE = 16 * 1024;
private final Map<String, ClassNode> mapRootClasses = new HashMap<String, ClassNode>();
private final Map<String, ClassNode> mapRootClasses = new HashMap<>();
private static class Inner {
private String simpleName;
@ -55,10 +55,10 @@ public class ClassesProcessor {
}
public ClassesProcessor(StructContext context) {
Map<String, Inner> mapInnerClasses = new HashMap<String, Inner>();
Map<String, Set<String>> mapNestedClassReferences = new HashMap<String, Set<String>>();
Map<String, Set<String>> mapEnclosingClassReferences = new HashMap<String, Set<String>>();
Map<String, String> mapNewSimpleNames = new HashMap<String, String>();
Map<String, Inner> mapInnerClasses = new HashMap<>();
Map<String, Set<String>> mapNestedClassReferences = new HashMap<>();
Map<String, Set<String>> mapEnclosingClassReferences = new HashMap<>();
Map<String, String> mapNewSimpleNames = new HashMap<>();
boolean bDecompileInner = DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_INNER);
@ -116,14 +116,14 @@ public class ClassesProcessor {
// reference to the nested class
Set<String> set = mapNestedClassReferences.get(enclClassName);
if (set == null) {
mapNestedClassReferences.put(enclClassName, set = new HashSet<String>());
mapNestedClassReferences.put(enclClassName, set = new HashSet<>());
}
set.add(innerName);
// reference to the enclosing class
set = mapEnclosingClassReferences.get(innerName);
if (set == null) {
mapEnclosingClassReferences.put(innerName, set = new HashSet<String>());
mapEnclosingClassReferences.put(innerName, set = new HashSet<>());
}
set.add(enclClassName);
}
@ -143,8 +143,8 @@ public class ClassesProcessor {
for (Entry<String, ClassNode> ent : mapRootClasses.entrySet()) {
// root class?
if (!mapInnerClasses.containsKey(ent.getKey())) {
Set<String> setVisited = new HashSet<String>();
LinkedList<String> stack = new LinkedList<String>();
Set<String> setVisited = new HashSet<>();
LinkedList<String> stack = new LinkedList<>();
stack.add(ent.getKey());
setVisited.add(ent.getKey());
@ -347,10 +347,10 @@ public class ClassesProcessor {
private ClassWrapper wrapper;
public String enclosingMethod;
public InvocationExprent superInvocation;
public final Map<String, VarVersionPair> mapFieldsToVars = new HashMap<String, VarVersionPair>();
public final Map<String, VarVersionPair> mapFieldsToVars = new HashMap<>();
public VarType anonymousClassType;
public final List<ClassNode> nested = new ArrayList<ClassNode>();
public final Set<String> enclosingClasses = new HashSet<String>();
public final List<ClassNode> nested = new ArrayList<>();
public final Set<String> enclosingClasses = new HashSet<>();
public ClassNode parent;
public LambdaInformation lambdaInformation;
public boolean namelessConstructorStub = false;

@ -35,7 +35,7 @@ public class DecompilerContext {
public static final String CURRENT_METHOD_WRAPPER = "CURRENT_METHOD_WRAPPER";
public static final String CURRENT_VAR_PROCESSOR = "CURRENT_VAR_PROCESSOR";
private static final ThreadLocal<DecompilerContext> currentContext = new ThreadLocal<DecompilerContext>();
private static final ThreadLocal<DecompilerContext> currentContext = new ThreadLocal<>();
private final Map<String, Object> properties;
private StructContext structContext;
@ -52,7 +52,7 @@ public class DecompilerContext {
}
public static void initContext(Map<String, Object> propertiesCustom) {
Map<String, Object> properties = new HashMap<String, Object>(IFernflowerPreferences.DEFAULTS);
Map<String, Object> properties = new HashMap<>(IFernflowerPreferences.DEFAULTS);
if (propertiesCustom != null) {
properties.putAll(propertiesCustom);
}

@ -156,8 +156,8 @@ public class InitializerProcessor {
boolean isAnonymous = DecompilerContext.getClassProcessor().getMapRootClasses().get(cl.qualifiedName).type == ClassNode.CLASS_ANONYMOUS;
List<List<Exprent>> lstFirst = new ArrayList<List<Exprent>>();
List<MethodWrapper> lstMethodWrappers = new ArrayList<MethodWrapper>();
List<List<Exprent>> lstFirst = new ArrayList<>();
List<MethodWrapper> lstMethodWrappers = new ArrayList<>();
for (MethodWrapper method : wrapper.getMethods()) {
if (CodeConstants.INIT_NAME.equals(method.methodStruct.getName()) && method.root != null) { // successfully decompiled constructor

@ -105,7 +105,7 @@ public class TextBuffer {
int currentLine = 0;
int previousMarkLine = 0;
int dumpedLines = 0;
ArrayList<Integer> linesWithMarks = new ArrayList<Integer>(myLineToOffsetMapping.keySet());
ArrayList<Integer> linesWithMarks = new ArrayList<>(myLineToOffsetMapping.keySet());
Collections.sort(linesWithMarks);
for (Integer markLine : linesWithMarks) {
Integer markOffset = myLineToOffsetMapping.get(markLine);
@ -194,7 +194,7 @@ public class TextBuffer {
public void setLength(int position) {
myStringBuilder.setLength(position);
if (myLineToOffsetMapping != null) {
HashMap<Integer, Integer> newMap = new HashMap<Integer, Integer>();
HashMap<Integer, Integer> newMap = new HashMap<>();
for (Map.Entry<Integer, Integer> entry : myLineToOffsetMapping.entrySet()) {
if (entry.getValue() <= position) {
newMap.put(entry.getKey(), entry.getValue());
@ -217,7 +217,7 @@ public class TextBuffer {
private void shiftMapping(int startOffset, int shiftOffset) {
if (myLineToOffsetMapping != null) {
HashMap<Integer, Integer> newMap = new HashMap<Integer, Integer>();
HashMap<Integer, Integer> newMap = new HashMap<>();
for (Map.Entry<Integer, Integer> entry : myLineToOffsetMapping.entrySet()) {
int newValue = entry.getValue();
if (newValue >= startOffset) {
@ -233,7 +233,7 @@ public class TextBuffer {
private void checkMapCreated() {
if (myLineToOffsetMapping == null) {
myLineToOffsetMapping = new HashMap<Integer, Integer>();
myLineToOffsetMapping = new HashMap<>();
}
}
@ -264,7 +264,7 @@ public class TextBuffer {
if (srcLines.size() < 2 || srcLines.size() <= requiredLineNumber) {
return srcLines;
}
List<String> res = new LinkedList<String>(srcLines);
List<String> res = new LinkedList<>(srcLines);
// first join lines with a single { or }
for (int i = res.size()-1; i > 0 ; i--) {
String s = res.get(i);
@ -294,12 +294,12 @@ public class TextBuffer {
public void dumpOriginalLineNumbers(int[] lineMapping) {
if (lineMapping.length > 0) {
myLineMapping = new HashMap<Integer, Set<Integer>>();
myLineMapping = new HashMap<>();
for (int i = 0; i < lineMapping.length; i += 2) {
int key = lineMapping[i + 1];
Set<Integer> existing = myLineMapping.get(key);
if (existing == null) {
existing = new TreeSet<Integer>();
existing = new TreeSet<>();
myLineMapping.put(key, existing);
}
existing.add(lineMapping[i]);

@ -25,7 +25,7 @@ public class BytecodeMappingTracer {
private int currentSourceLine;
private StructLineNumberTableAttribute lineNumberTable = null;
private final Map<Integer, Integer> mapping = new HashMap<Integer, Integer>(); // bytecode offset, source line
private final Map<Integer, Integer> mapping = new HashMap<>(); // bytecode offset, source line
public BytecodeMappingTracer() { }
@ -81,7 +81,7 @@ public class BytecodeMappingTracer {
this.lineNumberTable = lineNumberTable;
}
private final Set<Integer> unmappedLines = new HashSet<Integer>();
private final Set<Integer> unmappedLines = new HashSet<>();
public Set<Integer> getUnmappedLines() {
return unmappedLines;
@ -92,7 +92,7 @@ public class BytecodeMappingTracer {
return Collections.emptyMap();
}
Map<Integer, Integer> res = new HashMap<Integer, Integer>();
Map<Integer, Integer> res = new HashMap<>();
// first match offsets from line number table
int[] data = lineNumberTable.getRawData();

@ -26,21 +26,21 @@ public class BytecodeSourceMapper {
private int offset_total;
// class, method, bytecode offset, source line
private final Map<String, Map<String, Map<Integer, Integer>>> mapping = new LinkedHashMap<String, Map<String, Map<Integer, Integer>>>();
private final Map<String, Map<String, Map<Integer, Integer>>> mapping = new LinkedHashMap<>();
// original line to decompiled line
private final Map<Integer, Integer> linesMapping = new HashMap<Integer, Integer>();
private final Set<Integer> unmappedLines = new TreeSet<Integer>();
private final Map<Integer, Integer> linesMapping = new HashMap<>();
private final Set<Integer> unmappedLines = new TreeSet<>();
public void addMapping(String className, String methodName, int bytecodeOffset, int sourceLine) {
Map<String, Map<Integer, Integer>> class_mapping = mapping.get(className);
if (class_mapping == null) {
mapping.put(className, class_mapping = new LinkedHashMap<String, Map<Integer, Integer>>()); // need to preserve order
mapping.put(className, class_mapping = new LinkedHashMap<>()); // need to preserve order
}
Map<Integer, Integer> method_mapping = class_mapping.get(methodName);
if (method_mapping == null) {
class_mapping.put(methodName, method_mapping = new HashMap<Integer, Integer>());
class_mapping.put(methodName, method_mapping = new HashMap<>());
}
// don't overwrite
@ -78,7 +78,7 @@ public class BytecodeSourceMapper {
buffer.appendIndent(1).append("method '" + method_entry.getKey() + "' {" + lineSeparator);
List<Integer> lstBytecodeOffsets = new ArrayList<Integer>(method_mapping.keySet());
List<Integer> lstBytecodeOffsets = new ArrayList<>(method_mapping.keySet());
Collections.sort(lstBytecodeOffsets);
for (Integer offset : lstBytecodeOffsets) {
@ -97,7 +97,7 @@ public class BytecodeSourceMapper {
// lines mapping
buffer.append("Lines mapping:").appendLineSeparator();
Map<Integer, Integer> sorted = new TreeMap<Integer, Integer>(linesMapping);
Map<Integer, Integer> sorted = new TreeMap<>(linesMapping);
for (Entry<Integer, Integer> entry : sorted.entrySet()) {
buffer.append(entry.getKey()).append(" <-> ").append(entry.getValue() + offset_total + 1).appendLineSeparator();
}

@ -26,8 +26,8 @@ import java.util.Map.Entry;
public class ImportCollector {
private static final String JAVA_LANG_PACKAGE = "java.lang";
private final Map<String, String> mapSimpleNames = new HashMap<String, String>();
private final Set<String> setNotImportedNames = new HashSet<String>();
private final Map<String, String> mapSimpleNames = new HashMap<>();
private final Set<String> setNotImportedNames = new HashSet<>();
private final String currentPackageSlash;
private final String currentPackagePoint;
@ -124,7 +124,7 @@ public class ImportCollector {
}
private List<String> packImports() {
List<Entry<String, String>> lst = new ArrayList<Entry<String, String>>(mapSimpleNames.entrySet());
List<Entry<String, String>> lst = new ArrayList<>(mapSimpleNames.entrySet());
Collections.sort(lst, (par0, par1) -> {
int res = par0.getValue().compareTo(par1.getValue());
@ -134,7 +134,7 @@ public class ImportCollector {
return res;
});
List<String> res = new ArrayList<String>();
List<String> res = new ArrayList<>();
for (Entry<String, String> ent : lst) {
// exclude a current class or one of the nested ones, java.lang and empty packages
if (!setNotImportedNames.contains(ent.getKey()) &&

@ -20,7 +20,7 @@ import java.util.Set;
public class VarNamesCollector {
private final Set<String> usedNames = new HashSet<String>();
private final Set<String> usedNames = new HashSet<>();
public VarNamesCollector() { }

@ -41,9 +41,9 @@ public class ConsoleDecompiler implements IBytecodeProvider, IResultSaver {
return;
}
Map<String, Object> mapOptions = new HashMap<String, Object>();
List<File> lstSources = new ArrayList<File>();
List<File> lstLibraries = new ArrayList<File>();
Map<String, Object> mapOptions = new HashMap<>();
List<File> lstSources = new ArrayList<>();
List<File> lstLibraries = new ArrayList<>();
boolean isOption = true;
for (int i = 0; i < args.length - 1; ++i) { // last parameter - destination
@ -113,8 +113,8 @@ public class ConsoleDecompiler implements IBytecodeProvider, IResultSaver {
private final File root;
private final Fernflower fernflower;
private final Map<String, ZipOutputStream> mapArchiveStreams = new HashMap<String, ZipOutputStream>();
private final Map<String, Set<String>> mapArchiveEntries = new HashMap<String, Set<String>>();
private final Map<String, ZipOutputStream> mapArchiveStreams = new HashMap<>();
private final Map<String, Set<String>> mapArchiveEntries = new HashMap<>();
@SuppressWarnings("UseOfSystemOutOrSystemErr")
public ConsoleDecompiler(File destination, Map<String, Object> options) {
@ -266,7 +266,7 @@ public class ConsoleDecompiler implements IBytecodeProvider, IResultSaver {
private boolean checkEntry(String entryName, String file) {
Set<String> set = mapArchiveEntries.get(file);
if (set == null) {
mapArchiveEntries.put(file, set = new HashSet<String>());
mapArchiveEntries.put(file, set = new HashSet<>());
}
boolean added = set.add(entryName);

@ -40,10 +40,10 @@ import java.util.Set;
public class ClassWrapper {
private final StructClass classStruct;
private final Set<String> hiddenMembers = new HashSet<String>();
private final VBStyleCollection<Exprent, String> staticFieldInitializers = new VBStyleCollection<Exprent, String>();
private final VBStyleCollection<Exprent, String> dynamicFieldInitializers = new VBStyleCollection<Exprent, String>();
private final VBStyleCollection<MethodWrapper, String> methods = new VBStyleCollection<MethodWrapper, String>();
private final Set<String> hiddenMembers = new HashSet<>();
private final VBStyleCollection<Exprent, String> staticFieldInitializers = new VBStyleCollection<>();
private final VBStyleCollection<Exprent, String> dynamicFieldInitializers = new VBStyleCollection<>();
private final VBStyleCollection<MethodWrapper, String> methods = new VBStyleCollection<>();
public ClassWrapper(StructClass classStruct) {
this.classStruct = classStruct;
@ -55,7 +55,7 @@ public class ClassWrapper {
DecompilerContext.getLogger().startClass(classStruct.qualifiedName);
// collect field names
Set<String> setFieldNames = new HashSet<String>();
Set<String> setFieldNames = new HashSet<>();
for (StructField fd : classStruct.getFields()) {
setFieldNames.add(fd.getName());
}

@ -78,7 +78,7 @@ public class LambdaProcessor {
return false; // no lambda bootstrap constant found
}
Map<String, String> mapMethodsLambda = new HashMap<String, String>();
Map<String, String> mapMethodsLambda = new HashMap<>();
// iterate over code and find invocations of bootstrap methods. Replace them with anonymous classes.
for (StructMethod mt : cl.getMethods()) {

@ -31,7 +31,7 @@ public class MethodWrapper {
public final VarProcessor varproc;
public final StructMethod methodStruct;
public final CounterContainer counter;
public final HashSet<String> setOuterVarNames = new HashSet<String>();
public final HashSet<String> setOuterVarNames = new HashSet<>();
public DirectGraph graph;
public List<VarVersionPair> signatureFields;

@ -130,7 +130,7 @@ public class NestedClassProcessor {
method.varproc.setVarName(new VarVersionPair(0, 0), parent.simpleName + ".this");
}
final Map<VarVersionPair, String> mapNewNames = new HashMap<VarVersionPair, String>();
final Map<VarVersionPair, String> mapNewNames = new HashMap<>();
enclosingMethod.getOrBuildGraph().iterateExprents(new DirectGraph.ExprentIterator() {
@Override
@ -168,7 +168,7 @@ public class NestedClassProcessor {
});
// update names of local variables
Set<String> setNewOuterNames = new HashSet<String>(mapNewNames.values());
Set<String> setNewOuterNames = new HashSet<>(mapNewNames.values());
setNewOuterNames.removeAll(method.setOuterVarNames);
method.varproc.refreshVarNames(new VarNamesCollector(setNewOuterNames));
@ -180,7 +180,7 @@ public class NestedClassProcessor {
}
private static void checkNotFoundClasses(ClassNode root, ClassNode node) {
List<ClassNode> copy = new ArrayList<ClassNode>(node.nested);
List<ClassNode> copy = new ArrayList<>(node.nested);
for (ClassNode child : copy) {
if (child.classStruct.hasModifier(CodeConstants.ACC_SYNTHETIC)) {
@ -225,7 +225,7 @@ public class NestedClassProcessor {
private static boolean insertNestedClass(ClassNode root, ClassNode child) {
Set<String> setEnclosing = child.enclosingClasses;
LinkedList<ClassNode> stack = new LinkedList<ClassNode>();
LinkedList<ClassNode> stack = new LinkedList<>();
stack.add(root);
while (!stack.isEmpty()) {
@ -248,7 +248,7 @@ public class NestedClassProcessor {
private static void computeLocalVarsAndDefinitions(final ClassNode node) {
// local var masks
// class name, constructor descriptor, field mask
final Map<String, Map<String, List<VarFieldPair>>> mapVarMasks = new HashMap<String, Map<String, List<VarFieldPair>>>();
final Map<String, Map<String, List<VarFieldPair>>> mapVarMasks = new HashMap<>();
int clTypes = 0;
@ -274,7 +274,7 @@ public class NestedClassProcessor {
}
// local var masks
final Map<String, Map<String, List<VarFieldPair>>> mapVarFieldPairs = new HashMap<String, Map<String, List<VarFieldPair>>>();
final Map<String, Map<String, List<VarFieldPair>>> mapVarFieldPairs = new HashMap<>();
if (clTypes != ClassNode.CLASS_MEMBER) {
// iterate enclosing class
@ -298,10 +298,10 @@ public class NestedClassProcessor {
List<VarFieldPair> mask = mapVarMasks.get(refClassName).get(constructor.getStringDescriptor());
if (!mapVarFieldPairs.containsKey(refClassName)) {
mapVarFieldPairs.put(refClassName, new HashMap<String, List<VarFieldPair>>());
mapVarFieldPairs.put(refClassName, new HashMap<>());
}
List<VarFieldPair> lstTemp = new ArrayList<VarFieldPair>();
List<VarFieldPair> lstTemp = new ArrayList<>();
for (int i = 0; i < mask.size(); i++) {
Exprent param = constructor.getLstParameters().get(i);
@ -356,7 +356,7 @@ public class NestedClassProcessor {
if (mapVarFieldPairs.containsKey(enclosing.getKey())) {
for (List<VarFieldPair> mask : mapVarFieldPairs.get(enclosing.getKey()).values()) {
if (interPairMask == null) {
interPairMask = new ArrayList<VarFieldPair>(mask);
interPairMask = new ArrayList<>(mask);
}
else {
mergeListSignatures(interPairMask, mask, false);
@ -368,7 +368,7 @@ public class NestedClassProcessor {
// merge all constructors
for (List<VarFieldPair> mask : enclosing.getValue().values()) {
if (interMask == null) {
interMask = new ArrayList<VarFieldPair>(mask);
interMask = new ArrayList<>(mask);
}
else {
mergeListSignatures(interMask, mask, false);
@ -376,7 +376,7 @@ public class NestedClassProcessor {
}
if (interPairMask == null) { // member or local and never instantiated
interPairMask = interMask != null ? new ArrayList<VarFieldPair>(interMask) : new ArrayList<VarFieldPair>();
interPairMask = interMask != null ? new ArrayList<>(interMask) : new ArrayList<>();
boolean found = false;
@ -403,7 +403,7 @@ public class NestedClassProcessor {
mergeListSignatures(entry.getValue(), interPairMask, false);
MethodWrapper method = nestedNode.getWrapper().getMethodWrapper(CodeConstants.INIT_NAME, entry.getKey());
method.signatureFields = new ArrayList<VarVersionPair>();
method.signatureFields = new ArrayList<>();
for (VarFieldPair pair : entry.getValue()) {
method.signatureFields.add(pair == null ? null : pair.varPair);
@ -419,10 +419,10 @@ public class NestedClassProcessor {
// iterate all child methods
for (final MethodWrapper method : child.getWrapper().getMethods()) {
if (method.root != null) { // neither abstract nor native
Map<VarVersionPair, String> mapNewNames = new HashMap<VarVersionPair, String>(); // local var names
Map<VarVersionPair, VarType> mapNewTypes = new HashMap<VarVersionPair, VarType>(); // local var types
Map<VarVersionPair, String> mapNewNames = new HashMap<>(); // local var names
Map<VarVersionPair, VarType> mapNewTypes = new HashMap<>(); // local var types
final Map<Integer, VarVersionPair> mapParamsToNewVars = new HashMap<Integer, VarVersionPair>();
final Map<Integer, VarVersionPair> mapParamsToNewVars = new HashMap<>();
if (method.signatureFields != null) {
int index = 0, varIndex = 1;
MethodDescriptor md = MethodDescriptor.parseDescriptor(method.methodStruct.getDescriptor());
@ -462,7 +462,7 @@ public class NestedClassProcessor {
}
}
final Map<String, VarVersionPair> mapFieldsToNewVars = new HashMap<String, VarVersionPair>();
final Map<String, VarVersionPair> mapFieldsToNewVars = new HashMap<>();
for (ClassNode classNode = child; classNode != null; classNode = classNode.parent) {
for (Entry<String, VarVersionPair> entry : classNode.mapFieldsToVars.entrySet()) {
VarVersionPair newVar = new VarVersionPair(method.counter.getCounterAndIncrement(CounterContainer.VAR_COUNTER), 0);
@ -503,7 +503,7 @@ public class NestedClassProcessor {
}
}
Set<String> setNewOuterNames = new HashSet<String>(mapNewNames.values());
Set<String> setNewOuterNames = new HashSet<>(mapNewNames.values());
setNewOuterNames.removeAll(method.setOuterVarNames);
method.varproc.refreshVarNames(new VarNamesCollector(setNewOuterNames));
@ -593,7 +593,7 @@ public class NestedClassProcessor {
}
private static Map<String, List<VarFieldPair>> getMaskLocalVars(ClassWrapper wrapper) {
Map<String, List<VarFieldPair>> mapMasks = new HashMap<String, List<VarFieldPair>>();
Map<String, List<VarFieldPair>> mapMasks = new HashMap<>();
StructClass cl = wrapper.getClassStruct();
@ -605,7 +605,7 @@ public class NestedClassProcessor {
DirectGraph graph = method.getOrBuildGraph();
if (graph != null) { // something gone wrong, should not be null
List<VarFieldPair> fields = new ArrayList<VarFieldPair>();
List<VarFieldPair> fields = new ArrayList<>();
int varIndex = 1;
for (int i = 0; i < md.params.length; i++) { // no static methods allowed
@ -754,7 +754,7 @@ public class NestedClassProcessor {
private static void setLocalClassDefinition(MethodWrapper method, ClassNode node) {
RootStatement root = method.root;
Set<Statement> setStats = new HashSet<Statement>();
Set<Statement> setStats = new HashSet<>();
VarType classType = new VarType(node.classStruct.qualifiedName, true);
Statement statement = getDefStatement(root, classType, setStats);
@ -793,7 +793,7 @@ public class NestedClassProcessor {
}
private static Statement findFirstBlock(Statement stat, Set<Statement> setStats) {
LinkedList<Statement> stack = new LinkedList<Statement>();
LinkedList<Statement> stack = new LinkedList<>();
stack.add(stat);
while (!stack.isEmpty()) {
@ -827,7 +827,7 @@ public class NestedClassProcessor {
}
private static Statement getDefStatement(Statement stat, VarType classType, Set<Statement> setStats) {
List<Exprent> lst = new ArrayList<Exprent>();
List<Exprent> lst = new ArrayList<>();
Statement retStat = null;
if (stat.getExprents() == null) {

@ -36,7 +36,7 @@ public class NestedMemberAccess {
private enum MethodAccess {NORMAL, FIELD_GET, FIELD_SET, METHOD, FUNCTION}
private boolean noSynthFlag;
private final Map<MethodWrapper, MethodAccess> mapMethodType = new HashMap<MethodWrapper, MethodAccess>();
private final Map<MethodWrapper, MethodAccess> mapMethodType = new HashMap<>();
public void propagateMemberAccess(ClassNode root) {
@ -231,8 +231,8 @@ public class NestedMemberAccess {
DirectGraph graph = meth.getOrBuildGraph();
HashSet<DirectNode> setVisited = new HashSet<DirectNode>();
LinkedList<DirectNode> stack = new LinkedList<DirectNode>();
HashSet<DirectNode> setVisited = new HashSet<>();
LinkedList<DirectNode> stack = new LinkedList<>();
stack.add(graph.first);
while (!stack.isEmpty()) { // TODO: replace with interface iterator?

@ -30,8 +30,8 @@ public class DeadCodeHelper {
public static void removeDeadBlocks(ControlFlowGraph graph) {
LinkedList<BasicBlock> stack = new LinkedList<BasicBlock>();
HashSet<BasicBlock> setStacked = new HashSet<BasicBlock>();
LinkedList<BasicBlock> stack = new LinkedList<>();
HashSet<BasicBlock> 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<BasicBlock> lstSuccs = new ArrayList<BasicBlock>(block.getSuccs());
List<BasicBlock> lstSuccs = new ArrayList<>(block.getSuccs());
lstSuccs.addAll(block.getSuccExceptions());
for (BasicBlock succ : lstSuccs) {
@ -50,7 +50,7 @@ public class DeadCodeHelper {
}
}
HashSet<BasicBlock> setAllBlocks = new HashSet<BasicBlock>(graph.getBlocks());
HashSet<BasicBlock> setAllBlocks = new HashSet<>(graph.getBlocks());
setAllBlocks.removeAll(setStacked);
for (BasicBlock block : setAllBlocks) {
@ -94,7 +94,7 @@ public class DeadCodeHelper {
}
}
HashSet<BasicBlock> setExits = new HashSet<BasicBlock>(graph.getLast().getPreds());
HashSet<BasicBlock> 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<BasicBlock> setPreds = new HashSet<BasicBlock>(block.getPreds());
HashSet<BasicBlock> setSuccs = new HashSet<BasicBlock>(block.getSuccs());
HashSet<BasicBlock> setPreds = new HashSet<>(block.getPreds());
HashSet<BasicBlock> setSuccs = new HashSet<>(block.getSuccs());
// collect common exception ranges of predecessors and successors
HashSet<BasicBlock> setCommonExceptionHandlers = null;
for (int i = 0; i < 2; ++i) {
for (BasicBlock pred : i == 0 ? setPreds : setSuccs) {
if (setCommonExceptionHandlers == null) {
setCommonExceptionHandlers = new HashSet<BasicBlock>(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<BasicBlock> lstSuccs = new ArrayList<BasicBlock>(block.getSuccs());
List<BasicBlock> 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<BasicBlock> marked = new HashSet<BasicBlock>();
HashSet<BasicBlock> marked = new HashSet<>();
if (block == dom) {
return true;
}
LinkedList<BasicBlock> lstNodes = new LinkedList<BasicBlock>();
LinkedList<BasicBlock> 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<BasicBlock>(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<BasicBlock> setPredHandlersUnion = new HashSet<BasicBlock>();
HashSet<BasicBlock> setPredHandlersIntersection = new HashSet<BasicBlock>();
HashSet<BasicBlock> setPredHandlersUnion = new HashSet<>();
HashSet<BasicBlock> setPredHandlersIntersection = new HashSet<>();
boolean firstpred = true;
for (BasicBlock pred : block.getPreds()) {
@ -339,7 +339,7 @@ public class DeadCodeHelper {
}
// remove redundant ranges
HashSet<BasicBlock> setRangesToBeRemoved = new HashSet<BasicBlock>(block.getSuccExceptions());
HashSet<BasicBlock> 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<BasicBlock>(block.getSuccExceptions())) {
for (BasicBlock succ : new HashSet<>(block.getSuccExceptions())) {
if (!bpred.getSuccExceptions().contains(succ)) {
ExceptionRangeCFG range = graph.getExceptionRange(succ, block);

@ -25,7 +25,7 @@ public class ClearStructHelper {
public static void clearStatements(RootStatement root) {
LinkedList<Statement> stack = new LinkedList<Statement>();
LinkedList<Statement> stack = new LinkedList<>();
stack.add(root);
while (!stack.isEmpty()) {

@ -70,7 +70,7 @@ public class ConcatenationHelper {
// iterate in depth, collecting possible operands
List<Exprent> lstOperands = new ArrayList<Exprent>();
List<Exprent> lstOperands = new ArrayList<>();
while (true) {
@ -160,7 +160,7 @@ public class ConcatenationHelper {
if (constant.type == CodeConstants.CONSTANT_String) {
String recipe = ((PrimitiveConstant)constant).getString();
List<Exprent> res = new ArrayList<Exprent>();
List<Exprent> 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<Exprent>(parameters);
return new ArrayList<>(parameters);
}
private static boolean isAppendConcat(InvocationExprent expr, VarType cltype) {

@ -25,9 +25,9 @@ public class DecHelper {
public static boolean checkStatementExceptions(List<Statement> lst) {
Set<Statement> all = new HashSet<Statement>(lst);
Set<Statement> all = new HashSet<>(lst);
Set<Statement> handlers = new HashSet<Statement>();
Set<Statement> handlers = new HashSet<>();
Set<Statement> intersection = null;
for (Statement stat : lst) {
@ -37,7 +37,7 @@ public class DecHelper {
intersection = setNew;
}
else {
HashSet<Statement> interclone = new HashSet<Statement>(intersection);
HashSet<Statement> interclone = new HashSet<>(intersection);
interclone.removeAll(setNew);
intersection.retainAll(setNew);
@ -197,7 +197,7 @@ public class DecHelper {
public static HashSet<Statement> getUniquePredExceptions(Statement head) {
HashSet<Statement> setHandlers = new HashSet<Statement>(head.getNeighbours(StatEdge.TYPE_EXCEPTION, Statement.DIRECTION_FORWARD));
HashSet<Statement> setHandlers = new HashSet<>(head.getNeighbours(StatEdge.TYPE_EXCEPTION, Statement.DIRECTION_FORWARD));
Iterator<Statement> it = setHandlers.iterator();
while (it.hasNext()) {
@ -209,7 +209,7 @@ public class DecHelper {
}
public static List<Exprent> copyExprentList(List<Exprent> lst) {
List<Exprent> ret = new ArrayList<Exprent>();
List<Exprent> ret = new ArrayList<>();
for (Exprent expr : lst) {
ret.add(expr.copy());
}

@ -35,7 +35,7 @@ public class DomHelper {
private static RootStatement graphToStatement(ControlFlowGraph graph) {
VBStyleCollection<Statement, Integer> stats = new VBStyleCollection<Statement, Integer>();
VBStyleCollection<Statement, Integer> stats = new VBStyleCollection<>();
VBStyleCollection<BasicBlock, Integer> blocks = graph.getBlocks();
for (BasicBlock block : blocks) {
@ -103,14 +103,14 @@ public class DomHelper {
public static VBStyleCollection<List<Integer>, Integer> calcPostDominators(Statement container) {
HashMap<Statement, FastFixedSet<Statement>> lists = new HashMap<Statement, FastFixedSet<Statement>>();
HashMap<Statement, FastFixedSet<Statement>> lists = new HashMap<>();
StrongConnectivityHelper schelper = new StrongConnectivityHelper(container);
List<List<Statement>> components = schelper.getComponents();
List<Statement> lstStats = container.getPostReversePostOrderList(StrongConnectivityHelper.getExitReps(components));
FastFixedSetFactory<Statement> factory = new FastFixedSetFactory<Statement>(lstStats);
FastFixedSetFactory<Statement> factory = new FastFixedSetFactory<>(lstStats);
FastFixedSet<Statement> setFlagNodes = factory.spawnEmptySet();
setFlagNodes.setAllElements();
@ -176,17 +176,17 @@ public class DomHelper {
}
while (!setFlagNodes.isEmpty());
VBStyleCollection<List<Integer>, Integer> ret = new VBStyleCollection<List<Integer>, Integer>();
VBStyleCollection<List<Integer>, Integer> ret = new VBStyleCollection<>();
List<Statement> lstRevPost = container.getReversePostOrderList(); // sort order crucial!
final HashMap<Integer, Integer> mapSortOrder = new HashMap<Integer, Integer>();
final HashMap<Integer, Integer> mapSortOrder = new HashMap<>();
for (int i = 0; i < lstRevPost.size(); i++) {
mapSortOrder.put(lstRevPost.get(i).id, i);
}
for (Statement st : lstStats) {
List<Integer> lstPosts = new ArrayList<Integer>();
List<Integer> 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<Integer, Set<Integer>>())) {
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<StatEdge>());
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<StatEdge>(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<Integer, Set<Integer>>();
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<Integer, Set<Integer>>());
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<Integer, Set<Integer>>();
mapExtPost = new HashMap<>();
mapRefreshed = true;
reducibility = 0;
}
@ -409,7 +409,7 @@ public class DomHelper {
break;
}
else {
mapExtPost = new HashMap<Integer, Set<Integer>>();
mapExtPost = new HashMap<>();
}
}
@ -427,13 +427,13 @@ public class DomHelper {
}
if (forceall) {
vbPost = new VBStyleCollection<List<Integer>, Integer>();
vbPost = new VBStyleCollection<>();
List<Statement> lstAll = stat.getPostReversePostOrderList();
for (Statement st : lstAll) {
Set<Integer> set = mapExtPost.get(st.id);
if (set != null) {
vbPost.addWithKey(new ArrayList<Integer>(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<Integer> lst = vbPost.getWithKey(id);
if (lst == null) {
vbPost.addWithKey(lst = new ArrayList<Integer>(), id);
vbPost.addWithKey(lst = new ArrayList<>(), id);
}
lst.add(id);
}
@ -482,11 +482,11 @@ public class DomHelper {
boolean same = (post == head);
HashSet<Statement> setNodes = new HashSet<Statement>();
HashSet<Statement> setPreds = new HashSet<Statement>();
HashSet<Statement> setNodes = new HashSet<>();
HashSet<Statement> setPreds = new HashSet<>();
// collect statement nodes
HashSet<Statement> setHandlers = new HashSet<Statement>();
HashSet<Statement> setHandlers = new HashSet<>();
setHandlers.add(head);
while (true) {
@ -504,7 +504,7 @@ public class DomHelper {
}
if (addhd) {
LinkedList<Statement> lstStack = new LinkedList<Statement>();
LinkedList<Statement> lstStack = new LinkedList<>();
lstStack.add(handler);
while (!lstStack.isEmpty()) {
@ -618,14 +618,14 @@ public class DomHelper {
// update the postdominator map
if (!mapExtPost.isEmpty()) {
HashSet<Integer> setOldNodes = new HashSet<Integer>();
HashSet<Integer> setOldNodes = new HashSet<>();
for (Statement old : result.getStats()) {
setOldNodes.add(old.id);
}
Integer newid = result.id;
for (Integer key : new ArrayList<Integer>(mapExtPost.keySet())) {
for (Integer key : new ArrayList<>(mapExtPost.keySet())) {
Set<Integer> set = mapExtPost.get(key);
int oldsize = set.size();
@ -634,7 +634,7 @@ public class DomHelper {
if (setOldNodes.contains(key)) {
Set<Integer> setNew = mapExtPost.get(newid);
if (setNew == null) {
mapExtPost.put(newid, setNew = new HashSet<Integer>());
mapExtPost.put(newid, setNew = new HashSet<>());
}
setNew.addAll(set);

@ -76,7 +76,7 @@ public class EliminateLoopsHelper {
}
// collect relevant break edges
List<StatEdge> lstBreakEdges = new ArrayList<StatEdge>();
List<StatEdge> 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<Integer, Boolean> statLabeled = new HashMap<Integer, Boolean>();
List<Statement> lstEdgeClosures = new ArrayList<Statement>();
HashMap<Integer, Boolean> statLabeled = new HashMap<>();
List<Statement> 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<StatEdge> lst = new ArrayList<StatEdge>(loop.getLabelEdges());
List<StatEdge> lst = new ArrayList<>(loop.getLabelEdges());
for (StatEdge edge : lst) {
loop.removePredecessor(edge);
edge.getSource().changeEdgeNode(Statement.DIRECTION_FORWARD, edge, parentloop);

@ -61,7 +61,7 @@ public class ExitHelper {
set.remove(secondlast);
if (set.isEmpty()) {
last.setExprents(new ArrayList<Exprent>());
last.setExprents(new ArrayList<>());
found = true;
break;
}

@ -46,7 +46,7 @@ public class ExprProcessor implements CodeConstants {
public static final String UNKNOWN_TYPE_STRING = "<unknown>";
public static final String NULL_TYPE_STRING = "<null>";
private static final Map<Integer, Integer> mapConsts = new HashMap<Integer, Integer>();
private static final Map<Integer, Integer> 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<String> setFinallyShortRangeEntryPoints = new HashSet<String>();
Set<String> setFinallyShortRangeEntryPoints = new HashSet<>();
for (List<FinallyPathWrapper> lst : dgraph.mapShortRangeFinallyPaths.values()) {
for (FinallyPathWrapper finwrap : lst) {
setFinallyShortRangeEntryPoints.add(finwrap.entry);
}
}
Set<String> setFinallyLongRangeEntryPaths = new HashSet<String>();
Set<String> setFinallyLongRangeEntryPaths = new HashSet<>();
for (List<FinallyPathWrapper> lst : dgraph.mapLongRangeFinallyPaths.values()) {
for (FinallyPathWrapper finwrap : lst) {
setFinallyLongRangeEntryPaths.add(finwrap.source + "##" + finwrap.entry);
}
}
Map<String, VarExprent> mapCatch = new HashMap<String, VarExprent>();
Map<String, VarExprent> mapCatch = new HashMap<>();
collectCatchVars(root, flatthelper, mapCatch);
Map<DirectNode, Map<String, PrimitiveExprsList>> mapData = new HashMap<DirectNode, Map<String, PrimitiveExprsList>>();
Map<DirectNode, Map<String, PrimitiveExprsList>> mapData = new HashMap<>();
LinkedList<DirectNode> stack = new LinkedList<DirectNode>();
LinkedList<LinkedList<String>> stackEntryPoint = new LinkedList<LinkedList<String>>();
LinkedList<DirectNode> stack = new LinkedList<>();
LinkedList<LinkedList<String>> stackEntryPoint = new LinkedList<>();
stack.add(dgraph.first);
stackEntryPoint.add(new LinkedList<String>());
stackEntryPoint.add(new LinkedList<>());
Map<String, PrimitiveExprsList> map = new HashMap<String, PrimitiveExprsList>();
Map<String, PrimitiveExprsList> map = new HashMap<>();
map.put(null, new PrimitiveExprsList());
mapData.put(dgraph.first, map);
@ -187,10 +187,10 @@ public class ExprProcessor implements CodeConstants {
Map<String, PrimitiveExprsList> mapSucc = mapData.get(nd);
if (mapSucc == null) {
mapData.put(nd, mapSucc = new HashMap<String, PrimitiveExprsList>());
mapData.put(nd, mapSucc = new HashMap<>());
}
LinkedList<String> ndentrypoints = new LinkedList<String>(entrypoints);
LinkedList<String> 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<VarExprent> lst = new LinkedList<VarExprent>();
LinkedList<VarExprent> lst = new LinkedList<>();
for (int i = -1; i >= offset; i--) {
Exprent varex = stack.pop();

@ -46,8 +46,8 @@ import java.util.*;
import java.util.Map.Entry;
public class FinallyProcessor {
private final Map<Integer, Integer> finallyBlockIDs = new HashMap<Integer, Integer>();
private final Map<Integer, Integer> catchallBlockIDs = new HashMap<Integer, Integer>();
private final Map<Integer, Integer> finallyBlockIDs = new HashMap<>();
private final Map<Integer, Integer> 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<Statement> stack = new LinkedList<Statement>();
LinkedList<Statement> 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<BasicBlock, Boolean> mapLast = new HashMap<BasicBlock, Boolean>();
Map<BasicBlock, Boolean> 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<DirectNode> stack = new LinkedList<DirectNode>();
LinkedList<DirectNode> stack = new LinkedList<>();
stack.add(dgraph.first);
Set<DirectNode> setVisited = new HashSet<DirectNode>();
Set<DirectNode> setVisited = new HashSet<>();
while (!stack.isEmpty()) {
@ -374,7 +374,7 @@ public class FinallyProcessor {
Record information,
int bytecode_version) {
Set<BasicBlock> setCopy = new HashSet<BasicBlock>(setTry);
Set<BasicBlock> setCopy = new HashSet<>(setTry);
int finallytype = information.firstCode;
Map<BasicBlock, Boolean> mapLast = information.mapLast;
@ -464,7 +464,7 @@ public class FinallyProcessor {
setCopy.add(newhead);
setCopy.add(newheadinit);
for (BasicBlock hd : new HashSet<BasicBlock>(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<BasicBlock> lstTemp = new ArrayList<BasicBlock>();
List<BasicBlock> lstTemp = new ArrayList<>();
lstTemp.addAll(oldblock.getPreds());
lstTemp.addAll(oldblock.getPredExceptions());
@ -510,7 +510,7 @@ public class FinallyProcessor {
private static HashSet<BasicBlock> getAllBasicBlocks(Statement stat) {
List<Statement> lst = new LinkedList<Statement>();
List<Statement> lst = new LinkedList<>();
lst.add(stat);
int index = 0;
@ -527,7 +527,7 @@ public class FinallyProcessor {
}
while (index < lst.size());
HashSet<BasicBlock> res = new HashSet<BasicBlock>();
HashSet<BasicBlock> res = new HashSet<>();
for (Statement st : lst) {
res.add(((BasicBlockStatement)st).getBlock());
@ -569,7 +569,7 @@ public class FinallyProcessor {
}
// identify start blocks
HashSet<BasicBlock> startBlocks = new HashSet<BasicBlock>();
HashSet<BasicBlock> 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<Area> lstAreas = new ArrayList<Area>();
List<Area> lstAreas = new ArrayList<>();
for (BasicBlock start : startBlocks) {
@ -648,17 +648,17 @@ public class FinallyProcessor {
public BlockStackEntry(BasicBlock blockCatch, BasicBlock blockSample, List<int[]> lstStoreVars) {
this.blockCatch = blockCatch;
this.blockSample = blockSample;
this.lstStoreVars = new ArrayList<int[]>(lstStoreVars);
this.lstStoreVars = new ArrayList<>(lstStoreVars);
}
}
List<BlockStackEntry> stack = new LinkedList<BlockStackEntry>();
List<BlockStackEntry> stack = new LinkedList<>();
Set<BasicBlock> setSample = new HashSet<BasicBlock>();
Set<BasicBlock> setSample = new HashSet<>();
Map<String, BasicBlock[]> mapNext = new HashMap<String, BasicBlock[]>();
Map<String, BasicBlock[]> mapNext = new HashMap<>();
stack.add(new BlockStackEntry(startCatch, startSample, new ArrayList<int[]>()));
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<int[]>(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<BasicBlock> setSuccs = new HashSet<BasicBlock>(blockSample.getSuccs());
Set<BasicBlock> 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<BasicBlock[]>(mapNext.values())));
return new Area(startSample, setSample, getUniqueNext(graph, new HashSet<>(mapNext.values())));
}
private static BasicBlock getUniqueNext(ControlFlowGraph graph, Set<BasicBlock[]> setNext) {
@ -887,7 +887,7 @@ public class FinallyProcessor {
if (seqPattern.length() < seqSample.length()) { // split in two blocks
SimpleInstructionSequence seq = new SimpleInstructionSequence();
LinkedList<Integer> oldOffsets = new LinkedList<Integer>();
LinkedList<Integer> 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<BasicBlock> lstTemp = new ArrayList<BasicBlock>();
List<BasicBlock> 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<BasicBlock> setCommonExceptionHandlers = new HashSet<BasicBlock>(next.getSuccExceptions());
Set<BasicBlock> setCommonExceptionHandlers = new HashSet<>(next.getSuccExceptions());
for (BasicBlock pred : start.getPreds()) {
setCommonExceptionHandlers.retainAll(pred.getSuccExceptions());
}
boolean is_outside_range = false;
Set<BasicBlock> setPredecessors = new HashSet<BasicBlock>(start.getPreds());
Set<BasicBlock> 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<ExceptionRangeCFG> setRemovedExceptionRanges = new HashSet<ExceptionRangeCFG>();
Set<ExceptionRangeCFG> 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<BasicBlock>(block.getPreds())) {
for (BasicBlock pred : new ArrayList<>(block.getPreds())) {
if (!setBlocks.contains(pred)) {
pred.replaceSuccessor(block, succs);
}

@ -34,7 +34,7 @@ public class IfHelper {
public static boolean mergeAllIfs(RootStatement root) {
boolean res = mergeAllIfsRec(root, new HashSet<Integer>());
boolean res = mergeAllIfsRec(root, new HashSet<>());
if (res) {
SequenceHelper.condenseSequences(root);
@ -88,7 +88,7 @@ public class IfHelper {
boolean updated = false;
List<Statement> lst = new ArrayList<Statement>();
List<Statement> 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<Exprent> lstOperands = new ArrayList<Exprent>();
List<Exprent> 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<Exprent> lstOperands = new ArrayList<Exprent>();
List<Exprent> 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<Exprent> lstOperands = new ArrayList<Exprent>();
List<Exprent> 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<Statement> lst = new ArrayList<Statement>();
List<Statement> 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<Statement> lst = new ArrayList<Statement>();
List<Statement> 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<IfNode> succs = new ArrayList<IfNode>();
public final List<Integer> edgetypes = new ArrayList<Integer>();
public final List<IfNode> succs = new ArrayList<>();
public final List<Integer> edgetypes = new ArrayList<>();
public IfNode(Statement value) {
this.value = value;

@ -68,7 +68,7 @@ public class InlineSingleBlockHelper {
Statement parent = source.getParent();
source.removeSuccessor(edge);
List<Statement> lst = new ArrayList<Statement>();
List<Statement> lst = new ArrayList<>();
for (int i = seq.getStats().size() - 1; i >= index; i--) {
lst.add(0, seq.getStats().remove(i));
}

@ -33,7 +33,7 @@ public class LabelHelper {
liftClosures(root);
lowContinueLabels(root, new HashSet<StatEdge>());
lowContinueLabels(root, new HashSet<>());
lowClosures(root);
}
@ -63,7 +63,7 @@ public class LabelHelper {
if (dest.type != Statement.TYPE_DUMMYEXIT) {
Statement parent = dest.getParent();
List<Statement> lst = new ArrayList<Statement>();
List<Statement> 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<StatEdge>());
lowContinueLabels(st, new HashSet<>());
}
}
}
public static void lowClosures(Statement stat) {
for (StatEdge edge : new ArrayList<StatEdge>(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<Statement, List<StatEdge>> setExplicitEdges(Statement stat) {
HashMap<Statement, List<StatEdge>> mapEdges = new HashMap<Statement, List<StatEdge>>();
HashMap<Statement, List<StatEdge>> 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<StatEdge>(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<StatEdge>(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<StatEdge>(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<Statement>[] processStatementLabel(Statement stat) {
HashSet<Statement> setBreak = new HashSet<Statement>();
HashSet<Statement> setContinue = new HashSet<Statement>();
HashSet<Statement> setBreak = new HashSet<>();
HashSet<Statement> setContinue = new HashSet<>();
if (stat.getExprents() == null) {
for (Statement st : stat.getStats()) {

@ -189,7 +189,7 @@ public class LoopExtractHelper {
loop.addSuccessor(new StatEdge(StatEdge.TYPE_REGULAR, loop, target));
for (StatEdge edge : new ArrayList<StatEdge>(block.getLabelEdges())) {
for (StatEdge edge : new ArrayList<>(block.getLabelEdges())) {
if (edge.getType() == StatEdge.TYPE_CONTINUE || edge == ifedge) {
loop.addLabeledEdge(edge);
}

@ -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<Exprent>());
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<Exprent>());
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<Exprent>());
bstat.setExprents(new ArrayList<>());
dostat.replaceStatement(stat, bstat);
}
else {

@ -38,10 +38,10 @@ public class PPandMMHelper {
FlattenStatementsHelper flatthelper = new FlattenStatementsHelper();
DirectGraph dgraph = flatthelper.buildDirectGraph(root);
LinkedList<DirectNode> stack = new LinkedList<DirectNode>();
LinkedList<DirectNode> stack = new LinkedList<>();
stack.add(dgraph.first);
HashSet<DirectNode> setVisited = new HashSet<DirectNode>();
HashSet<DirectNode> setVisited = new HashSet<>();
boolean res = false;

@ -22,7 +22,7 @@ import java.util.List;
public class PrimitiveExprsList {
private final List<Exprent> lstExprents = new ArrayList<Exprent>();
private final List<Exprent> lstExprents = new ArrayList<>();
private ExprentStack stack = new ExprentStack();

@ -43,7 +43,7 @@ public class SecondaryFunctionsHelper {
FunctionExprent.FUNCTION_CADD
};
private static final HashMap<Integer, Integer[]> mapNumComparisons = new HashMap<Integer, Integer[]>();
private static final HashMap<Integer, Integer[]> mapNumComparisons = new HashMap<>();
static {
mapNumComparisons.put(FunctionExprent.FUNCTION_EQ,
@ -102,7 +102,7 @@ public class SecondaryFunctionsHelper {
while (replaced) {
replaced = false;
List<Object> lstObjects = new ArrayList<Object>(stat.getExprents() == null ? stat.getSequentialObjects() : stat.getExprents());
List<Object> 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<Exprent> lstBitNotOperand = new ArrayList<Exprent>();
List<Exprent> 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<Exprent> lstNotOperand = new ArrayList<Exprent>();
List<Exprent> lstNotOperand = new ArrayList<>();
lstNotOperand.add(lstOperands.get(1 - i));
return new FunctionExprent(FunctionExprent.FUNCTION_BOOL_NOT, lstNotOperand, fexpr.bytecode);
}

@ -39,7 +39,7 @@ public class SequenceHelper {
if (stat.type == Statement.TYPE_SEQUENCE) {
List<Statement> lst = new ArrayList<Statement>();
List<Statement> 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<StatEdge>(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<Exprent>());
bstat.setExprents(new ArrayList<>());
}
else {
bstat.setExprents(DecHelper.copyExprentList(stat.getExprents()));

@ -310,7 +310,7 @@ public class SimplifyExprentsHelper {
VarExprent arrvar = (VarExprent)as.getLeft();
HashMap<Integer, Exprent> mapInit = new HashMap<Integer, Exprent>();
HashMap<Integer, Exprent> 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<Exprent> lstRet = new ArrayList<Exprent>();
List<Exprent> lstRet = new ArrayList<>();
VarType arrtype = newex.getNewType().decreaseArrayDim();
@ -813,7 +813,7 @@ public class SimplifyExprentsHelper {
}
if (found) {
List<Exprent> data = new ArrayList<Exprent>();
List<Exprent> 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<Exprent> data = new ArrayList<Exprent>();
List<Exprent> 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<Exprent> data = new ArrayList<Exprent>();
List<Exprent> data = new ArrayList<>();
data.addAll(stat.getFirst().getExprents());
stat.setExprents(data);

@ -39,7 +39,7 @@ public class StackVarsProcessor {
public void simplifyStackVars(RootStatement root, StructMethod mt, StructClass cl) {
HashSet<Integer> setReorderedIfs = new HashSet<Integer>();
HashSet<Integer> setReorderedIfs = new HashSet<>();
SSAUConstructorSparseEx ssau = null;
@ -149,12 +149,12 @@ public class StackVarsProcessor {
boolean res = false;
HashSet<DirectNode> setVisited = new HashSet<DirectNode>();
LinkedList<DirectNode> stack = new LinkedList<DirectNode>();
LinkedList<HashMap<VarVersionPair, Exprent>> stackMaps = new LinkedList<HashMap<VarVersionPair, Exprent>>();
HashSet<DirectNode> setVisited = new HashSet<>();
LinkedList<DirectNode> stack = new LinkedList<>();
LinkedList<HashMap<VarVersionPair, Exprent>> stackMaps = new LinkedList<>();
stack.add(dgraph.first);
stackMaps.add(new HashMap<VarVersionPair, Exprent>());
stackMaps.add(new HashMap<>());
while (!stack.isEmpty()) {
@ -166,7 +166,7 @@ public class StackVarsProcessor {
}
setVisited.add(nd);
List<List<Exprent>> lstLists = new ArrayList<List<Exprent>>();
List<List<Exprent>> 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<VarVersionPair, Exprent>(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<VarVersionNode> usedVers = new ArrayList<VarVersionNode>();
List<VarVersionNode> usedVers = new ArrayList<>();
boolean notdom = getUsedVersions(ssau, leftpaar, usedVers);
if (!notdom && usedVers.isEmpty()) {
@ -395,7 +395,7 @@ public class StackVarsProcessor {
boolean verreplaced = false;
HashSet<VarVersionPair> setTempUsedVers = new HashSet<VarVersionPair>();
HashSet<VarVersionPair> 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<VarVersionPair> getAllVersions(Exprent exprent) {
HashSet<VarVersionPair> res = new HashSet<VarVersionPair>();
HashSet<VarVersionPair> res = new HashSet<>();
List<Exprent> listTemp = new ArrayList<Exprent>(exprent.getAllExprents(true));
List<Exprent> 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<VarVersionNode> usedVers = new ArrayList<VarVersionNode>();
List<VarVersionNode> usedVers = new ArrayList<>();
boolean notdom = getUsedVersions(ssau, leftpaar, usedVers);
if (!notdom && usedVers.isEmpty()) {
@ -557,7 +557,7 @@ public class StackVarsProcessor {
boolean vernotreplaced = false;
HashSet<VarVersionPair> setTempUsedVers = new HashSet<VarVersionPair>();
HashSet<VarVersionPair> 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<VarVersionNode> setVisited = new HashSet<VarVersionNode>();
HashSet<VarVersionNode> setVisited = new HashSet<>();
HashSet<VarVersionNode> setNotDoms = new HashSet<VarVersionNode>();
HashSet<VarVersionNode> setNotDoms = new HashSet<>();
LinkedList<VarVersionNode> stack = new LinkedList<VarVersionNode>();
LinkedList<VarVersionNode> stack = new LinkedList<>();
stack.add(varnode);
while (!stack.isEmpty()) {
@ -663,7 +663,7 @@ public class StackVarsProcessor {
return false;
}
HashSet<VarVersionNode> domset = new HashSet<VarVersionNode>();
HashSet<VarVersionNode> 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<Integer, HashSet<VarVersionPair>> map = new HashMap<Integer, HashSet<VarVersionPair>>();
HashMap<Integer, HashSet<VarVersionPair>> map = new HashMap<>();
SFormsFastMapDirect mapLiveVars = ssau.getLiveVarVersionsMap(leftvar);
List<Exprent> 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<VarVersionPair> verset = new HashSet<VarVersionPair>();
HashSet<VarVersionPair> 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<VarVersionPair> verset = new HashSet<VarVersionPair>();
HashSet<VarVersionPair> verset = new HashSet<>();
for (Integer vers : mapLiveVars.get(varindex)) {
verset.add(new VarVersionPair(varindex, vers.intValue()));
}

@ -66,7 +66,7 @@ public class StatEdge {
public StatEdge(Statement source, Statement destination, List<String> exceptions) {
this(TYPE_EXCEPTION, source, destination);
if (exceptions != null) {
this.exceptions = new ArrayList<String>(exceptions);
this.exceptions = new ArrayList<>(exceptions);
}
}

@ -92,8 +92,8 @@ public class StrongConnectivityHelper {
public List<List<Statement>> findComponents(Statement stat) {
components = new ArrayList<List<Statement>>();
setProcessed = new HashSet<Statement>();
components = new ArrayList<>();
setProcessed = new HashSet<>();
visitTree(stat.getFirst());
@ -115,7 +115,7 @@ public class StrongConnectivityHelper {
public static boolean isExitComponent(List<Statement> lst) {
HashSet<Statement> set = new HashSet<Statement>();
HashSet<Statement> 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<Statement> getExitReps(List<List<Statement>> lst) {
List<Statement> res = new ArrayList<Statement>();
List<Statement> res = new ArrayList<>();
for (List<Statement> comp : lst) {
if (isExitComponent(comp)) {
@ -142,11 +142,11 @@ public class StrongConnectivityHelper {
// *****************************************************************************
private void visitTree(Statement stat) {
lstack = new ListStack<Statement>();
lstack = new ListStack<>();
ncounter = 0;
tset = new HashSet<Statement>();
dfsnummap = new HashMap<Statement, Integer>();
lowmap = new HashMap<Statement, Integer>();
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<Statement> lst = new ArrayList<Statement>();
List<Statement> lst = new ArrayList<>();
Statement v;
do {
v = lstack.pop();

@ -25,7 +25,7 @@ public class DominatorEngine {
private final Statement statement;
private final VBStyleCollection<Integer, Integer> colOrderedIDoms = new VBStyleCollection<Integer, Integer>();
private final VBStyleCollection<Integer, Integer> colOrderedIDoms = new VBStyleCollection<>();
public DominatorEngine(Statement statement) {

@ -27,16 +27,16 @@ public class DominatorTreeExceptionFilter {
private final Statement statement;
// idom, nodes
private final Map<Integer, Set<Integer>> mapTreeBranches = new HashMap<Integer, Set<Integer>>();
private final Map<Integer, Set<Integer>> mapTreeBranches = new HashMap<>();
// handler, range nodes
private final Map<Integer, Set<Integer>> mapExceptionRanges = new HashMap<Integer, Set<Integer>>();
private final Map<Integer, Set<Integer>> mapExceptionRanges = new HashMap<>();
// handler, head dom
private Map<Integer, Integer> mapExceptionDoms = new HashMap<Integer, Integer>();
private Map<Integer, Integer> mapExceptionDoms = new HashMap<>();
// statement, handler, exit nodes
private final Map<Integer, Map<Integer, Integer>> mapExceptionRangeUniqueExit = new HashMap<Integer, Map<Integer, Integer>>();
private final Map<Integer, Map<Integer, Integer>> mapExceptionRangeUniqueExit = new HashMap<>();
private DominatorEngine domEngine;
@ -86,7 +86,7 @@ public class DominatorTreeExceptionFilter {
Set<Integer> set = mapTreeBranches.get(idom);
if (set == null) {
mapTreeBranches.put(idom, set = new HashSet<Integer>());
mapTreeBranches.put(idom, set = new HashSet<>());
}
set.add(key);
}
@ -101,7 +101,7 @@ public class DominatorTreeExceptionFilter {
List<Statement> lstPreds = stat.getNeighbours(StatEdge.TYPE_EXCEPTION, Statement.DIRECTION_BACKWARD);
if (!lstPreds.isEmpty()) {
Set<Integer> set = new HashSet<Integer>();
Set<Integer> set = new HashSet<>();
for (Statement st : lstPreds) {
set.add(st.id);
@ -116,7 +116,7 @@ public class DominatorTreeExceptionFilter {
private Map<Integer, Integer> buildExceptionDoms(Integer id) {
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
Map<Integer, Integer> map = new HashMap<>();
Set<Integer> children = mapTreeBranches.get(id);
if (children != null) {
@ -140,7 +140,7 @@ public class DominatorTreeExceptionFilter {
private void buildFilter(Integer id) {
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
Map<Integer, Integer> map = new HashMap<>();
Set<Integer> children = mapTreeBranches.get(id);
if (children != null) {

@ -28,9 +28,9 @@ public class FastExtendedPostdominanceHelper {
private List<Statement> lstReversePostOrderList;
private HashMap<Integer, FastFixedSet<Integer>> mapSupportPoints = new HashMap<Integer, FastFixedSet<Integer>>();
private HashMap<Integer, FastFixedSet<Integer>> mapSupportPoints = new HashMap<>();
private final HashMap<Integer, FastFixedSet<Integer>> mapExtPostdominators = new HashMap<Integer, FastFixedSet<Integer>>();
private final HashMap<Integer, FastFixedSet<Integer>> mapExtPostdominators = new HashMap<>();
private Statement statement;
@ -40,11 +40,11 @@ public class FastExtendedPostdominanceHelper {
this.statement = statement;
HashSet<Integer> set = new HashSet<Integer>();
HashSet<Integer> set = new HashSet<>();
for (Statement st : statement.getStats()) {
set.add(st.id);
}
this.factory = new FastFixedSetFactory<Integer>(set);
this.factory = new FastFixedSetFactory<>(set);
lstReversePostOrderList = statement.getReversePostOrderList();
@ -65,7 +65,7 @@ public class FastExtendedPostdominanceHelper {
filterOnDominance(filter);
HashMap<Integer, Set<Integer>> res = new HashMap<Integer, Set<Integer>>();
HashMap<Integer, Set<Integer>> res = new HashMap<>();
for (Entry<Integer, FastFixedSet<Integer>> 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<Integer>(mapExtPostdominators.keySet())) {
for (Integer head : new HashSet<>(mapExtPostdominators.keySet())) {
FastFixedSet<Integer> setPostdoms = mapExtPostdominators.get(head);
LinkedList<Statement> stack = new LinkedList<Statement>();
LinkedList<FastFixedSet<Integer>> stackPath = new LinkedList<FastFixedSet<Integer>>();
LinkedList<Statement> stack = new LinkedList<>();
LinkedList<FastFixedSet<Integer>> stackPath = new LinkedList<>();
stack.add(statement.getStats().getWithKey(head));
stackPath.add(factory.spawnEmptySet());
Set<Statement> setVisited = new HashSet<Statement>();
Set<Statement> setVisited = new HashSet<>();
setVisited.add(stack.getFirst());
@ -134,7 +134,7 @@ public class FastExtendedPostdominanceHelper {
private void filterOnExceptionRanges(DominatorTreeExceptionFilter filter) {
for (Integer head : new HashSet<Integer>(mapExtPostdominators.keySet())) {
for (Integer head : new HashSet<>(mapExtPostdominators.keySet())) {
FastFixedSet<Integer> set = mapExtPostdominators.get(head);
for (Iterator<Integer> it = set.iterator(); it.hasNext(); ) {
@ -151,7 +151,7 @@ public class FastExtendedPostdominanceHelper {
private void removeErroneousNodes() {
mapSupportPoints = new HashMap<Integer, FastFixedSet<Integer>>();
mapSupportPoints = new HashMap<>();
calcReachabilitySuppPoints(StatEdge.TYPE_REGULAR);
@ -161,7 +161,7 @@ public class FastExtendedPostdominanceHelper {
Integer nodeid = node.id;
FastFixedSet<Integer> setReachability = mapSets.get(nodeid);
List<FastFixedSet<Integer>> lstPredSets = new ArrayList<FastFixedSet<Integer>>();
List<FastFixedSet<Integer>> lstPredSets = new ArrayList<>();
for (StatEdge prededge : node.getPredecessorEdges(StatEdge.TYPE_REGULAR)) {
FastFixedSet<Integer> setPred = mapSets.get(prededge.getSource().id);
@ -285,7 +285,7 @@ public class FastExtendedPostdominanceHelper {
boolean iterate = false;
HashMap<Integer, FastFixedSet<Integer>> mapSets = new HashMap<Integer, FastFixedSet<Integer>>();
HashMap<Integer, FastFixedSet<Integer>> mapSets = new HashMap<>();
for (Statement stat : lstReversePostOrderList) {

@ -24,7 +24,7 @@ public class GenericDominatorEngine {
private final IGraph graph;
private final VBStyleCollection<IGraphNode, IGraphNode> colOrderedIDoms = new VBStyleCollection<IGraphNode, IGraphNode>();
private final VBStyleCollection<IGraphNode, IGraphNode> colOrderedIDoms = new VBStyleCollection<>();
private Set<? extends IGraphNode> setRoots;

@ -48,7 +48,7 @@ public class ExceptionDeobfuscator {
public static void restorePopRanges(ControlFlowGraph graph) {
List<Range> lstRanges = new ArrayList<Range>();
List<Range> 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<BasicBlock>(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<BasicBlock> setrange = new HashSet<BasicBlock>(range.protectedRange);
Set<BasicBlock> setrange = new HashSet<>(range.protectedRange);
for (Range range_super : lstRanges) { // finally or strict superset
if (range != range_super) {
Set<BasicBlock> setrange_super = new HashSet<BasicBlock>(range_super.protectedRange);
Set<BasicBlock> 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<BasicBlock> lstTemp = new ArrayList<BasicBlock>();
List<BasicBlock> 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<BasicBlock> setVisited = new HashSet<BasicBlock>();
Set<BasicBlock> 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<BasicBlock> lstTemp = new ArrayList<BasicBlock>();
List<BasicBlock> lstTemp = new ArrayList<>();
// only exception predecessors considered
lstTemp.addAll(handler.getPredExceptions());
@ -231,7 +231,7 @@ public class ExceptionDeobfuscator {
}
public Set<? extends IGraphNode> getRoots() {
return new HashSet<IGraphNode>(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<BasicBlock> getReachableBlocksRestricted(ExceptionRangeCFG range, GenericDominatorEngine engine) {
List<BasicBlock> lstRes = new ArrayList<BasicBlock>();
List<BasicBlock> lstRes = new ArrayList<>();
LinkedList<BasicBlock> stack = new LinkedList<BasicBlock>();
Set<BasicBlock> setVisited = new HashSet<BasicBlock>();
LinkedList<BasicBlock> stack = new LinkedList<>();
Set<BasicBlock> 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<BasicBlock> lstSuccs = new ArrayList<BasicBlock>(block.getSuccs());
List<BasicBlock> 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<BasicBlock, Set<BasicBlock>> mapRanges = new HashMap<BasicBlock, Set<BasicBlock>>();
Map<BasicBlock, Set<BasicBlock>> mapRanges = new HashMap<>();
for (ExceptionRangeCFG range : graph.getExceptions()) {
Set<BasicBlock> set = mapRanges.get(range.getHandler());
if (set == null) {
mapRanges.put(range.getHandler(), set = new HashSet<BasicBlock>());
mapRanges.put(range.getHandler(), set = new HashSet<>());
}
set.addAll(range.getProtectedRange());
}
for (Entry<BasicBlock, Set<BasicBlock>> ent : mapRanges.entrySet()) {
Set<BasicBlock> setEntries = new HashSet<BasicBlock>();
Set<BasicBlock> setEntries = new HashSet<>();
for (BasicBlock block : ent.getValue()) {
Set<BasicBlock> setTemp = new HashSet<BasicBlock>(block.getPreds());
Set<BasicBlock> setTemp = new HashSet<>(block.getPreds());
setTemp.removeAll(ent.getValue());
if (!setTemp.isEmpty()) {

@ -31,15 +31,15 @@ public class IrreducibleCFGDeobfuscator {
class Node {
public Integer id;
public final Set<Node> preds = new HashSet<Node>();
public final Set<Node> succs = new HashSet<Node>();
public final Set<Node> preds = new HashSet<>();
public final Set<Node> succs = new HashSet<>();
public Node(Integer id) {
this.id = id;
}
}
HashMap<Integer, Node> mapNodes = new HashMap<Integer, Node>();
HashMap<Integer, Node> 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, Statement>());
Statement splitcopy = copyStatement(splitnode, null, new HashMap<>());
initCopiedStatement(splitcopy);
// insert the copy

@ -68,7 +68,7 @@ public class ArrayExprent extends Exprent {
}
public List<Exprent> getAllExprents() {
List<Exprent> lst = new ArrayList<Exprent>();
List<Exprent> lst = new ArrayList<>();
lst.add(array);
lst.add(index);
return lst;

@ -87,7 +87,7 @@ public class AssignmentExprent extends Exprent {
@Override
public List<Exprent> getAllExprents() {
List<Exprent> lst = new ArrayList<Exprent>();
List<Exprent> lst = new ArrayList<>();
lst.add(left);
lst.add(right);
return lst;

@ -110,7 +110,7 @@ public class ConstExprent extends Exprent {
}
public List<Exprent> getAllExprents() {
return new ArrayList<Exprent>();
return new ArrayList<>();
}
@Override

@ -70,7 +70,7 @@ public class ExitExprent extends Exprent {
@Override
public List<Exprent> getAllExprents() {
List<Exprent> lst = new ArrayList<Exprent>();
List<Exprent> lst = new ArrayList<>();
if (value != null) {
lst.add(value);
}

@ -76,7 +76,7 @@ public class Exprent implements IMatchable {
}
public boolean containsExprent(Exprent exprent) {
List<Exprent> listTemp = new ArrayList<Exprent>(getAllExprents(true));
List<Exprent> listTemp = new ArrayList<>(getAllExprents(true));
listTemp.add(this);
for (Exprent lstExpr : listTemp) {
@ -102,7 +102,7 @@ public class Exprent implements IMatchable {
List<Exprent> lstAllExprents = getAllExprents(true);
lstAllExprents.add(this);
Set<VarVersionPair> set = new HashSet<VarVersionPair>();
Set<VarVersionPair> 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<Integer> bytecodeOffsets) {
if (bytecodeOffsets != null && !bytecodeOffsets.isEmpty()) {
if (bytecode == null) {
bytecode = new HashSet<Integer>(bytecodeOffsets);
bytecode = new HashSet<>(bytecodeOffsets);
}
else {
bytecode.addAll(bytecodeOffsets);

@ -71,7 +71,7 @@ public class FieldExprent extends Exprent {
@Override
public List<Exprent> getAllExprents() {
List<Exprent> lst = new ArrayList<Exprent>();
List<Exprent> lst = new ArrayList<>();
if (instance != null) {
lst.add(instance);
}

@ -191,7 +191,7 @@ public class FunctionExprent extends Exprent {
3 // FUNCTION_STR_CONCAT = 49;
};
private static final Set<Integer> ASSOCIATIVITY = new HashSet<Integer>(Arrays.asList(
private static final Set<Integer> 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<Exprent> lstOperands;
public FunctionExprent(int funcType, ListStack<Exprent> stack, Set<Integer> bytecodeOffsets) {
this(funcType, new ArrayList<Exprent>(), 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<Integer> bytecodeOffsets) {
this(funcType, new ArrayList<Exprent>(1), bytecodeOffsets);
this(funcType, new ArrayList<>(1), bytecodeOffsets);
lstOperands.add(operand);
}
@ -413,14 +413,14 @@ public class FunctionExprent extends Exprent {
@Override
public List<Exprent> getAllExprents() {
List<Exprent> lst = new ArrayList<Exprent>();
List<Exprent> lst = new ArrayList<>();
lst.addAll(lstOperands);
return lst;
}
@Override
public Exprent copy() {
List<Exprent> lst = new ArrayList<Exprent>();
List<Exprent> lst = new ArrayList<>();
for (Exprent expr : lstOperands) {
lst.add(expr.copy());
}

@ -107,7 +107,7 @@ public class IfExprent extends Exprent {
@Override
public List<Exprent> getAllExprents() {
List<Exprent> lst = new ArrayList<Exprent>();
List<Exprent> lst = new ArrayList<>();
lst.add(condition);
return lst;
}

@ -65,7 +65,7 @@ public class InvocationExprent extends Exprent {
private String stringDescriptor;
private String invokeDynamicClassSuffix;
private int invocationTyp = INVOKE_VIRTUAL;
private List<Exprent> lstParameters = new ArrayList<Exprent>();
private List<Exprent> lstParameters = new ArrayList<>();
private List<PooledConstant> bootstrapArguments;
public InvocationExprent() {
@ -162,7 +162,7 @@ public class InvocationExprent extends Exprent {
invokeDynamicClassSuffix = expr.getInvokeDynamicClassSuffix();
stringDescriptor = expr.getStringDescriptor();
descriptor = expr.getDescriptor();
lstParameters = new ArrayList<Exprent>(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<Exprent> getAllExprents() {
List<Exprent> lst = new ArrayList<Exprent>();
List<Exprent> 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<VarVersionPair>(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<MethodDescriptor> matches = new ArrayList<MethodDescriptor>();
List<MethodDescriptor> matches = new ArrayList<>();
nextMethod:
for (StructMethod mt : cl.getMethods()) {
if (name.equals(mt.getName())) {

@ -46,7 +46,7 @@ public class MonitorExprent extends Exprent {
@Override
public List<Exprent> getAllExprents() {
List<Exprent> lst = new ArrayList<Exprent>();
List<Exprent> lst = new ArrayList<>();
lst.add(value);
return lst;
}

@ -38,8 +38,8 @@ import java.util.Set;
public class NewExprent extends Exprent {
private InvocationExprent constructor;
private final VarType newType;
private List<Exprent> lstDims = new ArrayList<Exprent>();
private List<Exprent> lstArrayElements = new ArrayList<Exprent>();
private List<Exprent> lstDims = new ArrayList<>();
private List<Exprent> lstArrayElements = new ArrayList<>();
private boolean directArrayInit;
private boolean anonymous;
private boolean lambda;
@ -70,7 +70,7 @@ public class NewExprent extends Exprent {
}
private static List<Exprent> getDimensions(int arrayDim, ListStack<Exprent> stack) {
List<Exprent> lstDims = new ArrayList<Exprent>();
List<Exprent> 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<Exprent> getAllExprents() {
List<Exprent> lst = new ArrayList<Exprent>();
List<Exprent> 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<Exprent> lst = new ArrayList<Exprent>();
List<Exprent> 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<VarVersionPair>(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<VarVersionPair>(Collections.nCopies(lstParameters.size(), (VarVersionPair)null));
sigFields = new ArrayList<>(Collections.nCopies(lstParameters.size(), (VarVersionPair)null));
sigFields.set(0, new VarVersionPair(-1, 0));
}
}

@ -28,7 +28,7 @@ import java.util.Set;
public class SwitchExprent extends Exprent {
private Exprent value;
private List<List<ConstExprent>> caseValues = new ArrayList<List<ConstExprent>>();
private List<List<ConstExprent>> caseValues = new ArrayList<>();
public SwitchExprent(Exprent value, Set<Integer> bytecodeOffsets) {
super(EXPRENT_SWITCH);
@ -41,9 +41,9 @@ public class SwitchExprent extends Exprent {
public Exprent copy() {
SwitchExprent swExpr = new SwitchExprent(value.copy(), bytecode);
List<List<ConstExprent>> lstCaseValues = new ArrayList<List<ConstExprent>>();
List<List<ConstExprent>> lstCaseValues = new ArrayList<>();
for (List<ConstExprent> lst : caseValues) {
lstCaseValues.add(new ArrayList<ConstExprent>(lst));
lstCaseValues.add(new ArrayList<>(lst));
}
swExpr.setCaseValues(lstCaseValues);
@ -80,7 +80,7 @@ public class SwitchExprent extends Exprent {
@Override
public List<Exprent> getAllExprents() {
List<Exprent> lst = new ArrayList<Exprent>();
List<Exprent> lst = new ArrayList<>();
lst.add(value);
return lst;
}

@ -67,7 +67,7 @@ public class VarExprent extends Exprent {
@Override
public List<Exprent> getAllExprents() {
return new ArrayList<Exprent>();
return new ArrayList<>();
}
@Override

@ -27,24 +27,24 @@ import java.util.List;
public class DirectGraph {
public final VBStyleCollection<DirectNode, String> nodes = new VBStyleCollection<DirectNode, String>();
public final VBStyleCollection<DirectNode, String> nodes = new VBStyleCollection<>();
public DirectNode first;
// exit, [source, destination]
public final HashMap<String, List<FinallyPathWrapper>> mapShortRangeFinallyPaths = new HashMap<String, List<FinallyPathWrapper>>();
public final HashMap<String, List<FinallyPathWrapper>> mapShortRangeFinallyPaths = new HashMap<>();
// exit, [source, destination]
public final HashMap<String, List<FinallyPathWrapper>> mapLongRangeFinallyPaths = new HashMap<String, List<FinallyPathWrapper>>();
public final HashMap<String, List<FinallyPathWrapper>> mapLongRangeFinallyPaths = new HashMap<>();
// negative if branches (recorded for handling of && and ||)
public final HashMap<String, String> mapNegIfBranch = new HashMap<String, String>();
public final HashMap<String, String> mapNegIfBranch = new HashMap<>();
// nodes, that are exception exits of a finally block with monitor variable
public final HashMap<String, String> mapFinallyMonitorExceptionPathExits = new HashMap<String, String>();
public final HashMap<String, String> mapFinallyMonitorExceptionPathExits = new HashMap<>();
public void sortReversePostOrder() {
LinkedList<DirectNode> res = new LinkedList<DirectNode>();
LinkedList<DirectNode> res = new LinkedList<>();
addToReversePostOrderListIterative(first, res);
nodes.clear();
@ -55,10 +55,10 @@ public class DirectGraph {
private static void addToReversePostOrderListIterative(DirectNode root, List<DirectNode> lst) {
LinkedList<DirectNode> stackNode = new LinkedList<DirectNode>();
LinkedList<Integer> stackIndex = new LinkedList<Integer>();
LinkedList<DirectNode> stackNode = new LinkedList<>();
LinkedList<Integer> stackIndex = new LinkedList<>();
HashSet<DirectNode> setVisited = new HashSet<DirectNode>();
HashSet<DirectNode> setVisited = new HashSet<>();
stackNode.add(root);
stackIndex.add(0);
@ -94,10 +94,10 @@ public class DirectGraph {
public boolean iterateExprents(ExprentIterator iter) {
LinkedList<DirectNode> stack = new LinkedList<DirectNode>();
LinkedList<DirectNode> stack = new LinkedList<>();
stack.add(first);
HashSet<DirectNode> setVisited = new HashSet<DirectNode>();
HashSet<DirectNode> setVisited = new HashSet<>();
while (!stack.isEmpty()) {

@ -40,11 +40,11 @@ public class DirectNode {
public final Statement statement;
public List<Exprent> exprents = new ArrayList<Exprent>();
public List<Exprent> exprents = new ArrayList<>();
public final List<DirectNode> succs = new ArrayList<DirectNode>();
public final List<DirectNode> succs = new ArrayList<>();
public final List<DirectNode> preds = new ArrayList<DirectNode>();
public final List<DirectNode> preds = new ArrayList<>();
public DirectNode(int type, Statement statement, String id) {
this.type = type;

@ -26,19 +26,19 @@ import java.util.Map.Entry;
public class FlattenStatementsHelper {
// statement.id, node.id(direct), node.id(continue)
private final Map<Integer, String[]> mapDestinationNodes = new HashMap<Integer, String[]>();
private final Map<Integer, String[]> mapDestinationNodes = new HashMap<>();
// node.id(source), statement.id(destination), edge type
private final List<Edge> listEdges = new ArrayList<Edge>();
private final List<Edge> listEdges = new ArrayList<>();
// node.id(exit), [node.id(source), statement.id(destination)]
private final Map<String, List<String[]>> mapShortRangeFinallyPathIds = new HashMap<String, List<String[]>>();
private final Map<String, List<String[]>> mapShortRangeFinallyPathIds = new HashMap<>();
// node.id(exit), [node.id(source), statement.id(destination)]
private final Map<String, List<String[]>> mapLongRangeFinallyPathIds = new HashMap<String, List<String[]>>();
private final Map<String, List<String[]>> mapLongRangeFinallyPathIds = new HashMap<>();
// positive if branches
private final Map<String, Integer> mapPosIfBranch = new HashMap<String, Integer>();
private final Map<String, Integer> 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<Exprent>();
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<StatementStackEntry> lstStackStatements = new LinkedList<StatementStackEntry>();
LinkedList<StatementStackEntry> lstStackStatements = new LinkedList<>();
lstStackStatements.add(new StatementStackEntry(root, new LinkedList<StackEntry>(), null));
lstStackStatements.add(new StatementStackEntry(root, new LinkedList<>(), null));
mainloop:
while (!lstStackStatements.isEmpty()) {
@ -100,7 +100,7 @@ public class FlattenStatementsHelper {
DirectNode node, nd;
List<StatEdge> lstSuccEdges = new ArrayList<StatEdge>();
List<StatEdge> 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<StatementStackEntry> lst = new LinkedList<StatementStackEntry>();
LinkedList<StatementStackEntry> lst = new LinkedList<>();
for (Statement st : stat.getStats()) {
listEdges.add(new Edge(firstnd.id, st.id, StatEdge.TYPE_REGULAR));
LinkedList<StackEntry> stack = stackFinally;
if (stat.type == Statement.TYPE_CATCHALL && ((CatchAllStatement)stat).isFinally()) {
stack = new LinkedList<StackEntry>(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<StackEntry> stack = new LinkedList<StackEntry>(stackFinally);
LinkedList<StackEntry> stack = new LinkedList<>(stackFinally);
int edgetype = edge.getType();
Statement destination = edge.getDestination();
@ -417,14 +417,14 @@ public class FlattenStatementsHelper {
List<String[]> lst = mapShortRangeFinallyPathIds.get(sourcenode.id);
if (lst == null) {
mapShortRangeFinallyPathIds.put(sourcenode.id, lst = new ArrayList<String[]>());
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<String[]>());
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<String, List<String[]>> ent : (i == 0 ? mapShortRangeFinallyPathIds : mapLongRangeFinallyPathIds).entrySet()) {
List<FinallyPathWrapper> newLst = new ArrayList<FinallyPathWrapper>();
List<FinallyPathWrapper> newLst = new ArrayList<>();
List<String[]> 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<FinallyPathWrapper>(
new HashSet<FinallyPathWrapper>(newLst)));
new ArrayList<>(
new HashSet<>(newLst)));
}
}
}

@ -42,24 +42,24 @@ import java.util.Map.Entry;
public class SSAConstructorSparseEx {
// node id, var, version
private final HashMap<String, SFormsFastMapDirect> inVarVersions = new HashMap<String, SFormsFastMapDirect>();
private final HashMap<String, SFormsFastMapDirect> inVarVersions = new HashMap<>();
// node id, var, version (direct branch)
private final HashMap<String, SFormsFastMapDirect> outVarVersions = new HashMap<String, SFormsFastMapDirect>();
private final HashMap<String, SFormsFastMapDirect> outVarVersions = new HashMap<>();
// node id, var, version (negative branch)
private final HashMap<String, SFormsFastMapDirect> outNegVarVersions = new HashMap<String, SFormsFastMapDirect>();
private final HashMap<String, SFormsFastMapDirect> outNegVarVersions = new HashMap<>();
// node id, var, version
private final HashMap<String, SFormsFastMapDirect> extraVarVersions = new HashMap<String, SFormsFastMapDirect>();
private final HashMap<String, SFormsFastMapDirect> extraVarVersions = new HashMap<>();
// (var, version), version
private final HashMap<VarVersionPair, FastSparseSet<Integer>> phi = new HashMap<VarVersionPair, FastSparseSet<Integer>>();
private final HashMap<VarVersionPair, FastSparseSet<Integer>> phi = new HashMap<>();
// var, version
private final HashMap<Integer, Integer> lastversion = new HashMap<Integer, Integer>();
private final HashMap<Integer, Integer> lastversion = new HashMap<>();
private final List<VarVersionPair> startVars = new ArrayList<VarVersionPair>();
private final List<VarVersionPair> startVars = new ArrayList<>();
// set factory
private FastSparseSetFactory<Integer> factory;
@ -73,18 +73,18 @@ public class SSAConstructorSparseEx {
// DotExporter.toDotFile(dgraph, new File("c:\\Temp\\gr12_my.dot"));
// } catch(Exception ex) {ex.printStackTrace();}
HashSet<Integer> setInit = new HashSet<Integer>();
HashSet<Integer> setInit = new HashSet<>();
for (int i = 0; i < 64; i++) {
setInit.add(i);
}
factory = new FastSparseSetFactory<Integer>(setInit);
factory = new FastSparseSetFactory<>(setInit);
SFormsFastMapDirect firstmap = createFirstMap(mt);
extraVarVersions.put(dgraph.first.id, firstmap);
setCatchMaps(root, dgraph, flatthelper);
HashSet<String> updated = new HashSet<String>();
HashSet<String> 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<String> setLongPathWrapper = new HashSet<String>();
HashSet<String> setLongPathWrapper = new HashSet<>();
for (FinallyPathWrapper finwraplong : dgraph.mapLongRangeFinallyPaths.get(predid)) {
setLongPathWrapper.add(finwraplong.destination + "##" + finwraplong.source);
}

@ -40,42 +40,42 @@ import java.util.Map.Entry;
public class SSAUConstructorSparseEx {
// node id, var, version
private final HashMap<String, SFormsFastMapDirect> inVarVersions = new HashMap<String, SFormsFastMapDirect>();
private final HashMap<String, SFormsFastMapDirect> inVarVersions = new HashMap<>();
//private HashMap<String, HashMap<Integer, FastSet<Integer>>> inVarVersions = new HashMap<String, HashMap<Integer, FastSet<Integer>>>();
// node id, var, version (direct branch)
private final HashMap<String, SFormsFastMapDirect> outVarVersions = new HashMap<String, SFormsFastMapDirect>();
private final HashMap<String, SFormsFastMapDirect> outVarVersions = new HashMap<>();
//private HashMap<String, HashMap<Integer, FastSet<Integer>>> outVarVersions = new HashMap<String, HashMap<Integer, FastSet<Integer>>>();
// node id, var, version (negative branch)
private final HashMap<String, SFormsFastMapDirect> outNegVarVersions = new HashMap<String, SFormsFastMapDirect>();
private final HashMap<String, SFormsFastMapDirect> outNegVarVersions = new HashMap<>();
//private HashMap<String, HashMap<Integer, FastSet<Integer>>> outNegVarVersions = new HashMap<String, HashMap<Integer, FastSet<Integer>>>();
// node id, var, version
private final HashMap<String, SFormsFastMapDirect> extraVarVersions = new HashMap<String, SFormsFastMapDirect>();
private final HashMap<String, SFormsFastMapDirect> extraVarVersions = new HashMap<>();
//private HashMap<String, HashMap<Integer, FastSet<Integer>>> extraVarVersions = new HashMap<String, HashMap<Integer, FastSet<Integer>>>();
// (var, version), version
private final HashMap<VarVersionPair, HashSet<Integer>> phi = new HashMap<VarVersionPair, HashSet<Integer>>();
private final HashMap<VarVersionPair, HashSet<Integer>> phi = new HashMap<>();
// var, version
private final HashMap<Integer, Integer> lastversion = new HashMap<Integer, Integer>();
private final HashMap<Integer, Integer> lastversion = new HashMap<>();
// version, protected ranges (catch, finally)
private final HashMap<VarVersionPair, Integer> mapVersionFirstRange = new HashMap<VarVersionPair, Integer>();
private final HashMap<VarVersionPair, Integer> mapVersionFirstRange = new HashMap<>();
// version, version
private final HashMap<VarVersionPair, VarVersionPair> phantomppnodes = new HashMap<VarVersionPair, VarVersionPair>(); // ++ and --
private final HashMap<VarVersionPair, VarVersionPair> phantomppnodes = new HashMap<>(); // ++ and --
// node.id, version, version
private final HashMap<String, HashMap<VarVersionPair, VarVersionPair>> phantomexitnodes =
new HashMap<String, HashMap<VarVersionPair, VarVersionPair>>(); // 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<Integer, Integer> mapFieldVars = new HashMap<Integer, Integer>();
private final HashMap<Integer, Integer> 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<Integer> setInit = new HashSet<Integer>();
HashSet<Integer> setInit = new HashSet<>();
for (int i = 0; i < 64; i++) {
setInit.add(i);
}
factory = new FastSparseSetFactory<Integer>(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<String> updated = new HashSet<String>();
HashSet<String> 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<Integer> vers, Statement stat) {
FastSparseSet<Integer> versCopy = vers.getCopy();
HashSet<Integer> phiVers = new HashSet<Integer>();
HashSet<Integer> 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<VarVersionEdge> lstPreds = new ArrayList<VarVersionEdge>(phinode.preds);
List<VarVersionEdge> 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<VarVersionNode> colnodes = new ArrayList<VarVersionNode>();
List<VarVersionPair> colpaars = new ArrayList<VarVersionPair>();
List<VarVersionNode> colnodes = new ArrayList<>();
List<VarVersionPair> 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<String> setLongPathWrapper = new HashSet<String>();
HashSet<String> setLongPathWrapper = new HashSet<>();
for (List<FinallyPathWrapper> 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<VarVersionPair, VarVersionPair> mapPhantom = phantomexitnodes.get(predid);
if (mapPhantom == null) {
mapPhantom = new HashMap<VarVersionPair, VarVersionPair>();
mapPhantom = new HashMap<>();
}
SFormsFastMapDirect mapExitVar = mapNew.getCopy();

@ -40,7 +40,7 @@ public class CatchAllStatement extends Statement {
private VarExprent monitor;
private final List<VarExprent> vars = new ArrayList<VarExprent>();
private final List<VarExprent> vars = new ArrayList<>();
// *****************************************************************************
// constructors

@ -34,9 +34,9 @@ import java.util.List;
public class CatchStatement extends Statement {
private final List<List<String>> exctstrings = new ArrayList<List<String>>();
private final List<List<String>> exctstrings = new ArrayList<>();
private final List<VarExprent> vars = new ArrayList<VarExprent>();
private final List<VarExprent> 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<String>(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<Statement> lst = new ArrayList<Statement>();
List<Statement> lst = new ArrayList<>();
lst.add(head);
lst.addAll(setHandlers);
@ -204,7 +204,7 @@ public class CatchStatement extends Statement {
CatchStatement cs = new CatchStatement();
for (List<String> exc : this.exctstrings) {
cs.exctstrings.add(new ArrayList<String>(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)));

@ -34,9 +34,9 @@ public class DoStatement extends Statement {
private int looptype;
private final List<Exprent> initExprent = new ArrayList<Exprent>();
private final List<Exprent> conditionExprent = new ArrayList<Exprent>();
private final List<Exprent> incExprent = new ArrayList<Exprent>();
private final List<Exprent> initExprent = new ArrayList<>();
private final List<Exprent> conditionExprent = new ArrayList<>();
private final List<Exprent> incExprent = new ArrayList<>();
// *****************************************************************************
// constructors
@ -142,7 +142,7 @@ public class DoStatement extends Statement {
public List<Object> getSequentialObjects() {
List<Object> lst = new ArrayList<Object>();
List<Object> lst = new ArrayList<>();
switch (looptype) {
case LOOP_FOR:

@ -32,7 +32,7 @@ public class DummyExitStatement extends Statement {
public void addBytecodeOffsets(Collection<Integer> bytecodeOffsets) {
if (bytecodeOffsets != null && !bytecodeOffsets.isEmpty()) {
if (bytecode == null) {
bytecode = new HashSet<Integer>(bytecodeOffsets);
bytecode = new HashSet<>(bytecodeOffsets);
}
else {
bytecode.addAll(bytecodeOffsets);

@ -39,7 +39,7 @@ public class GeneralStatement extends Statement {
first = head;
stats.addWithKey(head, head.id);
HashSet<Statement> set = new HashSet<Statement>(statements);
HashSet<Statement> set = new HashSet<>(statements);
set.remove(head);
for (Statement st : set) {

@ -52,7 +52,7 @@ public class IfStatement extends Statement {
private boolean iffflag;
private final List<Exprent> headexprent = new ArrayList<Exprent>(); // contains IfExprent
private final List<Exprent> headexprent = new ArrayList<>(); // contains IfExprent
// *****************************************************************************
// constructors
@ -181,7 +181,7 @@ public class IfStatement extends Statement {
boolean ok = (regsize < 2);
if (!ok) {
List<Statement> lst = new ArrayList<Statement>();
List<Statement> lst = new ArrayList<>();
if (DecHelper.isChoiceStatement(head, lst)) {
p = lst.remove(0);
@ -295,7 +295,7 @@ public class IfStatement extends Statement {
public List<Object> getSequentialObjects() {
List<Object> lst = new ArrayList<Object>(stats);
List<Object> lst = new ArrayList<>(stats);
lst.add(1, headexprent.get(0));
return lst;

@ -73,14 +73,14 @@ public class Statement implements IMatchable {
// private fields
// *****************************************************************************
private final Map<Integer, List<StatEdge>> mapSuccEdges = new HashMap<Integer, List<StatEdge>>();
private final Map<Integer, List<StatEdge>> mapPredEdges = new HashMap<Integer, List<StatEdge>>();
private final Map<Integer, List<StatEdge>> mapSuccEdges = new HashMap<>();
private final Map<Integer, List<StatEdge>> mapPredEdges = new HashMap<>();
private final Map<Integer, List<Statement>> mapSuccStates = new HashMap<Integer, List<Statement>>();
private final Map<Integer, List<Statement>> mapPredStates = new HashMap<Integer, List<Statement>>();
private final Map<Integer, List<Statement>> mapSuccStates = new HashMap<>();
private final Map<Integer, List<Statement>> mapPredStates = new HashMap<>();
// statement as graph
protected final VBStyleCollection<Statement, Integer> stats = new VBStyleCollection<Statement, Integer>();
protected final VBStyleCollection<Statement, Integer> stats = new VBStyleCollection<>();
protected Statement parent;
@ -88,9 +88,9 @@ public class Statement implements IMatchable {
protected List<Exprent> exprents;
protected final HashSet<StatEdge> labelEdges = new HashSet<StatEdge>();
protected final HashSet<StatEdge> labelEdges = new HashSet<>();
protected final List<Exprent> varDefinitions = new ArrayList<Exprent>();
protected final List<Exprent> 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<Statement> continueSet = new HashSet<Statement>();
protected HashSet<Statement> continueSet = new HashSet<>();
// *****************************************************************************
// initializers
@ -143,7 +143,7 @@ public class Statement implements IMatchable {
List<T> lst = map.get(STATEDGE_DIRECT_ALL);
if (lst != null) {
map.put(STATEDGE_ALL, new ArrayList<T>(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<Statement> setHandlers = new HashSet<Statement>(head.getNeighbours(StatEdge.TYPE_EXCEPTION, DIRECTION_FORWARD));
Set<Statement> 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<StatEdge> lst = mapEdges.get(edgetype);
if (lst == null) {
mapEdges.put(edgetype, lst = new ArrayList<StatEdge>());
mapEdges.put(edgetype, lst = new ArrayList<>());
}
lst.add(edge);
List<Statement> lstStates = mapStates.get(edgetype);
if (lstStates == null) {
mapStates.put(edgetype, lstStates = new ArrayList<Statement>());
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<Statement> getReversePostOrderList(Statement stat) {
List<Statement> res = new ArrayList<Statement>();
List<Statement> res = new ArrayList<>();
addToReversePostOrderListIterative(stat, res);
@ -455,14 +455,14 @@ public class Statement implements IMatchable {
public List<Statement> getPostReversePostOrderList(List<Statement> lstexits) {
List<Statement> res = new ArrayList<Statement>();
List<Statement> res = new ArrayList<>();
if (lstexits == null) {
StrongConnectivityHelper schelper = new StrongConnectivityHelper(this);
lstexits = StrongConnectivityHelper.getExitReps(schelper.getComponents());
}
HashSet<Statement> setVisited = new HashSet<Statement>();
HashSet<Statement> 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<Object> getSequentialObjects() {
return new ArrayList<Object>(stats);
return new ArrayList<>(stats);
}
public void initExprents() {
@ -546,7 +546,7 @@ public class Statement implements IMatchable {
first = newstat;
}
List<StatEdge> lst = new ArrayList<StatEdge>(oldstat.getLabelEdges());
List<StatEdge> 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<Statement> lst) {
LinkedList<Statement> stackNode = new LinkedList<Statement>();
LinkedList<Integer> stackIndex = new LinkedList<Integer>();
HashSet<Statement> setVisited = new HashSet<Statement>();
LinkedList<Statement> stackNode = new LinkedList<>();
LinkedList<Integer> stackIndex = new LinkedList<>();
HashSet<Statement> setVisited = new HashSet<>();
stackNode.add(root);
stackIndex.add(0);
@ -697,10 +697,10 @@ public class Statement implements IMatchable {
List<StatEdge> res;
if ((type & (type - 1)) == 0) {
res = map.get(type);
res = res == null ? new ArrayList<StatEdge>() : new ArrayList<StatEdge>(res);
res = res == null ? new ArrayList<>() : new ArrayList<>(res);
}
else {
res = new ArrayList<StatEdge>();
res = new ArrayList<>();
for (int edgetype : StatEdge.TYPES) {
if ((type & edgetype) != 0) {
List<StatEdge> lst = map.get(edgetype);
@ -721,10 +721,10 @@ public class Statement implements IMatchable {
List<Statement> res;
if ((type & (type - 1)) == 0) {
res = map.get(type);
res = res == null ? new ArrayList<Statement>() : new ArrayList<Statement>(res);
res = res == null ? new ArrayList<>() : new ArrayList<>(res);
}
else {
res = new ArrayList<Statement>();
res = new ArrayList<>();
for (int edgetype : StatEdge.TYPES) {
if ((type & edgetype) != 0) {
List<Statement> lst = map.get(edgetype);
@ -739,7 +739,7 @@ public class Statement implements IMatchable {
}
public Set<Statement> getNeighboursSet(int type, int direction) {
return new HashSet<Statement>(getNeighbours(type, direction));
return new HashSet<>(getNeighbours(type, direction));
}
public List<StatEdge> getSuccessorEdges(int type) {

@ -37,15 +37,15 @@ public class SwitchStatement extends Statement {
// private fields
// *****************************************************************************
private List<Statement> caseStatements = new ArrayList<Statement>();
private List<Statement> caseStatements = new ArrayList<>();
private List<List<StatEdge>> caseEdges = new ArrayList<List<StatEdge>>();
private List<List<StatEdge>> caseEdges = new ArrayList<>();
private List<List<ConstExprent>> caseValues = new ArrayList<List<ConstExprent>>();
private List<List<ConstExprent>> caseValues = new ArrayList<>();
private StatEdge default_edge;
private final List<Exprent> headexprent = new ArrayList<Exprent>();
private final List<Exprent> headexprent = new ArrayList<>();
// *****************************************************************************
// constructors
@ -65,7 +65,7 @@ public class SwitchStatement extends Statement {
stats.addWithKey(head, head.id);
// find post node
Set<Statement> lstNodes = new HashSet<Statement>(head.getNeighbours(StatEdge.TYPE_REGULAR, DIRECTION_FORWARD));
Set<Statement> 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<Statement> lst = new ArrayList<Statement>();
List<Statement> lst = new ArrayList<>();
if (DecHelper.isChoiceStatement(head, lst)) {
Statement post = lst.remove(0);
@ -160,7 +160,7 @@ public class SwitchStatement extends Statement {
public List<Object> getSequentialObjects() {
List<Object> lst = new ArrayList<Object>(stats);
List<Object> 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<StatEdge, Integer> mapEdgeIndex = new HashMap<StatEdge, Integer>();
HashMap<StatEdge, Integer> mapEdgeIndex = new HashMap<>();
List<StatEdge> 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<Statement> nodes = new ArrayList<Statement>();
List<List<Integer>> edges = new ArrayList<List<Integer>>();
List<Statement> nodes = new ArrayList<>();
List<List<Integer>> edges = new ArrayList<>();
// collect regular edges
for (int i = 1; i < stats.size(); i++) {
Statement stat = stats.get(i);
List<Integer> lst = new ArrayList<Integer>();
List<Integer> 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<Integer> lst = new ArrayList<Integer>();
List<Integer> 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<Statement> setPreds = new HashSet<Statement>(stat.getNeighbours(StatEdge.TYPE_REGULAR, DIRECTION_BACKWARD));
HashSet<Statement> 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<List<StatEdge>> lstEdges = new ArrayList<List<StatEdge>>();
List<List<ConstExprent>> lstValues = new ArrayList<List<ConstExprent>>();
List<List<StatEdge>> lstEdges = new ArrayList<>();
List<List<ConstExprent>> lstValues = new ArrayList<>();
for (List<Integer> lst : edges) {
List<StatEdge> lste = new ArrayList<StatEdge>();
List<ConstExprent> lstv = new ArrayList<ConstExprent>();
List<StatEdge> lste = new ArrayList<>();
List<ConstExprent> lstv = new ArrayList<>();
List<StatEdge> lstSuccs = first.getSuccessorEdges(STATEDGE_DIRECT_ALL);
for (Integer in : lst) {

@ -32,7 +32,7 @@ public class SynchronizedStatement extends Statement {
private Statement body;
private final List<Exprent> headexprent = new ArrayList<Exprent>();
private final List<Exprent> headexprent = new ArrayList<>();
// *****************************************************************************
// constructors
@ -106,7 +106,7 @@ public class SynchronizedStatement extends Statement {
public List<Object> getSequentialObjects() {
List<Object> lst = new ArrayList<Object>(stats);
List<Object> lst = new ArrayList<>(stats);
lst.add(1, headexprent.get(0));
return lst;

@ -23,9 +23,9 @@ import java.util.List;
public class CheckTypesResult {
private final List<ExprentTypePair> lstMaxTypeExprents = new ArrayList<ExprentTypePair>();
private final List<ExprentTypePair> lstMaxTypeExprents = new ArrayList<>();
private final List<ExprentTypePair> lstMinTypeExprents = new ArrayList<ExprentTypePair>();
private final List<ExprentTypePair> lstMinTypeExprents = new ArrayList<>();
public void addMaxTypeExprent(Exprent exprent, VarType type) {
lstMaxTypeExprents.add(new ExprentTypePair(exprent, type, null));

@ -45,9 +45,9 @@ public class VarDefinitionHelper {
public VarDefinitionHelper(Statement root, StructMethod mt, VarProcessor varproc) {
mapVarDefStatements = new HashMap<Integer, Statement>();
mapStatementVars = new HashMap<Integer, HashSet<Integer>>();
implDefVars = new HashSet<Integer>();
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<Statement> stack = new LinkedList<Statement>();
LinkedList<Statement> stack = new LinkedList<>();
stack.add(root);
while (!stack.isEmpty()) {
@ -211,7 +211,7 @@ public class VarDefinitionHelper {
private Statement findFirstBlock(Statement stat, Integer varindex) {
LinkedList<Statement> stack = new LinkedList<Statement>();
LinkedList<Statement> stack = new LinkedList<>();
stack.add(stat);
while (!stack.isEmpty()) {
@ -251,15 +251,15 @@ public class VarDefinitionHelper {
private Set<Integer> initStatement(Statement stat) {
HashMap<Integer, Integer> mapCount = new HashMap<Integer, Integer>();
HashMap<Integer, Integer> mapCount = new HashMap<>();
List<VarExprent> condlst;
if (stat.getExprents() == null) {
// recurse on children statements
List<Integer> childVars = new ArrayList<Integer>();
List<Exprent> currVars = new ArrayList<Exprent>();
List<Integer> childVars = new ArrayList<>();
List<Exprent> currVars = new ArrayList<>();
for (Object obj : stat.getSequentialObjects()) {
if (obj instanceof Statement) {
@ -306,7 +306,7 @@ public class VarDefinitionHelper {
}
HashSet<Integer> set = new HashSet<Integer>(mapCount.keySet());
HashSet<Integer> set = new HashSet<>(mapCount.keySet());
// put all variables defined in this statement into the set
for (Entry<Integer, Integer> en : mapCount.entrySet()) {
@ -322,8 +322,8 @@ public class VarDefinitionHelper {
private static List<VarExprent> getAllVars(List<Exprent> lst) {
List<VarExprent> res = new ArrayList<VarExprent>();
List<Exprent> listTemp = new ArrayList<Exprent>();
List<VarExprent> res = new ArrayList<>();
List<Exprent> listTemp = new ArrayList<>();
for (Exprent expr : lst) {
listTemp.addAll(expr.getAllExprents(true));

@ -29,10 +29,10 @@ import java.util.Map.Entry;
public class VarProcessor {
private final StructMethod method;
private final MethodDescriptor methodDescriptor;
private Map<VarVersionPair, String> mapVarNames = new HashMap<VarVersionPair, String>();
private Map<VarVersionPair, String> mapVarNames = new HashMap<>();
private VarVersionsProcessor varVersions;
private final Map<VarVersionPair, String> thisVars = new HashMap<VarVersionPair, String>();
private final Set<VarVersionPair> externalVars = new HashSet<VarVersionPair>();
private final Map<VarVersionPair, String> thisVars = new HashMap<>();
private final Set<VarVersionPair> 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<VarVersionPair, String>();
mapVarNames = new HashMap<>();
new VarDefinitionHelper(root, method, this).setVarDefinitions();
}
@ -56,10 +56,10 @@ public class VarProcessor {
Map<Integer, Integer> mapOriginalVarIndices = varVersions.getMapOriginalVarIndices();
List<VarVersionPair> listVars = new ArrayList<VarVersionPair>(mapVarNames.keySet());
List<VarVersionPair> listVars = new ArrayList<>(mapVarNames.keySet());
Collections.sort(listVars, (o1, o2) -> o1.var - o2.var);
Map<String, Integer> mapNames = new HashMap<String, Integer>();
Map<String, Integer> 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<VarVersionPair, String> tempVarNames = new HashMap<VarVersionPair, String>(mapVarNames);
Map<VarVersionPair, String> tempVarNames = new HashMap<>(mapVarNames);
for (Entry<VarVersionPair, String> ent : tempVarNames.entrySet()) {
mapVarNames.put(ent.getKey(), vc.getFreeName(ent.getValue()));
}

@ -40,9 +40,9 @@ public class VarTypeProcessor {
private final StructMethod method;
private final MethodDescriptor methodDescriptor;
private final Map<VarVersionPair, VarType> mapExprentMinTypes = new HashMap<VarVersionPair, VarType>();
private final Map<VarVersionPair, VarType> mapExprentMaxTypes = new HashMap<VarVersionPair, VarType>();
private final Map<VarVersionPair, Integer> mapFinalVars = new HashMap<VarVersionPair, Integer>();
private final Map<VarVersionPair, VarType> mapExprentMinTypes = new HashMap<>();
private final Map<VarVersionPair, VarType> mapExprentMaxTypes = new HashMap<>();
private final Map<VarVersionPair, Integer> mapFinalVars = new HashMap<>();
public VarTypeProcessor(StructMethod mt, MethodDescriptor md) {
method = mt;
@ -78,7 +78,7 @@ public class VarTypeProcessor {
}
// catch variables
LinkedList<Statement> stack = new LinkedList<Statement>();
LinkedList<Statement> stack = new LinkedList<>();
stack.add(root);
while (!stack.isEmpty()) {

@ -31,9 +31,9 @@ public class VarVersionNode implements IGraphNode {
public final int version;
public final Set<VarVersionEdge> succs = new HashSet<VarVersionEdge>();
public final Set<VarVersionEdge> succs = new HashSet<>();
public final Set<VarVersionEdge> preds = new HashSet<VarVersionEdge>();
public final Set<VarVersionEdge> preds = new HashSet<>();
public int flags;
@ -50,7 +50,7 @@ public class VarVersionNode implements IGraphNode {
}
public List<IGraphNode> getPredecessors() {
List<IGraphNode> lst = new ArrayList<IGraphNode>(preds.size());
List<IGraphNode> lst = new ArrayList<>(preds.size());
for (VarVersionEdge edge : preds) {
lst.add(edge.source);
}

@ -27,7 +27,7 @@ public class VarVersionsGraph {
public int counter = 0;
public final VBStyleCollection<VarVersionNode, VarVersionPair> nodes = new VBStyleCollection<VarVersionNode, VarVersionPair>();
public final VBStyleCollection<VarVersionNode, VarVersionPair> nodes = new VBStyleCollection<>();
private GenericDominatorEngine engine;
@ -48,13 +48,13 @@ public class VarVersionsGraph {
}
else {
HashSet<VarVersionNode> marked = new HashSet<VarVersionNode>();
HashSet<VarVersionNode> marked = new HashSet<>();
if (domnodes.contains(node)) {
return true;
}
LinkedList<VarVersionNode> lstNodes = new LinkedList<VarVersionNode>();
LinkedList<VarVersionNode> lstNodes = new LinkedList<>();
lstNodes.add(node);
while (!lstNodes.isEmpty()) {
@ -85,7 +85,7 @@ public class VarVersionsGraph {
public void initDominators() {
final HashSet<VarVersionNode> roots = new HashSet<VarVersionNode>();
final HashSet<VarVersionNode> roots = new HashSet<>();
for (VarVersionNode node : nodes) {
if (node.preds.isEmpty()) {
@ -108,12 +108,12 @@ public class VarVersionsGraph {
private static LinkedList<VarVersionNode> getReversedPostOrder(Collection<VarVersionNode> roots) {
LinkedList<VarVersionNode> lst = new LinkedList<VarVersionNode>();
HashSet<VarVersionNode> setVisited = new HashSet<VarVersionNode>();
LinkedList<VarVersionNode> lst = new LinkedList<>();
HashSet<VarVersionNode> setVisited = new HashSet<>();
for (VarVersionNode root : roots) {
LinkedList<VarVersionNode> lstTemp = new LinkedList<VarVersionNode>();
LinkedList<VarVersionNode> lstTemp = new LinkedList<>();
addToReversePostOrderListIterative(root, lstTemp, setVisited);
lst.addAll(lstTemp);
@ -124,10 +124,10 @@ public class VarVersionsGraph {
private static void addToReversePostOrderListIterative(VarVersionNode root, List<VarVersionNode> lst, HashSet<VarVersionNode> setVisited) {
HashMap<VarVersionNode, List<VarVersionEdge>> mapNodeSuccs = new HashMap<VarVersionNode, List<VarVersionEdge>>();
HashMap<VarVersionNode, List<VarVersionEdge>> mapNodeSuccs = new HashMap<>();
LinkedList<VarVersionNode> stackNode = new LinkedList<VarVersionNode>();
LinkedList<Integer> stackIndex = new LinkedList<Integer>();
LinkedList<VarVersionNode> stackNode = new LinkedList<>();
LinkedList<Integer> stackIndex = new LinkedList<>();
stackNode.add(root);
stackIndex.add(0);
@ -141,7 +141,7 @@ public class VarVersionsGraph {
List<VarVersionEdge> lstSuccs = mapNodeSuccs.get(node);
if (lstSuccs == null) {
mapNodeSuccs.put(node, lstSuccs = new ArrayList<VarVersionEdge>(node.succs));
mapNodeSuccs.put(node, lstSuccs = new ArrayList<>(node.succs));
}
for (; index < lstSuccs.size(); index++) {

@ -35,7 +35,7 @@ import java.util.Map.Entry;
public class VarVersionsProcessor {
private final StructMethod method;
private Map<Integer, Integer> mapOriginalVarIndices = new HashMap<Integer, Integer>();
private Map<Integer, Integer> 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<Set<VarVersionPair>> lst = new ArrayList<Set<VarVersionPair>>();
List<Set<VarVersionPair>> lst = new ArrayList<>();
for (Entry<VarVersionPair, FastSparseSet<Integer>> ent : ssa.getPhi().entrySet()) {
Set<VarVersionPair> set = new HashSet<VarVersionPair>();
Set<VarVersionPair> 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<VarVersionPair> tset = lst.get(i);
Set<VarVersionPair> intersection = new HashSet<VarVersionPair>(set);
Set<VarVersionPair> intersection = new HashSet<>(set);
intersection.retainAll(tset);
if (!intersection.isEmpty()) {
@ -87,7 +87,7 @@ public class VarVersionsProcessor {
lst.add(set);
}
Map<VarVersionPair, Integer> phiVersions = new HashMap<VarVersionPair, Integer>();
Map<VarVersionPair, Integer> phiVersions = new HashMap<>();
for (Set<VarVersionPair> set : lst) {
int min = Integer.MAX_VALUE;
for (VarVersionPair paar : set) {
@ -130,7 +130,7 @@ public class VarVersionsProcessor {
Map<VarVersionPair, VarType> mapExprentMaxTypes = typeProcessor.getMapExprentMaxTypes();
Map<VarVersionPair, VarType> mapExprentMinTypes = typeProcessor.getMapExprentMinTypes();
Set<VarVersionPair> set = new HashSet<VarVersionPair>(mapExprentMinTypes.keySet());
Set<VarVersionPair> 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<VarVersionPair, VarType> mapExprentMaxTypes = typeProcessor.getMapExprentMaxTypes();
Map<VarVersionPair, VarType> mapExprentMinTypes = typeProcessor.getMapExprentMinTypes();
Map<Integer, Set<Integer>> mapVarVersions = new HashMap<Integer, Set<Integer>>();
Map<Integer, Set<Integer>> mapVarVersions = new HashMap<>();
for (VarVersionPair pair : mapExprentMinTypes.keySet()) {
if (pair.version >= 0) { // don't merge constants
Set<Integer> set = mapVarVersions.get(pair.var);
if (set == null) {
set = new HashSet<Integer>();
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<VarVersionPair, Integer> mapMergedVersions = new HashMap<VarVersionPair, Integer>();
Map<VarVersionPair, Integer> mapMergedVersions = new HashMap<>();
for (Entry<Integer, Set<Integer>> ent : mapVarVersions.entrySet()) {
if (ent.getValue().size() > 1) {
List<Integer> lstVersions = new ArrayList<Integer>(ent.getValue());
List<Integer> 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<VarVersionPair, Integer> mapVarPaar = new HashMap<VarVersionPair, Integer>();
Map<Integer, Integer> mapOriginalVarIndices = new HashMap<Integer, Integer>();
final Map<VarVersionPair, Integer> mapVarPaar = new HashMap<>();
Map<Integer, Integer> mapOriginalVarIndices = new HashMap<>();
// map var-version pairs on new var indexes
Set<VarVersionPair> set = new HashSet<VarVersionPair>(mapExprentMinTypes.keySet());
Set<VarVersionPair> set = new HashSet<>(mapExprentMinTypes.keySet());
for (VarVersionPair pair : set) {
if (pair.version >= 0) {

@ -26,7 +26,7 @@ public class ClassWrapperNode {
private ClassWrapperNode superclass;
private final List<ClassWrapperNode> subclasses = new ArrayList<ClassWrapperNode>();
private final List<ClassWrapperNode> subclasses = new ArrayList<>();
public ClassWrapperNode(StructClass cl) {
this.classStruct = cl;

@ -23,12 +23,12 @@ import java.util.Set;
public class ConverterHelper implements IIdentifierRenamer {
private static final Set<String> KEYWORDS = new HashSet<String>(Arrays.asList(
private static final Set<String> 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<String> RESERVED_WINDOWS_NAMESPACE = new HashSet<String>(Arrays.asList(
private static final Set<String> 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<String> setNonStandardClassNames = new HashSet<String>();
private final Set<String> setNonStandardClassNames = new HashSet<>();
@Override
public boolean toBeRenamed(Type elementType, String className, String element, String descriptor) {

@ -36,9 +36,9 @@ public class IdentifierConverter implements NewClassNameBuilder {
private StructContext context;
private IIdentifierRenamer helper;
private PoolInterceptor interceptor;
private List<ClassWrapperNode> rootClasses = new ArrayList<ClassWrapperNode>();
private List<ClassWrapperNode> rootInterfaces = new ArrayList<ClassWrapperNode>();
private Map<String, Map<String, String>> interfaceNameMaps = new HashMap<String, Map<String, String>>();
private List<ClassWrapperNode> rootClasses = new ArrayList<>();
private List<ClassWrapperNode> rootInterfaces = new ArrayList<>();
private Map<String, Map<String, String>> interfaceNameMaps = new HashMap<>();
public void rename(StructContext context) {
try {
@ -76,11 +76,11 @@ public class IdentifierConverter implements NewClassNameBuilder {
private void renameClasses() {
List<ClassWrapperNode> lstClasses = getReversePostOrderListIterative(rootClasses);
Map<String, Map<String, String>> classNameMaps = new HashMap<String, Map<String, String>>();
Map<String, Map<String, String>> classNameMaps = new HashMap<>();
for (ClassWrapperNode node : lstClasses) {
StructClass cl = node.getClassStruct();
Map<String, String> names = new HashMap<String, String>();
Map<String, String> names = new HashMap<>();
// merge information on super class
if (cl.superClass != null) {
@ -113,7 +113,7 @@ public class IdentifierConverter implements NewClassNameBuilder {
}
private Map<String, String> processExternalInterface(StructClass cl) {
Map<String, String> names = new HashMap<String, String>();
Map<String, String> names = new HashMap<>();
for (String ifName : cl.getInterfaceNames()) {
Map<String, String> mapInt = interfaceNameMaps.get(ifName);
@ -135,13 +135,13 @@ public class IdentifierConverter implements NewClassNameBuilder {
private void renameInterfaces() {
List<ClassWrapperNode> lstInterfaces = getReversePostOrderListIterative(rootInterfaces);
Map<String, Map<String, String>> interfaceNameMaps = new HashMap<String, Map<String, String>>();
Map<String, Map<String, String>> interfaceNameMaps = new HashMap<>();
// rename methods and fields
for (ClassWrapperNode node : lstInterfaces) {
StructClass cl = node.getClassStruct();
Map<String, String> names = new HashMap<String, String>();
Map<String, String> 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<ClassWrapperNode> lstAllClasses = new ArrayList<ClassWrapperNode>(getReversePostOrderListIterative(rootInterfaces));
List<ClassWrapperNode> 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<String> setMethodNames = new HashSet<String>();
HashSet<String> 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<String> setFieldNames = new HashSet<String>();
HashSet<String> setFieldNames = new HashSet<>();
for (StructField fd : cl.getFields()) {
setFieldNames.add(fd.getName());
}
@ -286,12 +286,12 @@ public class IdentifierConverter implements NewClassNameBuilder {
}
private static List<ClassWrapperNode> getReversePostOrderListIterative(List<ClassWrapperNode> roots) {
List<ClassWrapperNode> res = new ArrayList<ClassWrapperNode>();
List<ClassWrapperNode> res = new ArrayList<>();
LinkedList<ClassWrapperNode> stackNode = new LinkedList<ClassWrapperNode>();
LinkedList<Integer> stackIndex = new LinkedList<Integer>();
LinkedList<ClassWrapperNode> stackNode = new LinkedList<>();
LinkedList<Integer> stackIndex = new LinkedList<>();
Set<ClassWrapperNode> setVisited = new HashSet<ClassWrapperNode>();
Set<ClassWrapperNode> setVisited = new HashSet<>();
for (ClassWrapperNode root : roots) {
stackNode.add(root);
@ -326,19 +326,19 @@ public class IdentifierConverter implements NewClassNameBuilder {
}
private void buildInheritanceTree() {
Map<String, ClassWrapperNode> nodes = new HashMap<String, ClassWrapperNode>();
Map<String, ClassWrapperNode> nodes = new HashMap<>();
Map<String, StructClass> classes = context.getClasses();
List<ClassWrapperNode> rootClasses = new ArrayList<ClassWrapperNode>();
List<ClassWrapperNode> rootInterfaces = new ArrayList<ClassWrapperNode>();
List<ClassWrapperNode> rootClasses = new ArrayList<>();
List<ClassWrapperNode> rootInterfaces = new ArrayList<>();
for (StructClass cl : classes.values()) {
if (!cl.isOwn()) {
continue;
}
LinkedList<StructClass> stack = new LinkedList<StructClass>();
LinkedList<ClassWrapperNode> stackSubNodes = new LinkedList<ClassWrapperNode>();
LinkedList<StructClass> stack = new LinkedList<>();
LinkedList<ClassWrapperNode> stackSubNodes = new LinkedList<>();
stack.add(cl);
stackSubNodes.add(null);

@ -23,9 +23,9 @@ public class PoolInterceptor {
private final IIdentifierRenamer helper;
private final HashMap<String, String> mapOldToNewNames = new HashMap<String, String>();
private final HashMap<String, String> mapOldToNewNames = new HashMap<>();
private final HashMap<String, String> mapNewToOldNames = new HashMap<String, String>();
private final HashMap<String, String> mapNewToOldNames = new HashMap<>();
public PoolInterceptor(IIdentifierRenamer helper) {
this.helper = helper;

@ -42,11 +42,11 @@ public class ContextUnit {
private final IResultSaver resultSaver;
private final IDecompiledData decompiledData;
private final List<String> classEntries = new ArrayList<String>(); // class file or jar/zip entry
private final List<String> dirEntries = new ArrayList<String>();
private final List<String[]> otherEntries = new ArrayList<String[]>();
private final List<String> classEntries = new ArrayList<>(); // class file or jar/zip entry
private final List<String> dirEntries = new ArrayList<>();
private final List<String[]> otherEntries = new ArrayList<>();
private List<StructClass> classes = new ArrayList<StructClass>();
private List<StructClass> classes = new ArrayList<>();
private Manifest manifest;
public ContextUnit(int type, String archivePath, String filename, boolean own, IResultSaver resultSaver, IDecompiledData decompiledData) {
@ -72,7 +72,7 @@ public class ContextUnit {
}
public void reload(LazyLoader loader) throws IOException {
List<StructClass> lstClasses = new ArrayList<StructClass>();
List<StructClass> lstClasses = new ArrayList<>();
for (StructClass cl : classes) {
String oldName = cl.qualifiedName;

@ -93,7 +93,7 @@ public class StructClass extends StructMember {
// fields
length = in.readUnsignedShort();
fields = new VBStyleCollection<StructField, String>();
fields = new VBStyleCollection<>();
for (int i = 0; i < length; i++) {
StructField field = new StructField(in, this);
fields.addWithKey(field, InterpreterUtil.makeUniqueKey(field.getName(), field.getDescriptor()));
@ -101,7 +101,7 @@ public class StructClass extends StructMember {
// methods
length = in.readUnsignedShort();
methods = new VBStyleCollection<StructMethod, String>();
methods = new VBStyleCollection<>();
for (int i = 0; i < length; i++) {
StructMethod method = new StructMethod(in, this);
methods.addWithKey(method, InterpreterUtil.makeUniqueKey(method.getName(), method.getDescriptor()));

@ -35,8 +35,8 @@ public class StructContext {
private final IResultSaver saver;
private final IDecompiledData decompiledData;
private final LazyLoader loader;
private final Map<String, ContextUnit> units = new HashMap<String, ContextUnit>();
private final Map<String, StructClass> classes = new HashMap<String, StructClass>();
private final Map<String, ContextUnit> units = new HashMap<>();
private final Map<String, StructClass> classes = new HashMap<>();
public StructContext(IResultSaver saver, IDecompiledData decompiledData, LazyLoader loader) {
this.saver = saver;

@ -47,7 +47,7 @@ public class StructMember {
}
protected VBStyleCollection<StructGeneralAttribute, String> readAttributes(DataInputFullStream in, ConstantPool pool) throws IOException {
VBStyleCollection<StructGeneralAttribute, String> attributes = new VBStyleCollection<StructGeneralAttribute, String>();
VBStyleCollection<StructGeneralAttribute, String> attributes = new VBStyleCollection<>();
int length = in.readUnsignedShort();
for (int i = 0; i < length; i++) {

@ -119,7 +119,7 @@ public class StructMethod extends StructMember {
@SuppressWarnings("AssignmentToForLoopParameter")
private InstructionSequence parseBytecode(DataInputFullStream in, int length, ConstantPool pool) throws IOException {
VBStyleCollection<Instruction, Integer> instructions = new VBStyleCollection<Instruction, Integer>();
VBStyleCollection<Instruction, Integer> instructions = new VBStyleCollection<>();
int bytecode_version = classStruct.getBytecodeVersion();
@ -137,7 +137,7 @@ public class StructMethod extends StructMember {
opcode = in.readUnsignedByte();
}
List<Integer> operands = new ArrayList<Integer>();
List<Integer> operands = new ArrayList<>();
if (opcode >= opc_iconst_m1 && opcode <= opc_iconst_5) {
operands.add(new Integer(opr_iconst[opcode - opc_iconst_m1]));
@ -331,7 +331,7 @@ public class StructMethod extends StructMember {
}
// initialize exception table
List<ExceptionHandler> lstHandlers = new ArrayList<ExceptionHandler>();
List<ExceptionHandler> lstHandlers = new ArrayList<>();
int exception_count = in.readUnsignedShort();
for (int i = 0; i < exception_count; i++) {

@ -39,7 +39,7 @@ public class StructAnnotationAttribute extends StructGeneralAttribute {
public static List<AnnotationExprent> parseAnnotations(ConstantPool pool, DataInputStream data) throws IOException {
int len = data.readUnsignedShort();
if (len > 0) {
List<AnnotationExprent> annotations = new ArrayList<AnnotationExprent>(len);
List<AnnotationExprent> annotations = new ArrayList<>(len);
for (int i = 0; i < len; i++) {
annotations.add(parseAnnotation(data, pool));
}
@ -57,8 +57,8 @@ public class StructAnnotationAttribute extends StructGeneralAttribute {
List<Exprent> values;
int len = data.readUnsignedShort();
if (len > 0) {
names = new ArrayList<String>(len);
values = new ArrayList<Exprent>(len);
names = new ArrayList<>(len);
values = new ArrayList<>(len);
for (int i = 0; i < len; i++) {
names.add(pool.getPrimitiveConstant(data.readUnsignedShort()).getString());
values.add(parseAnnotationElement(data, pool));
@ -127,7 +127,7 @@ public class StructAnnotationAttribute extends StructGeneralAttribute {
List<Exprent> elements = Collections.emptyList();
int len = data.readUnsignedShort();
if (len > 0) {
elements = new ArrayList<Exprent>(len);
elements = new ArrayList<>(len);
for (int i = 0; i < len; i++) {
elements.add(parseAnnotationElement(data, pool));
}

@ -34,7 +34,7 @@ public class StructAnnotationParameterAttribute extends StructGeneralAttribute {
int len = data.readUnsignedByte();
if (len > 0) {
paramAnnotations = new ArrayList<List<AnnotationExprent>>(len);
paramAnnotations = new ArrayList<>(len);
for (int i = 0; i < len; i++) {
List<AnnotationExprent> annotations = StructAnnotationAttribute.parseAnnotations(pool, data);
paramAnnotations.add(annotations);

@ -26,8 +26,8 @@ import java.util.List;
public class StructBootstrapMethodsAttribute extends StructGeneralAttribute {
private final List<LinkConstant> methodRefs = new ArrayList<LinkConstant>();
private final List<List<PooledConstant>> methodArguments = new ArrayList<List<PooledConstant>>();
private final List<LinkConstant> methodRefs = new ArrayList<>();
private final List<List<PooledConstant>> methodArguments = new ArrayList<>();
@Override
public void initContent(ConstantPool pool) throws IOException {
@ -39,7 +39,7 @@ public class StructBootstrapMethodsAttribute extends StructGeneralAttribute {
int bootstrap_method_ref = data.readUnsignedShort();
int num_bootstrap_arguments = data.readUnsignedShort();
List<PooledConstant> list_arguments = new ArrayList<PooledConstant>();
List<PooledConstant> list_arguments = new ArrayList<>();
for (int j = 0; j < num_bootstrap_arguments; ++j) {
int bootstrap_argument_ref = data.readUnsignedShort();

@ -32,7 +32,7 @@ public class StructExceptionsAttribute extends StructGeneralAttribute {
DataInputStream data = stream();
int len = data.readUnsignedShort();
if (len > 0) {
throwsExceptions = new ArrayList<Integer>(len);
throwsExceptions = new ArrayList<>(len);
for (int i = 0; i < len; i++) {
throwsExceptions.add(data.readUnsignedShort());
}

@ -52,7 +52,7 @@ public class StructInnerClassesAttribute extends StructGeneralAttribute {
int len = data.readUnsignedShort();
if (len > 0) {
entries = new ArrayList<Entry>(len);
entries = new ArrayList<>(len);
for (int i = 0; i < len; i++) {
int innerNameIdx = data.readUnsignedShort();

@ -43,7 +43,7 @@ public class StructLocalVariableTableAttribute extends StructGeneralAttribute {
int len = data.readUnsignedShort();
if (len > 0) {
mapVarNames = new HashMap<Integer, String>(len);
mapVarNames = new HashMap<>(len);
for (int i = 0; i < len; i++) {
data.discard(4);
int nameIndex = data.readUnsignedShort();

@ -40,7 +40,7 @@ public class ConstantPool implements NewClassNameBuilder {
public ConstantPool(DataInputStream in) throws IOException {
int size = in.readUnsignedShort();
pool = new ArrayList<PooledConstant>(size);
pool = new ArrayList<>(size);
BitSet[] nextPass = {new BitSet(size), new BitSet(size), new BitSet(size)};
// first dummy constant

@ -24,9 +24,9 @@ import java.util.List;
public class DataPoint {
private List<VarType> localVariables = new ArrayList<VarType>();
private List<VarType> localVariables = new ArrayList<>();
private ListStack<VarType> stack = new ListStack<VarType>();
private ListStack<VarType> stack = new ListStack<>();
public void setVariable(int index, VarType value) {
@ -53,7 +53,7 @@ public class DataPoint {
public DataPoint copy() {
DataPoint point = new DataPoint();
point.setLocalVariables(new ArrayList<VarType>(localVariables));
point.setLocalVariables(new ArrayList<>(localVariables));
point.setStack(stack.clone());
return point;
}

@ -41,7 +41,7 @@ public class MethodDescriptor {
if (parenth > 1) {
String parameters = descriptor.substring(1, parenth);
List<String> lst = new ArrayList<String>();
List<String> lst = new ArrayList<>();
int indexFrom = -1, ind, len = parameters.length(), index = 0;
while (index < len) {

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save