未验证 提交 49fa3209 编写于 作者: S Skylot

fix: handle possible concurrent exception in method codegen (#1685)

上级 2f301bf1
...@@ -322,19 +322,25 @@ public class ClassGen { ...@@ -322,19 +322,25 @@ public class ClassGen {
if (inlineAttr == null || inlineAttr.notNeeded()) { if (inlineAttr == null || inlineAttr.notNeeded()) {
return false; return false;
} }
if (mth.getUseIn().isEmpty()) { try {
mth.add(AFlag.DONT_GENERATE); if (mth.getUseIn().isEmpty()) {
return true; mth.add(AFlag.DONT_GENERATE);
} return true;
List<MethodNode> useInCompleted = mth.getUseIn().stream() }
.filter(m -> m.getTopParentClass().getState().isProcessComplete()) List<MethodNode> useInCompleted = mth.getUseIn().stream()
.collect(Collectors.toList()); .filter(m -> m.getTopParentClass().getState().isProcessComplete())
if (useInCompleted.isEmpty()) { .collect(Collectors.toList());
mth.add(AFlag.DONT_GENERATE); if (useInCompleted.isEmpty()) {
return true; 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() { private boolean isMethodsPresents() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册