cabe
cabe copied to clipboard
Adding assertions to records results in invalid class files
Injecting the static initializer into the class file seems to work, but the generated classfile cannot be loaded into the JVM, see javassist#481.
added workaround: check for null and throw NPE instead of generating assertions when class is a record.
This might be related to https://bugs.openjdk.org/browse/JDK-8247517. Cabe currently injects the field and a static initializer block. Maybe there's another way to do it in Javassist.