Microsoft KB Archive/285218

= BUG: ObjectStreamClass.getSerialVersionUID Is Not JDK 1.1.4 Compatible =

Article ID: 285218

Article Last Modified on 6/14/2006

-

APPLIES TO


 * Microsoft Java Virtual Machine

-



This article was previously published under Q285218



SYMPTOMS
When the ObjectStreamClass.getSerialVersionUID class is called for an Object array of private classes, the value that is returned differs between the Microsoft virtual machine (Microsoft VM) and Sun Microsystems' JDK 1.1.4 virtual machine. However, when the Object classes are declared public, the same value is returned.



CAUSE
This problem occurs because Class.getModifiers on the Microsoft VM always indicates that the class is public for array classes; however, on the virtual machine that shipped with Sun's JDK 1.1.4, the flags for array types only include the public bit if the underlying base type is public.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
The following code reproduces the problem: // TestCaseMain.java import java.io.*;

public class TestCaseMain { public static void main(String[] args) { new TestCaseMain.go; } void go { TestA1[] a1 = new TestA1[0]; TestA2[] a2 = new TestA2[0]; ObjectStreamClass osc = ObjectStreamClass.lookup(a1.getClass); long id = osc.getSerialVersionUID; System.out.println(&quot;Non-public class array ID = &quot; + id); osc = ObjectStreamClass.lookup(a2.getClass); id = osc.getSerialVersionUID; System.out.println(&quot;Public class array ID = &quot; + id); } }

class TestA1 { }

// TestA2.java public class TestA2{ }

