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

links to unrelated classes defined in same source file

    XMLWordPrintable

Details

    • sparc
    • solaris_2.4

    Description



      Name: akC45999 Date: 03/04/99



      Create a .java file containing the following text:

      class a {}
      class b {}
      class c {}

      If you compile this file and then look at the A.class file you will find
      entries in its constant pool for the B and C classes even though those
      classes have no dependencies or runtime relationship to the A class.

      class a {
        0xCAFEBABE;
        3; // minor version
        45; // version
        [] { // Constant Pool
          ; // first element is empty
          class #12; // #1
          class #14; // #2
          class #15; // #3
          class #16; // #4
          Method #4 #6; // #5
          NameAndType #8 #7; // #6
          Utf8 "()V"; // #7
          Utf8 "<init>"; // #8
          Utf8 "Code"; // #9
          Utf8 "LineNumberTable"; // #10
          Utf8 "SourceFile"; // #11
          Utf8 "a"; // #12
          Utf8 "a.java"; // #13
          Utf8 "b"; // #14
          Utf8 "c"; // #15
          Utf8 "java/lang/Object"; // #16
        } // Constant Pool
      ...

      The problem is that some JVMs some JVMs may use eager (not lazy) linking.
      In this case symbolic references from Constant Pool are resolved during
      linking. If Constant Pool contains some extraneous references resolution
      may fail. For example the valid class "a", described above, will be
      discarded by JVM with eager linking if unrelated classes "b" and "c" are
      not found.

      Note that this bug can invalidate some of JCK test cases. As workaround
      we are going to split JCK121 tests (which have several classes in one
      source) into several source files.

      =====================================================================

      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              wmaddoxsunw William Maddox (Inactive)
              duke J. Duke
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: