From afdd37cd97b647b70f00d5990c6ce4c4acddb4ca Mon Sep 17 00:00:00 2001 From: Skylot Date: Wed, 15 Dec 2021 12:24:37 +0000 Subject: [PATCH] fix: add comments with option references to improve usability --- .../java/jadx/core/codegen/MethodGen.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/jadx-core/src/main/java/jadx/core/codegen/MethodGen.java b/jadx-core/src/main/java/jadx/core/codegen/MethodGen.java index b815a24ab..10aa04f59 100644 --- a/jadx-core/src/main/java/jadx/core/codegen/MethodGen.java +++ b/jadx-core/src/main/java/jadx/core/codegen/MethodGen.java @@ -111,7 +111,18 @@ public class MethodGen { CodeGenUtils.addRenamedComment(code, mth, mth.getName()); } if (mth.contains(AFlag.INCONSISTENT_CODE) && mth.checkCommentsLevel(CommentsLevel.ERROR)) { - code.startLine("/* Code decompiled incorrectly, please refer to instructions dump */"); + code.startLine("/*"); + code.incIndent(); + code.startLine("Code decompiled incorrectly, please refer to instructions dump."); + if (!mth.root().getArgs().isShowInconsistentCode()) { + if (code.isMetadataSupported()) { + code.startLine("To view partially-correct code enable 'Show inconsistent code' option in preferences"); + } else { + code.startLine("To view partially-correct add '--show-bad-code' argument"); + } + } + code.decIndent(); + code.startLine("*/"); } code.startLineWithNum(mth.getSourceLine()); @@ -314,7 +325,14 @@ public class MethodGen { .filter(insn -> insn.getType() != InsnType.NOP) .count(); if (insnCountEstimate > 100) { - code.startLine("// Method dump skipped, instructions count: " + insnArr.length); + code.incIndent(); + code.startLine("Method dump skipped, instructions count: " + insnArr.length); + if (code.isMetadataSupported()) { + code.startLine("To view this dump change 'Code comments level' option to 'DEBUG'"); + } else { + code.startLine("To view this dump add '--comments-level debug' option"); + } + code.decIndent(); return; } }