Cannot parse records with multiple TYPE_USE annotations when presented by retransformation.
When a record class is parsed by ASM after it is supplied via a ClassFileTransformer, the byte code can no longer be parsed by ASM. It can however be processed by javap without issues (class files attached). The stack is as follows:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at org.objectweb.asm.Attribute.read(Attribute.java:130)
at org.objectweb.asm.ClassReader.readAttribute(ClassReader.java:3535)
at org.objectweb.asm.ClassReader.readRecordComponent(ClassReader.java:938)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:731)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:424)
at net.bytebuddy.Foo.main(Foo.java:13)
Is there an issue in ASM or is the JVM issuing incorrect byte code for the record when it is retransformed? The record is rather simple as follows:
import org.jetbrains.annotations.NotNull;
public record TestRecord(@NotNull String abc, @NotNull String def) { }
original.class contains the content procuded by javac, output.class is what the instrumentation API makes out of it.