jabel icon indicating copy to clipboard operation
jabel copied to clipboard

`@Desugar` does not strip out `Record` attributes, resulting in ASM treating those classes as `record`s.

Open Nikolay-Sitnikov opened this issue 6 months ago • 0 comments

The Record attribute specifies the record fields of the class: https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-4.html#jvms-4.7.30

When observing a @Desugared record with javap -c -v, the following lines were printed at the end of the output:

InnerClasses:
  static #10;                             // class dev/rndmorris/salisarcana/common/recipes/ReplaceWandCoreRecipe$1
SourceFile: "ReplaceWandCoreRecipe.java"
Record:
  net.minecraft.item.ItemStack wandItem;
    descriptor: Lnet/minecraft/item/ItemStack;

  thaumcraft.api.wands.WandRod newRod;
    descriptor: Lthaumcraft/api/wands/WandRod;

  int screws;
    descriptor: I

  int conductors;
    descriptor: I

This should not be present, since this class should not be a record.

This is causing problems, because ASM will throw an error & prevent class loading if an ASM transformer with too low of a specified version encounters a record, which causes the program to crash when it encounters @Desugared records.

Nikolay-Sitnikov avatar Jul 28 '25 04:07 Nikolay-Sitnikov