@UtilityClass should produce a compiler error, when put on a non-static inner class #3778
Labels
parked
Without further feedback this bug cannot be processed. If no feedback is provided, we close these.
TLDR
When adding
@UtilityClass
on a non-static inner class with Java 21, then this causes VM crashes and other non-obvious problems.If u add the
static
modifier, it works (for me).See my stripped down reproduction repo @ https://github.com/tomsit-ionos/lombok-utilclass-bug
Also notice that the intellij decompiler is not able to open generated class-file and i verified this also with an online decompiler.
Long story
For me it was a nested class inside a record.
It took me a good day to figure out what's going on b/c i ran into this while upgrade a keycloak extension from KC 25 -> 26.
This set me on the wrong mental path and i was guessing there were some wired upgrade problems at play.
To add to the fun:
The nested class didnt pose a problem for non-testcontainer junit tests using that inner class, ie. these were green!
But only with the intellij junit runner -- which is what I typically use, while working on code, due to the better DX.
What i failed to notice was, that theses normal tests failed when executed by
mvn test
(e.g. on CI) with this message:Originally posted by @tomsit-ionos in #3679 (comment)
The text was updated successfully, but these errors were encountered: