cabe icon indicating copy to clipboard operation
cabe copied to clipboard

Adding assertions to records results in invalid class files

Open xzel23 opened this issue 1 year ago • 2 comments

Injecting the static initializer into the class file seems to work, but the generated classfile cannot be loaded into the JVM, see javassist#481.

xzel23 avatar Jan 20 '24 19:01 xzel23

added workaround: check for null and throw NPE instead of generating assertions when class is a record.

xzel23 avatar Jan 21 '24 08:01 xzel23

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.

xzel23 avatar Oct 23 '24 12:10 xzel23