-
Bug
-
Resolution: Fixed
-
P3
-
1.1.5
-
1.1.8
-
x86
-
windows_95
-
Not verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2017712 | 1.2.0 | Benedict Gomes | P3 | Resolved | Fixed | 1.2fcs |
Name: chT40241 Date: 11/03/97
The method java.lang.Class.isAssignableFrom does not always return
a correct result when array types are involved. A simple test case is
is follows:
public class TestCase {
public static void main(String argv..)
{
int ai[][] = new int[5][5];
Object ao[] = ai;
ao = new Object[1];
if (!ao.getClass().isAssignableFrom(ai.getClass()))
System.out.println("Not assignable!");
}
}
In this example, the class int[][] is indeed assignable to the type
Object[], as is shown by the compiler's acceptance of the assignment
of ai to ao, and its successful execution at run-time. However,
the Class.isAssignable method indicates the opposite. I note that
the documentation for isAssignableFrom specifically cites Section
5.1.4 of the Java Language Spec, according to which this assignment is permitted.
======================================================================
- backported by
-
JDK-2017712 (reflect) Class.isAssignableFrom incorrect for array classes
-
- Resolved
-