< prev index next >

test/jdk/java/lang/invoke/t8150782/TestFindClass.java

Print this page
rev 50983 : 8207027: Lookup.accessClass fails for an array type in the same package when assertions are enabled
Reviewed-by:

*** 22,31 **** --- 22,32 ---- * or visit www.oracle.com if you need additional information or have any * questions. */ /* @test + * @bug 8150782 8207027 * @compile TestFindClass.java TestCls.java * @run testng/othervm -ea -esa test.java.lang.invoke.t8150782.TestFindClass */ package test.java.lang.invoke.t8150782;
*** 54,68 **** lookup().findClass(PACKAGE_PREFIX + "TestFindClass$Class1"); assertFalse(initializedClass1); } @Test ! public void returnsRequestedClass() throws IllegalAccessException, ClassNotFoundException { Class<?> aClass = lookup().findClass(PACKAGE_PREFIX + "TestFindClass$Class1"); assertEquals(Class1.class, aClass); } @Test(expectedExceptions = {ClassNotFoundException.class}) public void classNotFoundExceptionTest() throws IllegalAccessException, ClassNotFoundException { lookup().findClass(PACKAGE_PREFIX + "TestFindClass$NonExistent"); } --- 55,75 ---- lookup().findClass(PACKAGE_PREFIX + "TestFindClass$Class1"); assertFalse(initializedClass1); } @Test ! public void returnsRequestedClassInSamePackage() throws IllegalAccessException, ClassNotFoundException { Class<?> aClass = lookup().findClass(PACKAGE_PREFIX + "TestFindClass$Class1"); assertEquals(Class1.class, aClass); } + @Test + public void returnsRequestedArrayClassInSamePackage() throws IllegalAccessException, ClassNotFoundException { + Class<?> aClass = lookup().findClass("[L" + PACKAGE_PREFIX + "TestFindClass$Class1;"); + assertEquals(Class1[].class, aClass); + } + @Test(expectedExceptions = {ClassNotFoundException.class}) public void classNotFoundExceptionTest() throws IllegalAccessException, ClassNotFoundException { lookup().findClass(PACKAGE_PREFIX + "TestFindClass$NonExistent"); }
< prev index next >