PatternHandle in record

Remi Forax forax at
Thu Oct 10 10:37:55 UTC 2019

Hi all,
ASM doesn't like too much weird method names,
exactly the ASMifier, that take a binary class and generate the Java code that will create the same binary class, doesn't work well with the method named "\%pattern\%RecordSubType\%(ILjava\|lang\|String\?)".

I have two questions:
- why do we need a description of a pattern inside a record class given that the Record attribute already provides that description (that is accessible using Class.getRecordComponents()) ?
  A record is already able to describe itself, that's its purpose, why do we need another way of describing it ?
- why the method that return a PatternHandle is using a mangled name like this ?
  Given that the constant dynamic also use the same encoding ??


public static java.lang.runtime.PatternHandle \%pattern\%RecordSubType\%(ILjava\|lang\|String\?)();
    descriptor: ()Ljava/lang/runtime/PatternHandle;
    flags: (0x0009) ACC_PUBLIC, ACC_STATIC
      stack=1, locals=0, args_size=0
         0: ldc           #29                 // Dynamic #1:"\\%pattern\\%RecordSubType\\%(ILjava\\|lang\\|String\\?)":Ljava/lang/runtime/PatternHandle;
         2: areturn
        line 9: 0

More information about the amber-spec-experts mailing list