abcl
abcl copied to clipboard
jnew-runtime-class annotations don't work on JDK 17
ABCL 1.8.0
JDK8:
CL-USER(6): (jcall "getAnnotations" (jnew-runtime-class "Foo" :annotations '("java.lang.Deprecated")))
#(#<com.sun.proxy.$Proxy1 @java.lang.Deprecated() {36FA8CB3}>)
JDK11:
CL-USER(6): (jcall "getAnnotations" (jnew-runtime-class "Foo" :annotations '("java.lang.Deprecated")))
#(#<com.sun.proxy.$Proxy1 @java.lang.Deprecated() {36FA8CB3}>)
JDK17:
CL-USER(3): (jcall "getAnnotations" (jnew-runtime-class "Foo" :annotations '("java.lang.Deprecated")))
#<THREAD "interpreter" {1796E846}>: Debugger invoked on condition of type JAVA-EXCEPTION
Java exception 'java.lang.annotation.AnnotationFormatError: java.lang.IllegalArgumentException: Wrong type at constant pool index'.
Looks like something to do with the byte code generation.
Maybe this is related? https://www.oracle.com/java/technologies/javase/17-relnote-issues.html#JDK-8265591 https://bugs.openjdk.java.net/browse/JDK-8265591
Stacktrace matches the JDK Git diff: (line 240) (It expects an utf-8, but encounters a class)
Caused by: java.lang.IllegalArgumentException: Wrong type at constant pool index
at java.base/jdk.internal.reflect.ConstantPool.getUTF8At0(Native Method)
at java.base/jdk.internal.reflect.ConstantPool.getUTF8At(ConstantPool.java:66)
at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:240)
at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:121)
at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:73)
... 65 more