-
Bug
-
Resolution: Fixed
-
P4
-
1.2.0
-
1.2fcs
-
sparc
-
solaris_2.5
-
Verified
Name: mgC56079 Date: 09/10/98
java.lang.Class.getInterfaces() spec says nothing about array types.
This method invoked on an array type returns an array of length 0 in JDK releases
prior to 1.2beta4.
Starting with 1.2fcs the method returns {java.lang.Cloneable, java.io.Serializable}.
It is not clear from the spec which behaviour is correct.
=== A test demonstrating the API change (ArrayTest.java) ===
public class ArrayTest {
public static void main(String args[]) {
ArrayTest[] t = new ArrayTest[1];
Class[] a = t.getClass().getInterfaces();
if (a.length == 0)
System.out.println("passed");
else {
System.out.println("failed: "+a.length);
System.out.println(a[0]);
System.out.println(a[1]);
}
}
}
=== sample run (jdk1.1.6) ===
java ArrayTest
passed
=== sample run (jdk1.2fcsI) ===
% java ArrayTest
failed: 2
interface java.lang.Cloneable
interface java.io.Serializable
======================================================================