fix: add rename reason for method merged with bridge (#1876)

This commit is contained in:
Skylot
2023-05-20 14:06:31 +01:00
parent ed4c5a3a17
commit 67054bda3d
2 changed files with 6 additions and 4 deletions
@@ -14,6 +14,7 @@ import jadx.core.dex.attributes.AFlag;
import jadx.core.dex.attributes.AType;
import jadx.core.dex.attributes.nodes.FieldReplaceAttr;
import jadx.core.dex.attributes.nodes.MethodReplaceAttr;
import jadx.core.dex.attributes.nodes.RenameReasonAttr;
import jadx.core.dex.attributes.nodes.SkipMethodArgsAttr;
import jadx.core.dex.info.AccessInfo;
import jadx.core.dex.info.ClassInfo;
@@ -276,17 +277,18 @@ public class ClassModifier extends AbstractVisitor {
}
}
// remove confirmed, change visibility and name if needed
if (!wrappedAccFlags.isPublic()) {
if (!wrappedAccFlags.isPublic() && !mth.root().getArgs().isRespectBytecodeAccModifiers()) {
// must be public
FixAccessModifiers.changeVisibility(wrappedMth, AccessFlags.PUBLIC);
}
String alias = mth.getAlias();
if (!Objects.equals(wrappedMth.getAlias(), alias)) {
wrappedMth.getMethodInfo().setAlias(alias);
wrappedMth.rename(alias);
RenameReasonAttr.forNode(wrappedMth).append("merged with bridge method [inline-methods]");
}
wrappedMth.addAttr(new MethodReplaceAttr(mth));
wrappedMth.copyAttributeFrom(mth, AType.METHOD_OVERRIDE);
wrappedMth.addDebugComment("Method merged with bridge method");
wrappedMth.addDebugComment("Method merged with bridge method: " + mth.getMethodInfo().getShortId());
return true;
}
@@ -602,7 +602,7 @@ public class JadxSettingsWindow extends JDialog {
other.addRow(NLS.str("preferences.useImports"), useImports);
other.addRow(NLS.str("preferences.useDebugInfo"), useDebugInfo);
other.addRow(NLS.str("preferences.inlineAnonymous"), inlineAnonymous);
other.addRow(NLS.str("preferences.inlineMethods"), moveInnerClasses);
other.addRow(NLS.str("preferences.inlineMethods"), inlineMethods);
other.addRow(NLS.str("preferences.inlineKotlinLambdas"), inlineKotlinLambdas);
other.addRow(NLS.str("preferences.moveInnerClasses"), moveInnerClasses);
other.addRow(NLS.str("preferences.extractFinally"), extractFinally);