test/jdk/java/lang/invoke/ArrayConstructorTest.java
changeset 47856 76519338df34
parent 47216 71c04702a3d5
equal deleted inserted replaced
47855:72b6d674bde2 47856:76519338df34
    86         assertEquals(methodType(String[].class, int.class), h.type());
    86         assertEquals(methodType(String[].class, int.class), h.type());
    87         String[] a = (String[]) h.invoke(17);
    87         String[] a = (String[]) h.invoke(17);
    88         assertEquals(17, a.length);
    88         assertEquals(17, a.length);
    89     }
    89     }
    90 
    90 
       
    91     @Test(expectedExceptions = {NegativeArraySizeException.class})
       
    92     public static void testArrayConstructorNegativeIndex() throws Throwable {
       
    93         MethodHandle h = MethodHandles.arrayConstructor(String[].class);
       
    94         assertEquals(methodType(String[].class, int.class), h.type());
       
    95         h.invoke(-1); // throws exception
       
    96     }
       
    97 
    91 }
    98 }