< prev index next >

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

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

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -22,10 +22,11 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
 /* @test
+ * @bug 8150782 8207027
  * @compile TestAccessClass.java TestCls.java
  * @run testng/othervm -ea -esa test.java.lang.invoke.t8150782.TestAccessClass
  */
 package test.java.lang.invoke.t8150782;
 

@@ -52,15 +53,21 @@
         lookup().accessClass(Class1.class);
         assertFalse(initializedClass1);
     }
 
     @Test
-    public void returnsSameClass() throws IllegalAccessException, ClassNotFoundException {
+    public void returnsSameClassInSamePackage() throws IllegalAccessException, ClassNotFoundException {
         Class<?> aClass = lookup().accessClass(Class1.class);
         assertEquals(Class1.class, aClass);
     }
 
+    @Test
+    public void returnsSameArrayClassInSamePackage() throws IllegalAccessException, ClassNotFoundException {
+        Class<?> aClass = lookup().accessClass(Class1[].class);
+        assertEquals(Class1[].class, aClass);
+    }
+
     @DataProvider
     Object[][] illegalAccessAccess() {
         return new Object[][] {
                 {publicLookup(), Class1.class},
                 {publicLookup(), TestCls.getPrivateSIC()}
< prev index next >