FabricMC / yarn

Libre Minecraft mappings, free to use for everyone. No exceptions.
Creative Commons Zero v1.0 Universal
927 stars 379 forks source link

Annotating in enigma #1006

Open liach opened 4 years ago

liach commented 4 years ago

Currently, the minecraft code fabric mod depends on has a few jsr305 annotations. However, these annotations are often not clear enough, such as @Nullable on the client controlled player field in the client instance (which is guaranteed to be never null if the client is executing in a game renderer, etc.).

As a result, we should probably add annotation attachment ability to enigma (preferably java 8 type annotations) and produce annotated jars for modding. Thoughts?

natanfudge commented 4 years ago

Absolutely. This would need support throughout the toolchain though. Why not use checker for what we add in the naming tools, and remap what Minecraft has to checker?

liach commented 4 years ago

We can remap some minecraft jsr elements to checker. additionally, we may need ways to remove improper minecraft annotations as well (e.g. nullable on client player field should be changed to conditional null check annotations)

natanfudge commented 4 years ago

Conditional null check annotations?

Runemoro commented 4 years ago

I disagree. Decompiled yarn code should match the vanilla code. Changes like removing @Nullable, changing access levels, etc. should be done separately by Fabric API,

liach commented 4 years ago

Fyi currently enigma itself handles changing access levels. We can store this information in yarn (as a metadata on obfuscated minecraft), but allow the annotation info to be applied selectively (i.e. currently when we use yarn, we convert enigma to tiny and use tiny; the anno info will not be in tiny (enigma only, or stored in separate data structure); and the info will be left for loom to process)