diff --git a/src/org/jetbrains/java/decompiler/code/cfg/BasicBlock.java b/src/org/jetbrains/java/decompiler/code/cfg/BasicBlock.java index 28e0ae8..2e29529 100644 --- a/src/org/jetbrains/java/decompiler/code/cfg/BasicBlock.java +++ b/src/org/jetbrains/java/decompiler/code/cfg/BasicBlock.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,16 +44,12 @@ public class BasicBlock implements IGraphNode { private List succs = new ArrayList(); - private List instrOldOffsets = new ArrayList(); + private final List instrOldOffsets = new ArrayList(); private List predExceptions = new ArrayList(); private List succExceptions = new ArrayList(); - - public BasicBlock() { - } - public BasicBlock(int id) { this.id = id; } @@ -63,11 +59,10 @@ public class BasicBlock implements IGraphNode { // ***************************************************************************** public Object clone() { + BasicBlock block = new BasicBlock(id); - BasicBlock block = new BasicBlock(); - block.id = id; block.setSeq(seq.clone()); - block.setInstrOldOffsets(new ArrayList(instrOldOffsets)); + block.instrOldOffsets.addAll(instrOldOffsets); return block; } @@ -220,10 +215,6 @@ public class BasicBlock implements IGraphNode { return instrOldOffsets; } - public void setInstrOldOffsets(List instrInds) { - this.instrOldOffsets = instrInds; - } - public List getPredecessors() { List lst = new ArrayList(preds); lst.addAll(predExceptions); diff --git a/src/org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.java b/src/org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.java index 8e66fdd..2f4761e 100644 --- a/src/org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.java +++ b/src/org/jetbrains/java/decompiler/code/cfg/ControlFlowGraph.java @@ -296,7 +296,7 @@ public class ControlFlowGraph implements CodeConstants { VBStyleCollection col = new VBStyleCollection(); InstructionSequence currseq = null; - ArrayList lstOffs = null; + List lstOffs = null; int len = startblock.length; short counter = 0; @@ -306,14 +306,11 @@ public class ControlFlowGraph implements CodeConstants { for (int i = 0; i < len; i++) { if (startblock[i] == 1) { - currentBlock = new BasicBlock(); - currentBlock.id = ++counter; + currentBlock = new BasicBlock(++counter); - currseq = new SimpleInstructionSequence(); - lstOffs = new ArrayList(); + currseq = currentBlock.getSeq(); + lstOffs = currentBlock.getInstrOldOffsets(); - currentBlock.setSeq(currseq); - currentBlock.setInstrOldOffsets(lstOffs); col.addWithKey(currentBlock, currentBlock.id); blockoffset = instrseq.getOffset(i); @@ -766,9 +763,7 @@ public class ControlFlowGraph implements CodeConstants { first = blocks.get(0); - last = new BasicBlock(); - last.id = ++last_id; - last.setSeq(new SimpleInstructionSequence()); + last = new BasicBlock(++last_id); for (BasicBlock block : blocks) { if (block.getSuccs().isEmpty()) { diff --git a/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java b/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java index 9d21784..a0698ed 100644 --- a/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java +++ b/src/org/jetbrains/java/decompiler/modules/decompiler/FinallyProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1038,7 +1038,7 @@ public class FinallyProcessor { // new empty block BasicBlock emptyblock = new BasicBlock(++graph.last_id); - emptyblock.setSeq(new SimpleInstructionSequence()); + graph.getBlocks().addWithKey(emptyblock, emptyblock.id); // add to ranges if necessary