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

Unusual method modifiers on <clinit> cause serialVersionUID to change

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.1.8
    • core-libs

      According to the JVM spec (section 4.6), the access_flags on static initializers
      are ignored. However, the java.io.ObjectStreamClass.computeSerialVersionUID
      method in JDK1.1.8-K (and earlier) treats <clinit> as a regular method, and so
      incorporates its modifiers into the SHA-1 computation.

      Java 2 assumes that the modifiers are STATIC. Consequently, any class whose
      <clinit> access flags are not equal to STATIC will have serialVersionUID computed
      differently on JDK1.1.x than on Java 2. (For instance, a customer has produced
      a class file with access_flags equal to STATIC+PUBLIC.)

      The two releases should compute the same value for the same class file. According
      to the spec, the access flags in question are ignored, so Java 2 is correct to
      ignore them and JDK1.1.x is in error for not doing so.

            nsanjeevsunw Naveen Sanjeeva (Inactive)
            acolleysunw Adrian Colley (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: