fix: resolve minor decompilation issues (#2835)
This commit is contained in:
@@ -127,18 +127,25 @@ public class BlockProcessor extends AbstractVisitor {
|
||||
}
|
||||
|
||||
private static void checkForUnreachableBlocks(MethodNode mth) {
|
||||
for (BlockNode block : mth.getBasicBlocks()) {
|
||||
if (block.getPredecessors().isEmpty() && block != mth.getEnterBlock()) {
|
||||
// Sometimes a split cross block will have all it's predecessors moved elsewhere after it's been
|
||||
// created. This is usually detected at the time of it's creation, but in certain edge cases it
|
||||
// is difficult to do so. In those cases it will be cleanly removed here, along with the associated
|
||||
// bottom splitter.
|
||||
if (block.contains(AType.EXC_SPLIT_CROSS) && fixUnreachableSplitCross(mth, block)) {
|
||||
mth.addInfoComment("Removed unreachable split cross block " + block.toString());
|
||||
} else {
|
||||
while (true) {
|
||||
boolean fixed = false;
|
||||
for (BlockNode block : mth.getBasicBlocks()) {
|
||||
if (block.getPredecessors().isEmpty() && block != mth.getEnterBlock()) {
|
||||
// Sometimes a split cross block will have all it's predecessors moved elsewhere after it's been
|
||||
// created. This is usually detected at the time of it's creation, but in certain edge cases it
|
||||
// is difficult to do so. In those cases it will be cleanly removed here, along with the associated
|
||||
// bottom splitter.
|
||||
if (block.contains(AType.EXC_SPLIT_CROSS) && fixUnreachableSplitCross(mth, block)) {
|
||||
mth.addInfoComment("Removed unreachable split cross block " + block);
|
||||
fixed = true;
|
||||
break;
|
||||
}
|
||||
throw new JadxRuntimeException("Unreachable block: " + block);
|
||||
}
|
||||
}
|
||||
if (!fixed) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +166,6 @@ public class BlockProcessor extends AbstractVisitor {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bottomSplitter == null || bottomSplitter.getPredecessors().size() != 1) {
|
||||
return false;
|
||||
}
|
||||
@@ -167,7 +173,6 @@ public class BlockProcessor extends AbstractVisitor {
|
||||
removeSet.add(bottomSplitter);
|
||||
removeSet.add(splitCross);
|
||||
removeFromMethod(removeSet, mth);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package jadx.core.dex.visitors.regions;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import jadx.core.dex.attributes.AType;
|
||||
@@ -9,7 +8,6 @@ import jadx.core.dex.nodes.BlockNode;
|
||||
import jadx.core.dex.nodes.IContainer;
|
||||
import jadx.core.dex.nodes.IRegion;
|
||||
import jadx.core.dex.nodes.InsnContainer;
|
||||
import jadx.core.dex.nodes.InsnNode;
|
||||
import jadx.core.dex.nodes.MethodNode;
|
||||
import jadx.core.dex.regions.Region;
|
||||
import jadx.core.dex.regions.SwitchRegion;
|
||||
@@ -60,8 +58,7 @@ public final class PostProcessRegions extends AbstractRegionVisitor {
|
||||
return;
|
||||
}
|
||||
}
|
||||
List<InsnNode> insns = Collections.singletonList(insnAttr.getInsn());
|
||||
region.add(new InsnContainer(insns));
|
||||
region.add(new InsnContainer(insnAttr.getInsn()));
|
||||
}
|
||||
|
||||
private PostProcessRegions() {
|
||||
|
||||
Reference in New Issue
Block a user