MinecraftForge / AccessTransformers

Antlr4 definition for MCP / Forge Access Transformers
GNU Lesser General Public License v2.1
14 stars 12 forks source link

Public AT entries are overriding Public-f entries #8

Closed Shadows-of-Fire closed 5 years ago

Shadows-of-Fire commented 5 years ago

Somehow it would appear that public entries are able to override public-f even though public-f entries should have precedence.

This is evident if you install Quark and Toast Control in the same instance. Quark has the following AT line https://github.com/Vazkii/Quark/blob/master/src/main/resources/META-INF/accesstransformer.cfg#L10

And Toast Control has the same line with -f added https://github.com/Shadows-of-Fire/Toast-Control/blob/1.14/src/main/resources/META-INF/accesstransformer.cfg#L3

The toast control AT is not applied when quark is present in the instance, resulting in the following error https://gist.github.com/Boomflex/ef61e5bd8a85ac3f9ce0452ffd6ebda0#file-gistfile1-txt-L2110

Which occurs because the toastsQueue field is still final when this assignment is invoked https://github.com/Shadows-of-Fire/Toast-Control/blob/1.14/src/main/java/shadows/toaster/BetterGuiToast.java#L18

Shadows-of-Fire commented 5 years ago

Likely being caused by this line https://github.com/MinecraftForge/AccessTransformers/blob/master/src/main/java/net/minecraftforge/accesstransformer/AccessTransformer.java#L35

Which, when given the states LEAVE and REMOVEFINAL, performs 0b00 & 0b10 -> 0b00, which is not desired behavior, as it gives LEAVE precedence.

tterrag1098 commented 5 years ago

Seems to me the solution is to simply change that & to |

Shadows-of-Fire commented 5 years ago

Probably. Since it seems the intended behavior is LEAVE + (MAKEFINAL or REMOVEFINAL) yields to the edit, and MAKE + REMOVE should yield CONFLICT.