raphw / byte-buddy

Runtime code generation for the Java virtual machine.
https://bytebuddy.net
Apache License 2.0
6.31k stars 808 forks source link

JDK 23 Valhalla-EA: IllegalState Illegal modifiers 33 for class #1685

Closed wendigo closed 2 months ago

wendigo commented 4 months ago

I know that it's pretty early for supporting Valhalla but I'm conducting a research into its' capabilities and I'm facing an issue with the latest byte-buddy version being unable to load 23-ea Valhalla class format (with --enable-preview). Is this something that can be disabled?

java.lang.IllegalStateException: Illegal modifiers 33 for class io.trino.plugin.accumulo.conf.AccumuloConfig$ByteBuddy$XNyr3RcL
    at net.bytebuddy.dynamic.scaffold.InstrumentedType$Default.validated(InstrumentedType.java:1555)
    at net.bytebuddy.dynamic.scaffold.MethodRegistry$Default.prepare(MethodRegistry.java:519)
    at net.bytebuddy.dynamic.scaffold.subclass.SubclassDynamicTypeBuilder.toTypeWriter(SubclassDynamicTypeBuilder.java:212)
    at net.bytebuddy.dynamic.scaffold.subclass.SubclassDynamicTypeBuilder.toTypeWriter(SubclassDynamicTypeBuilder.java:203)
    at net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase$UsingTypeWriter.make(DynamicType.java:4055)
    at net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase.make(DynamicType.java:3739)
    at net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase$Delegator.make(DynamicType.java:3991)
    at io.airlift.configuration.testing.ConfigAssertions.recordDefaults(ConfigAssertions.java:287)
    at io.trino.plugin.accumulo.conf.TestAccumuloConfig.testDefaults(TestAccumuloConfig.java:33)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:194)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:507)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.tryRemoveAndExec(ForkJoinPool.java:1534)
    at java.base/java.util.concurrent.ForkJoinPool.helpJoin(ForkJoinPool.java:2269)
    at java.base/java.util.concurrent.ForkJoinTask.awaitDone(ForkJoinTask.java:495)
    at java.base/java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:662)
    at java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:194)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:507)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1491)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:2073)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2035)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:189)
raphw commented 3 months ago

Yes, you can disable validation using: new Byte Buddy().with(TypeValidation.DISABLED). I just tried this myself, though and I cannot produce the same modifiers. Are you running an outdated version? I get an issue for fields, though. If you build Byte Buddy from master, I added a property to disable type validation unless explicitly specified:

-Dnet.bytebuddy.validation=false

You can then try with that flag and the latest version, in case you are not using Byte Buddy directly.

wendigo commented 3 months ago

@raphw great! This will allow us to move forward with testing EA builds :) Appreciate the quick turnaround!