Avoid set.removeAll(list)

GitOrigin-RevId: 6ed9b1ee1df87618c9b8c534e328ea89ead9fdc3
master
Tagir Valeev 4 years ago committed by intellij-monorepo-bot
parent 7f65f48b3f
commit 143e2396ae
  1. 15
      src/org/jetbrains/java/decompiler/modules/code/DeadCodeHelper.java
  2. 4
      src/org/jetbrains/java/decompiler/modules/decompiler/StrongConnectivityHelper.java

@ -267,7 +267,9 @@ public final class DeadCodeHelper {
for (BasicBlock block : range.getProtectedRange()) {
setPreds.addAll(block.getPreds());
}
setPreds.removeAll(range.getProtectedRange());
for (BasicBlock basicBlock : range.getProtectedRange()) {
setPreds.remove(basicBlock);
}
if(setPreds.size() != 1) {
continue; // multiple predecessors, obfuscated range
@ -280,8 +282,7 @@ public final class DeadCodeHelper {
}
boolean monitorexit_in_range = false;
Set<BasicBlock> setProtectedBlocks = new HashSet<>();
setProtectedBlocks.addAll(range.getProtectedRange());
Set<BasicBlock> setProtectedBlocks = new HashSet<>(range.getProtectedRange());
setProtectedBlocks.add(range.getHandler());
for (BasicBlock block : setProtectedBlocks) {
@ -305,7 +306,9 @@ public final class DeadCodeHelper {
for (BasicBlock block : range.getProtectedRange()) {
setSuccs.addAll(block.getSuccs());
}
setSuccs.removeAll(range.getProtectedRange());
for (BasicBlock basicBlock : range.getProtectedRange()) {
setSuccs.remove(basicBlock);
}
if(setSuccs.size() != 1) {
continue; // non-unique successor
@ -461,7 +464,9 @@ public final class DeadCodeHelper {
}
// add exception ranges from predecessors
setPredHandlersIntersection.removeAll(block.getSuccExceptions());
for (BasicBlock basicBlock : block.getSuccExceptions()) {
setPredHandlersIntersection.remove(basicBlock);
}
BasicBlock predecessor = block.getPreds().get(0);
for (BasicBlock handler : setPredHandlersIntersection) {

@ -90,7 +90,9 @@ public class StrongConnectivityHelper {
for (Statement stat : lst) {
set.addAll(stat.getNeighbours(StatEdge.TYPE_REGULAR, Statement.DIRECTION_FORWARD));
}
set.removeAll(lst);
for (Statement stat : lst) {
set.remove(stat);
}
return (set.size() == 0);
}

Loading…
Cancel
Save