Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| private void renameMethods(List<SkidClassNode> classes, Map<MethodSignature, String> methodMappings) { | ||
| EntityRenamerSettings methodSettings = settings.getMethodSettings(); | ||
| if (!methodSettings.isEnabled()) { | ||
| return; | ||
| } | ||
|
|
||
| ExemptManager exemptManager = skidfuscator.getExemptAnalysis(); | ||
|
|
||
| for (SkidClassNode classNode : classes) { | ||
| if (skidfuscator.getClassSource().isLibraryClass(classNode.getName()) || exemptManager.isExempt(classNode)) { | ||
| continue; | ||
| } | ||
|
|
||
| NameGenerator generator = new RadixNameGenerator(methodSettings.getAlphabet(), methodSettings.getMinLength()); | ||
| Set<String> usedNames = new HashSet<>(); | ||
|
|
||
| for (MethodNode method : classNode.getMethods()) { | ||
| SkidMethodNode skidMethod = method instanceof SkidMethodNode ? (SkidMethodNode) method : new SkidMethodNode(method.node, classNode, skidfuscator); | ||
| if (!shouldRenameMethod(skidMethod, exemptManager)) { | ||
| continue; | ||
| } | ||
|
|
||
| String newName = nextUniqueName(generator, usedNames); | ||
| methodMappings.put(new MethodSignature(classNode.getName(), skidMethod.getName(), skidMethod.node.desc), newName); | ||
| skidfuscator.getClassRemapper().add(classNode.getName() + '.' + skidMethod.getName() + skidMethod.node.desc, newName); | ||
| } | ||
| } |
There was a problem hiding this comment.
Preserve inherited method names when renaming
The current implementation renames methods per class by instantiating a fresh RadixNameGenerator and usedNames set for every SkidClassNode. Because the algorithm does not look up the mapping already applied to superclasses or interfaces, overriding methods are renamed independently. Whenever a subclass declares methods in a different order than its parent (or has extra members), the override will very likely receive a different obfuscated name than the parent implementation, breaking virtual dispatch at runtime. Consider tracking renamed signatures in a global map keyed by owner/name/descriptor and reusing the parent’s mapping before generating a new name, so overrides keep identical obfuscated names.
Useful? React with 👍 / 👎.
Summary
JvmRenamerConfig/JvmRenamerEntityConfigmodels and plumb them throughObfuscatorConfigandNativeObfuscatorTesting
https://chatgpt.com/codex/tasks/task_e_690158e8c6248332a4ad97a6d3d555d6