i want to make class:
class Clazz<T>{
T[] value;
}
TypeDescription.Generic t1 = TypeDescription.Generic.Builder.typeVariable("T").asArray().build();
new ByteBuddy().subclass(Object.class)
.typeVariable("T")
.defineField("value", t1, Modifier.PUBLIC)
.make()
but i get exception
Exception in thread "main" java.lang.IllegalStateException: A symbolic type variable does not imply an erasure: T
at net.bytebuddy.description.type.TypeDescription$Generic$OfTypeVariable$Symbolic.asErasure(TypeDescription.java:5802)
how i can make T[] field?
You stumbled upon a bug. Byte Buddy attempts to resolve TargetType references to identify the instrumented type's self type which is not done correctly for generic arrays. It will be fixed in the next version 1.10.11.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With