Skip to content

Commit

Permalink
Reproducer of raphw/byte-buddy#1732
Browse files Browse the repository at this point in the history
  • Loading branch information
Justinas Dabravolskas committed Dec 8, 2024
1 parent 8111aab commit b8c21bc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# 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

ByteBuddy sporadically runs into an "impossible" exception in `net.bytebuddy.dynamic.scaffold.TypeWriter.Default.ValidatingClassVisitor.visitField`.
This code path can happen just with switch statement skipping all branches including default.
In general this condition is rare, but running `org.example.App with` `-Xcomp` reliably reproduces this condition on `Java 18-23`.


`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)
Expand Down

0 comments on commit b8c21bc

Please sign in to comment.