Stream.sum() used (via StreamApiMigrationInspection); cleanup

master
Tagir Valeev 8 years ago
parent 947fae191f
commit bc728c9daf
  1. 7
      src/org/jetbrains/java/decompiler/modules/decompiler/EliminateLoopsHelper.java
  2. 8
      src/org/jetbrains/java/decompiler/modules/decompiler/deobfuscator/IrreducibleCFGDeobfuscator.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2000-2014 JetBrains s.r.o. * Copyright 2000-2016 JetBrains s.r.o.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -135,10 +135,7 @@ public class EliminateLoopsHelper {
statLabeled.put(st.id, LowBreakHelper.isBreakEdgeLabeled(lstBreakEdges.get(i).getSource(), st) | statLabeled.get(st.id)); statLabeled.put(st.id, LowBreakHelper.isBreakEdgeLabeled(lstBreakEdges.get(i).getSource(), st) | statLabeled.get(st.id));
} }
int postcount = 0; int postcount = statLabeled.values().stream().mapToInt(val -> val ? 1 : 0).sum();
for (Boolean val : statLabeled.values()) {
postcount += val ? 1 : 0;
}
if (precount <= postcount) { if (precount <= postcount) {
return false; return false;

@ -1,5 +1,5 @@
/* /*
* Copyright 2000-2015 JetBrains s.r.o. * Copyright 2000-2016 JetBrains s.r.o.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -172,15 +172,13 @@ public class IrreducibleCFGDeobfuscator {
private static int getStatementSize(Statement statement) { private static int getStatementSize(Statement statement) {
int res = 0; int res;
if (statement.type == Statement.TYPE_BASICBLOCK) { if (statement.type == Statement.TYPE_BASICBLOCK) {
res = ((BasicBlockStatement)statement).getBlock().getSeq().length(); res = ((BasicBlockStatement)statement).getBlock().getSeq().length();
} }
else { else {
for (Statement stat : statement.getStats()) { res = statement.getStats().stream().mapToInt(IrreducibleCFGDeobfuscator::getStatementSize).sum();
res += getStatementSize(stat);
}
} }
return res; return res;

Loading…
Cancel
Save