JDK-4229423 : serialVersionUID is hidden by non-public fields in three classes
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util
  • Affected Version: 1.2.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.5.1
  • CPU: sparc
  • Submitted: 1999-04-14
  • Updated: 1999-04-16
  • Resolved: 1999-04-16
Related Reports
Duplicate :  
Description

Name: laC46010			Date: 04/14/99


JDK-1.2.2-N fails to pass SignatureTest of JCK-1.2a that reports
following error messages:

Missing Fields
--------------

java.util.HashMap:  field public static final long serialVersionUID
java.util.LinkedList:                   field public static final long serialVersionUID
java.util.TreeMap:  field public static final long serialVersionUID

STATUS:Failed.3 errors

The problem is caused with "serialVersionUID" field inherited from 
java.io.Serializable and hidden by non-public field with the same name in the
following classes:

java.util.HashMap,
java.util.LinkedList,
java.util.TreeMap classes.

As result the same Java program is successfully compiled
under JDK-1.2 but JDK-1.2.2-N compiler reports compile-time errors.

The example below demonstrates that.
-----------------Output------------------
% java -fullversion
java full version "JDK-1.2-V"

% javac Test.java
---------------------
% java -fullversion
java full version "JDK-1.2.2-N"

% javac Test.java
Test.java:3: Variable serialVersionUID in class java.util.HashMap not accessible from class Test.
        System.out.println(java.util.HashMap.serialVersionUID);
                                            ^
Test.java:4: Variable serialVersionUID in class java.util.LinkedList not accessible from class Test.
        System.out.println(java.util.LinkedList.serialVersionUID);
                                               ^
Test.java:5: Variable serialVersionUID in class java.util.TreeMap not accessible from class Test.
        System.out.println(java.util.TreeMap.serialVersionUID);
                                            ^
3 errors
---------------Test.java-----------------
public class Test {
    public static void main(String args[]) {
        System.out.println(java.util.HashMap.serialVersionUID);
        System.out.println(java.util.LinkedList.serialVersionUID);
        System.out.println(java.util.TreeMap.serialVersionUID);
    }
}

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