Ignore:
Timestamp:
11/27/22 00:22:36 (13 months ago)
Author:
Mark Evenson
Message:

Fix class annotations on JDK17 and newer

JDK 17 Removed some obsolete class file format in regards to runtime
visible annotations.

Now, the annotation parser expects a class type signature, instead of a
class, in the constant pool.

See the JDK commit "Remove vestiages of intermediate JSR 175 annotation format"
(https://github.com/openjdk/jdk/commit/8758b554#diff-50de65a27d09a727c0b6ea40ce7ebd97bf7ead098ff910d7757ae0dd781fc2c8R240)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/jvm-class-file.lisp

    r15596 r15597  
    16881688    (finalize-annotation ann class)))
    16891689
     1690;; See https://github.com/openjdk/jdk/blob/8758b554a089af98fdc3be4201d61278d5f01af3/src/java.base/share/classes/sun/reflect/generics/parser/SignatureParser.java#L295-L312
     1691(defun class-name->type-signature (class-name)
     1692  (concatenate 'string
     1693               '(#\L)
     1694               (substitute #\/ #\. class-name)
     1695               '(#\;)))
     1696
    16901697(defun finalize-annotation (ann class)
    16911698  (setf (annotation-type ann)
    1692         (pool-add-class (class-file-constants class) (annotation-type ann)))
     1699        (pool-add-utf8 (class-file-constants class)
     1700                       (class-name->type-signature (annotation-type ann))))
    16931701  (dolist (elem (annotation-elements ann))
    16941702    (finalize-annotation-element elem class)))
Note: See TracChangeset for help on using the changeset viewer.