Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8340024

In ClassReader, extract a constant for the superclass supertype_index

XMLWordPrintable

    • b18

        This line in ClassReader uses a literal 65535, which encodes the supertype_index of a superclass:

        t.supertype_field = addTypeAnnotations(t.supertype_field, classExtends(65535));

        https://github.com/openjdk/jdk/blob/7f1dae12e5e24d204a70cf610a8c482996556931/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L2364

        The constant is defined in the JVMS:

        > A supertype_index value of 65535 specifies that the annotation appears on the superclass in an extends clause of a class declaration.

        https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-4.html#jvms-4.7.20.1

        Vicente observed that extracting that value to a documented constant would improve the readability of the code.

              cushon Liam Miller-Cushon
              cushon Liam Miller-Cushon
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: