From 8111aab8c9b5d0f38473c6a852dbd50802a5a387 Mon Sep 17 00:00:00 2001 From: Justinas Dabravolskas Date: Sun, 8 Dec 2024 08:31:50 -0500 Subject: [PATCH] Reproducer of https://github.com/raphw/byte-buddy/issues/1732 --- README.md | 18 ++++++++++++++++++ settings.gradle | 14 ++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 settings.gradle diff --git a/README.md b/README.md index 52e2c72..8a4e43b 100644 --- a/README.md +++ b/README.md @@ -1 +1,19 @@ # jit-broken-switch-example + +Running App with -Xcomp flag on Java 18-23 causes "impossible" exception in ByteBuddy. +This exception can happen just with non executed default branch of switch statement. +Original discussion in https://github.com/raphw/byte-buddy/issues/1732 +`Exception in thread "main" java.lang.IllegalStateException: Field POOL_NORMAL defines an incompatible default value 0 +at net.bytebuddy.dynamic.scaffold.TypeWriter$Default$ValidatingClassVisitor.visitField(TypeWriter.java:2535) +at net.bytebuddy.dynamic.scaffold.TypeWriter$Default$ForInlining$WithFullProcessing$RedefinitionClassVisitor.onVisitField(TypeWriter.java:5164) +at net.bytebuddy.utility.visitor.MetadataAwareClassVisitor.visitField(MetadataAwareClassVisitor.java:278) +at net.bytebuddy.jar.asm.ClassVisitor.visitField(ClassVisitor.java:356) +at net.bytebuddy.jar.asm.commons.ClassRemapper.visitField(ClassRemapper.java:169) +at net.bytebuddy.jar.asm.ClassReader.readField(ClassReader.java:1138) +at net.bytebuddy.jar.asm.ClassReader.accept(ClassReader.java:740) +at net.bytebuddy.utility.AsmClassReader$Default.accept(AsmClassReader.java:132) +at net.bytebuddy.dynamic.scaffold.TypeWriter$Default$ForInlining.create(TypeWriter.java:4039) +at net.bytebuddy.dynamic.scaffold.TypeWriter$Default.make(TypeWriter.java:2246) +at net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase$UsingTypeWriter.make(DynamicType.java:4085) +at net.bytebuddy.dynamic.DynamicType$Builder$AbstractBase.make(DynamicType.java:3769) +at org.example.App.main(App.java:20)` \ No newline at end of file diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..b3fa399 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,14 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * The settings file is used to specify which projects to include in your build. + * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.11.1/userguide/multi_project_builds.html in the Gradle documentation. + */ + +plugins { + // Apply the foojay-resolver plugin to allow automatic download of JDKs + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0' +} + +rootProject.name = 'jit-broken-switch-example' +include('app')