Duplicate :
|
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); } } ======================================================================