< prev index next >
test/hotspot/jtreg/runtime/valhalla/valuetypes/ValueTypeArray.java
Print this page
*** 251,260 ****
--- 251,261 ----
void testSanityCheckcasts() {
MyInt[] myInts = new MyInt[1];
assertTrue(myInts instanceof Object[]);
assertTrue(myInts instanceof Comparable[]);
+ assertTrue(myInts instanceof MyInt?[]);
Class<?> cls = MyInt.class.asValueType();
assertTrue(cls.isValue());
Object arrObj = Array.newInstance(cls, 1);
assertTrue(arrObj instanceof Object[], "Not Object array");
*** 269,287 ****
// multi-dim, check secondary array types are setup...
MyOtherInt[][] matrix = new MyOtherInt[1][1];
assertTrue(matrix[0] instanceof MyOtherInt[]);
assertTrue(matrix[0] instanceof SomeSecondaryType[]);
// Box types vs Inline...
MyInt?[] myValueRefs = new MyInt?[1];
! // JDK-8222974
! //assertTrue(myValueRefs instanceof MyInt?[]);
! assertFalse(myValueRefs instanceof MyInt[]);
assertTrue(myValueRefs instanceof Object[]);
assertTrue(myValueRefs instanceof Comparable[]);
assertFalse(myValueRefs instanceof MyInt[]);
}
void testUtilArrays() {
// Sanity check j.u.Arrays
--- 270,303 ----
// multi-dim, check secondary array types are setup...
MyOtherInt[][] matrix = new MyOtherInt[1][1];
assertTrue(matrix[0] instanceof MyOtherInt[]);
assertTrue(matrix[0] instanceof SomeSecondaryType[]);
+ assertTrue(matrix[0] instanceof MyOtherInt?[]);
// Box types vs Inline...
MyInt?[] myValueRefs = new MyInt?[1];
! assertTrue(myValueRefs instanceof MyInt?[]);
assertTrue(myValueRefs instanceof Object[]);
assertTrue(myValueRefs instanceof Comparable[]);
assertFalse(myValueRefs instanceof MyInt[]);
+
+ MyInt?[][] myMdValueRefs = new MyInt?[1][1];
+ assertTrue(myMdValueRefs[0] instanceof MyInt?[]);
+ assertTrue(myMdValueRefs[0] instanceof Object[]);
+ assertTrue(myMdValueRefs[0] instanceof Comparable[]);
+ assertFalse(myMdValueRefs[0] instanceof MyInt[]);
+
+ // Did we break checkcast...
+ MyInt?[] va1 = (MyInt?[])null;
+ MyInt?[] va2 = null;
+ MyInt?[][] va3 = (MyInt?[][])null;
+ MyInt?[][][] va4 = (MyInt?[][][])null;
+ MyInt[] va5 = null;
+ MyInt[] va6 = (MyInt[])null;
+ MyInt[][] va7 = (MyInt[][])null;
+ MyInt[][][] va8 = (MyInt[][][])null;
}
void testUtilArrays() {
// Sanity check j.u.Arrays
< prev index next >