Using records (preview feature java-14) in a jlink:ed application, gives below error when using options:
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
java.lang.ClassFormatError: Invalid constant pool index 11 for name in Record attribute in class file 
myproj/MyClass$MyRecord
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
    at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
                I suggest you to try with JDK-15 which has an updated version of ASM  (ASM 8.0.1) which have support for records. That should fix your issue. This is the bug report that relates to the update to ASM (ASM 8.0.1): JDK-8241627. This version of ASM was not available while we were developing JDK 14. I've never seen a backport of ASM to a previous JDK version, and considering that records are a preview feature...
I can reproduce this issue with a simple "hello world" module that uses record feature along with JDK-14. 
On the other hand with JDK-15 build (built from the source repo), it just works fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With