Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MappingSet#deobfuscate is called twice for return types #53

Closed
jpenilla opened this issue Oct 23, 2021 · 1 comment
Closed

MappingSet#deobfuscate is called twice for return types #53

jpenilla opened this issue Oct 23, 2021 · 1 comment
Assignees
Labels
Milestone

Comments

@jpenilla
Copy link

The following method is only used when remapping the return type of method signatures. It looks to me like the intention of the method was to remap if the given Type is a FieldType, and simply return the given type if it's not a FieldType (i.e. Void). But for some reason it calls deobfuscate a second time on the result of the first deobfuscate call. Again, this method is only used for return types, for parameter types the FieldType-accepting deobfuscate method is called directly.

public Type deobfuscate(final Type type) {
if (type instanceof FieldType) {
return this.deobfuscate(this.deobfuscate((FieldType) type));
}
return type;
}

With certain mapping sets, this causes deobfuscate to give invalid results. This was observed when trying to call reverse on a MappingSet containing class mappings like the following:

BinaryHeap -> Path
Path -> PathEntity

any mappings which had PathEntity as the return type were changed to have BinaryHeap as the return type in the reversed mappings.

Using my own reverse and deobfuscate methods which call deobfuscate(FieldType) only once fixed the issue for me, but given I'm not sure why it's remapping twice, I'm hesitant to call it the "proper" fix, so I haven't opened a PR.

@jamierocks
Copy link
Member

Yeah, this looks like a derp on my behalf (I assume I wrote that code anyway).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants