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

Do not abort CDS archive creation when some classes are unverifiable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 10
    • Fix Version/s: 10
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b33

      Description

      BACKGROUND
      ============

      We have a common use case when mixing new Java programs with old libraries which were compiled with old JDK releases. Here's an example:

          public class Test {
              public static void main(String args[]) {
                  Super x = new Child();
                  x.doit();
              }
          }

      At dump time, the verifier needs to check that Child is indeed a subclass of Super. However, because Super and Child are both "old" classes (classfile version < JDK 1.5), they cannot be loaded during dump time. Hence, the verification of Test would fail at dump time.

      However, all 3 classes are perfectly "good" classes, and can be verified during run time.

      NOTE: the JDK 1.5 classes need to be verified by the "old" verifier, which partially runs Java code. We do not run the old verifier during archive creation time because it's not clear whether its behavior will be identical to actual run time (where the Java code execution may be affected by changes in the environment).

      PROPOSED CHANGE
      ==================
      To improve compatibility with older libraries, we should avoid aborting the CDS archive creation when some classes are unverifiable. Instead, such classes should simply be ignored and excluded from the CDS archive.

      TESTING
      =======

      We need to ensure that all unverifiable classes are excluded from the CDS archive, and attempts to use them at run time will always generate the correct exceptions as specified in JVM/JLS specs.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ccheung Calvin Cheung
                Reporter:
                iklam Ioi Lam
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: