-
Notifications
You must be signed in to change notification settings - Fork 22
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
Flaw in generic mapping #1
Comments
An internal Stitch branch now performs bridge lookup. The question is: Should this change be introduced on the 19w update? Does it have the potential to break any existing mod? |
If you take the simplest example of calling the methods: Serializer testA = new Serializer();
testA.read(new Identifier(""), new JsonObject());
testA.method_8142(new Identifier(""), new JsonObject()); The first call will get obfuscated back to the interface's name ( This is only a problem if the concrete types have been used too: RecipeSerializer<ShapelessRecipe> testB = new Serializer();
testB.read(new Identifier(""), new JsonObject()); Would get obfuscated to As for actually extending the types, due to the clunky naming Java already doesn't see them as actually implementing the interfaces: public class Test extends Serializer {
@Override
public ShapelessRecipe read(Identifier var1, JsonObject var2) {
// TODO Auto-generated method stub
return null;
}
@Override
public ShapelessRecipe read(Identifier var1, PacketByteBuf var2) {
// TODO Auto-generated method stub
return null;
}
@Override
public void write(PacketByteBuf var1, ShapelessRecipe var2) {
// TODO Auto-generated method stub
} Is what you get when Eclipse automatically fills the missing methods, ie the interface's names with the proper generic signatures. The generated bridges override correctly too, so the only issue people would have is if they called the concrete methods directly rather than using the interface's abstract methods. |
I think its best to stall this for the first 19w update, or hopefully an 18w50b (though unlikely). |
Implemented. Awaiting snapshot. |
Not done, see discussion in #2 |
Wow this hasn't been touched since 2018 lol |
Synthetic bridges methods, most commonly seen from implementing generic supertypes, are not logically mapped to be deobfuscated. Taking
azb$a
=>class_1867$class_1868
=>ShapelessRecipe$Serializer
(which extendsayy
=>class_1862
=>RecipeSerializer
) as an example:a(Lit;Layw;)V
fora(Lit;Lazb;)V
class_1862#method_8124
) and maps the actual method tomethod_8143
method_8124
(as Yarn does) carries over to the mapping (here)method_8143
This process is masked from decompiling hiding bridge methods by default, but the same effect is visibly present from other methods:
b(Lqc;Lit;)Layw;
fora(Lqc;Lit;)Lazb;
method_8122
) and maps the actual method tomethod_8141
read
bouncing to an unmappedmethod_8141
Practically speaking as it stands nothing appears to break from this (after all, Mojang uses different names of
a
andb
), but hiding the synthetic methods as decompilers often do results in classes appearing to not consistently implement interfaces.This also leaves the door open for the implementing method name to differ from the interface it is implementing, purely as they have different Intermediary names and nothing forces them to be the same. Enigma will happily let you do this as to it they are different methods. Whilst again this isn't technically wrong from the JVM's point of view, you could never write Java code that would naturally compile like that (as well as the decompile having no chance of recompiling).
If the actual methods that are bridged to shared the same Intermediary name as the bridges (and thus the original interface) this would go away as the whole system would change together. Doesn't fix Yarn's problems from mapping to Notch directly, but that is arguably an Enigma problem.
The text was updated successfully, but these errors were encountered: