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)
Assuming the end goal is to reduce the size of the custom Java runtime image, an option on JDK14 (Linux only) is to only remove the native debug symbols (where the fat really is!) and keep the Java debug attributes (to avoid the current ASM issue) by using ā-strip-native-debug-symbols
.
See https://delabassee.com/StrippingDebug-Jlink/ for some details.