Skip to content

Commit

Permalink
fix: handle possible concurrent exception in method codegen (#1685)
Browse files Browse the repository at this point in the history
  • Loading branch information
skylot committed Sep 29, 2022
1 parent 2f301bf commit 49fa320
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions jadx-core/src/main/java/jadx/core/codegen/ClassGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -322,19 +322,25 @@ private boolean skipMethod(MethodNode mth) {
if (inlineAttr == null || inlineAttr.notNeeded()) {
return false;
}
if (mth.getUseIn().isEmpty()) {
mth.add(AFlag.DONT_GENERATE);
return true;
}
List<MethodNode> useInCompleted = mth.getUseIn().stream()
.filter(m -> m.getTopParentClass().getState().isProcessComplete())
.collect(Collectors.toList());
if (useInCompleted.isEmpty()) {
mth.add(AFlag.DONT_GENERATE);
return true;
try {
if (mth.getUseIn().isEmpty()) {
mth.add(AFlag.DONT_GENERATE);
return true;
}
List<MethodNode> useInCompleted = mth.getUseIn().stream()
.filter(m -> m.getTopParentClass().getState().isProcessComplete())
.collect(Collectors.toList());
if (useInCompleted.isEmpty()) {
mth.add(AFlag.DONT_GENERATE);
return true;
}
mth.addDebugComment("Method not inlined, still used in: " + useInCompleted);
return false;
} catch (Exception e) {
// check failed => keep method
mth.addWarnComment("Failed to check method usage", e);
return false;
}
mth.addDebugComment("Method not inlined, still used in: " + useInCompleted);
return false;
}

private boolean isMethodsPresents() {
Expand Down

0 comments on commit 49fa320

Please sign in to comment.