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

Do not abort CDS archive creation when some classes are unverifiable

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 10
    • 10
    • hotspot
    • b33

      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.

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

              Created:
              Updated:
              Resolved: