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

Assert class signatures are correct and refer to valid classes

    XMLWordPrintable

Details

    • b107
    • Not verified

    Description

      Code in java lang invoke uses strings for explicit class signatures, for example in InvokerBytecodeGenerator.java:

          /**
           * Generate an invoker method for the passed {@link LambdaForm}.
           */
          private byte[] generateCustomizedCodeBytes() {
              classFilePrologue();

              // Suppress this method in backtraces displayed to the user.
              mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true);

              // Mark this method as a compiled LambdaForm
              mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Compiled;", true);

              if (lambdaForm.forceInline) {
                  // Force inlining of this invoker method.
                  mv.visitAnnotation("Ljava/lang/invoke/ForceInline;", true);
              } else {
                  mv.visitAnnotation("Ljava/lang/invoke/DontInline;", true);
              }

      It would be better to express as constants, that are possibly derived from the actual class (or at least equality-based assertions performed on the string to that derived from the class).

      Any such work should ideally wait until JDK-8144223 is integrated into the appropriate repo, since that updates some class signatures (e.g. some of those in the above code snippet)

      Attachments

        Issue Links

          Activity

            People

              srastogi Shilpi Rastogi (Inactive)
              psandoz Paul Sandoz
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: