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

@Shadow with L gets dropped #134

Closed
Gaming32 opened this issue Mar 16, 2024 · 0 comments · Fixed by #154
Closed

@Shadow with L gets dropped #134

Gaming32 opened this issue Mar 16, 2024 · 0 comments · Fixed by #154

Comments

@Gaming32
Copy link

Gaming32 commented Mar 16, 2024

If you use @Shadow on a field that starts with L with refmap remapping, the L will get dropped. This can be seen by depending on Create: Steam n' Rails in a development environment.

The issue is that MemberInfo.parse checks for semicolons before colons. LONG_CROSS key gets pulled out of the refmap (using Steam n' Rails as an example here) as LONG_CROSS:Lnet/minecraft/class_265;. So far so good. Then MemberInfo.parse sees that the value starts with an L and contains a semicolon. It decides that the owner is "ONG_CROSS:Lnet/minecraft/class_265" and the name is "". RemappingReferenceMapper then sees that the owner is non-null and the name is null. It then remaps the owner by itself, and converts the resulting MemberInfo to a string. This leaves us with a remapped name of ONG_CROSS:Lnet/minecraft/class_265. However, MemberInfo.parse (which is what invoked the remapping; AccessorInfo.inflectTarget -> TargetSelector.parseName -> TargetSelector.parse -> MemberInfo.parse) isn't done. It sees this remapped ONG_CROSS:Lnet/minecraft/class_265, finds no L or semicolon, splits it on :, leaving a descriptor of Lnet/minecraft/class_265 and a name of ONG_CROSS, drops the descriptor to get the name, leaving us with ONG_CROSS.

This can be fixed by moving the colon and left parenthesis checks before the semicolon check in MemberInfo.parse.

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

Successfully merging a pull request may close this issue.

1 participant