Collections.addAll applied; some more warnings fixed

master
Tagir Valeev 7 years ago
parent 893450cdb3
commit 7f63baab37
  1. 3
      src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java
  2. 4
      src/org/jetbrains/java/decompiler/modules/decompiler/SequenceHelper.java
  3. 34
      src/org/jetbrains/java/decompiler/modules/decompiler/SimplifyExprentsHelper.java
  4. 3
      src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/ExceptionDeobfuscator.java
  5. 3
      src/org/jetbrains/java/decompiler/modules/decompiler/exps/FunctionExprent.java

@ -898,8 +898,7 @@ public class FinallyProcessor {
newblock.setSeq(seq); newblock.setSeq(seq);
newblock.getInstrOldOffsets().addAll(oldOffsets); newblock.getInstrOldOffsets().addAll(oldOffsets);
List<BasicBlock> lstTemp = new ArrayList<>(); List<BasicBlock> lstTemp = new ArrayList<>(sample.getSuccs());
lstTemp.addAll(sample.getSuccs());
// move successors // move successors
for (BasicBlock suc : lstTemp) { for (BasicBlock suc : lstTemp) {

@ -18,7 +18,6 @@ package org.jetbrains.java.decompiler.modules.decompiler;
import org.jetbrains.java.decompiler.code.cfg.BasicBlock; import org.jetbrains.java.decompiler.code.cfg.BasicBlock;
import org.jetbrains.java.decompiler.main.DecompilerContext; import org.jetbrains.java.decompiler.main.DecompilerContext;
import org.jetbrains.java.decompiler.main.collectors.CounterContainer; import org.jetbrains.java.decompiler.main.collectors.CounterContainer;
import org.jetbrains.java.decompiler.modules.decompiler.exps.Exprent;
import org.jetbrains.java.decompiler.modules.decompiler.stats.BasicBlockStatement; import org.jetbrains.java.decompiler.modules.decompiler.stats.BasicBlockStatement;
import org.jetbrains.java.decompiler.modules.decompiler.stats.SequenceStatement; import org.jetbrains.java.decompiler.modules.decompiler.stats.SequenceStatement;
import org.jetbrains.java.decompiler.modules.decompiler.stats.Statement; import org.jetbrains.java.decompiler.modules.decompiler.stats.Statement;
@ -39,8 +38,7 @@ public class SequenceHelper {
if (stat.type == Statement.TYPE_SEQUENCE) { if (stat.type == Statement.TYPE_SEQUENCE) {
List<Statement> lst = new ArrayList<>(); List<Statement> lst = new ArrayList<>(stat.getStats());
lst.addAll(stat.getStats());
boolean unfolded = false; boolean unfolded = false;

@ -15,30 +15,12 @@
*/ */
package org.jetbrains.java.decompiler.modules.decompiler; package org.jetbrains.java.decompiler.modules.decompiler;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import org.jetbrains.java.decompiler.code.CodeConstants; import org.jetbrains.java.decompiler.code.CodeConstants;
import org.jetbrains.java.decompiler.main.ClassesProcessor.ClassNode; import org.jetbrains.java.decompiler.main.ClassesProcessor.ClassNode;
import org.jetbrains.java.decompiler.main.DecompilerContext; import org.jetbrains.java.decompiler.main.DecompilerContext;
import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences; import org.jetbrains.java.decompiler.main.extern.IFernflowerPreferences;
import org.jetbrains.java.decompiler.main.rels.ClassWrapper; import org.jetbrains.java.decompiler.main.rels.ClassWrapper;
import org.jetbrains.java.decompiler.modules.decompiler.exps.ArrayExprent; import org.jetbrains.java.decompiler.modules.decompiler.exps.*;
import org.jetbrains.java.decompiler.modules.decompiler.exps.AssignmentExprent;
import org.jetbrains.java.decompiler.modules.decompiler.exps.ConstExprent;
import org.jetbrains.java.decompiler.modules.decompiler.exps.ExitExprent;
import org.jetbrains.java.decompiler.modules.decompiler.exps.Exprent;
import org.jetbrains.java.decompiler.modules.decompiler.exps.FieldExprent;
import org.jetbrains.java.decompiler.modules.decompiler.exps.FunctionExprent;
import org.jetbrains.java.decompiler.modules.decompiler.exps.InvocationExprent;
import org.jetbrains.java.decompiler.modules.decompiler.exps.MonitorExprent;
import org.jetbrains.java.decompiler.modules.decompiler.exps.NewExprent;
import org.jetbrains.java.decompiler.modules.decompiler.exps.VarExprent;
import org.jetbrains.java.decompiler.modules.decompiler.sforms.SSAConstructorSparseEx; import org.jetbrains.java.decompiler.modules.decompiler.sforms.SSAConstructorSparseEx;
import org.jetbrains.java.decompiler.modules.decompiler.stats.IfStatement; import org.jetbrains.java.decompiler.modules.decompiler.stats.IfStatement;
import org.jetbrains.java.decompiler.modules.decompiler.stats.Statement; import org.jetbrains.java.decompiler.modules.decompiler.stats.Statement;
@ -49,6 +31,9 @@ import org.jetbrains.java.decompiler.struct.match.MatchEngine;
import org.jetbrains.java.decompiler.util.FastSparseSetFactory.FastSparseSet; import org.jetbrains.java.decompiler.util.FastSparseSetFactory.FastSparseSet;
import org.jetbrains.java.decompiler.util.InterpreterUtil; import org.jetbrains.java.decompiler.util.InterpreterUtil;
import java.util.*;
import java.util.Map.Entry;
public class SimplifyExprentsHelper { public class SimplifyExprentsHelper {
static final MatchEngine class14Builder = new MatchEngine(); static final MatchEngine class14Builder = new MatchEngine();
@ -813,8 +798,7 @@ public class SimplifyExprentsHelper {
} }
if (found) { if (found) {
List<Exprent> data = new ArrayList<>(); List<Exprent> data = new ArrayList<>(stif.getFirst().getExprents());
data.addAll(stif.getFirst().getExprents());
data.add(new AssignmentExprent(ifvar, new FunctionExprent(FunctionExprent.FUNCTION_IIF, data.add(new AssignmentExprent(ifvar, new FunctionExprent(FunctionExprent.FUNCTION_IIF,
Arrays.asList( Arrays.asList(
@ -859,8 +843,7 @@ public class SimplifyExprentsHelper {
return false; return false;
} }
List<Exprent> data = new ArrayList<>(); List<Exprent> data = new ArrayList<>(stif.getFirst().getExprents());
data.addAll(stif.getFirst().getExprents());
data.add(new ExitExprent(ifex.getExitType(), new FunctionExprent(FunctionExprent.FUNCTION_IIF, data.add(new ExitExprent(ifex.getExitType(), new FunctionExprent(FunctionExprent.FUNCTION_IIF,
Arrays.asList( Arrays.asList(
@ -926,9 +909,8 @@ public class SimplifyExprentsHelper {
FieldExprent fieldexpr = (FieldExprent)class14Builder.getVariableValue("$field$"); FieldExprent fieldexpr = (FieldExprent)class14Builder.getVariableValue("$field$");
assfirst.replaceExprent(assfirst.getRight(), new ConstExprent(VarType.VARTYPE_CLASS, class_name, null)); assfirst.replaceExprent(assfirst.getRight(), new ConstExprent(VarType.VARTYPE_CLASS, class_name, null));
List<Exprent> data = new ArrayList<>(); List<Exprent> data = new ArrayList<>(stat.getFirst().getExprents());
data.addAll(stat.getFirst().getExprents());
stat.setExprents(data); stat.setExprents(data);

@ -172,9 +172,8 @@ public class ExceptionDeobfuscator {
BasicBlock emptyblock = new BasicBlock(++graph.last_id); BasicBlock emptyblock = new BasicBlock(++graph.last_id);
graph.getBlocks().addWithKey(emptyblock, emptyblock.id); graph.getBlocks().addWithKey(emptyblock, emptyblock.id);
List<BasicBlock> lstTemp = new ArrayList<>();
// only exception predecessors considered // only exception predecessors considered
lstTemp.addAll(handler.getPredExceptions()); List<BasicBlock> lstTemp = new ArrayList<>(handler.getPredExceptions());
// replace predecessors // replace predecessors
for (BasicBlock pred : lstTemp) { for (BasicBlock pred : lstTemp) {

@ -413,8 +413,7 @@ public class FunctionExprent extends Exprent {
@Override @Override
public List<Exprent> getAllExprents() { public List<Exprent> getAllExprents() {
List<Exprent> lst = new ArrayList<>(); List<Exprent> lst = new ArrayList<>(lstOperands);
lst.addAll(lstOperands);
return lst; return lst;
} }

Loading…
Cancel
Save