< prev index next >

test/hotspot/jtreg/runtime/ClassFile/ClassAccessFlagsRawTest.java

Print this page

 7  * published by the Free Software Foundation.
 8  *
 9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  *
23  */
24 
25 /**
26  * @test
27  * @bug 8291360
28  * @summary Test getting a class's raw access flags using java.lang.Class API
29  * @modules java.base/java.lang:open
30  * @compile classAccessFlagsRaw.jcod
31  * @run main/othervm ClassAccessFlagsRawTest
32  */
33 
34 import java.lang.reflect.*;
35 
36 public class ClassAccessFlagsRawTest {
37 
38     static Method m;
39 
40     public static void testIt(String className, int expectedResult) throws Exception {
41         Class<?> testClass = Class.forName(className);
42         int flags = (int)m.invoke(testClass);
43         if (flags != expectedResult) {
44             throw new RuntimeException(
45                 "expected 0x" + Integer.toHexString(expectedResult) + ", got 0x" + Integer.toHexString(flags) + " for class " + className);
46         }
47     }
48 
49     public static void main(String argv[]) throws Throwable {
50         Class<?> cl = java.lang.Class.class;
51         m = cl.getDeclaredMethod("getClassAccessFlagsRaw", new Class[0]);

 7  * published by the Free Software Foundation.
 8  *
 9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  *
23  */
24 
25 /**
26  * @test
27  * @bug 8291360 8293448
28  * @summary Test getting a class's raw access flags using java.lang.Class API
29  * @modules java.base/java.lang:open
30  * @compile classAccessFlagsRaw.jcod
31  * @run main/othervm -XX:-EnableValhalla ClassAccessFlagsRawTest
32  */
33 
34 import java.lang.reflect.*;
35 
36 public class ClassAccessFlagsRawTest {
37 
38     static Method m;
39 
40     public static void testIt(String className, int expectedResult) throws Exception {
41         Class<?> testClass = Class.forName(className);
42         int flags = (int)m.invoke(testClass);
43         if (flags != expectedResult) {
44             throw new RuntimeException(
45                 "expected 0x" + Integer.toHexString(expectedResult) + ", got 0x" + Integer.toHexString(flags) + " for class " + className);
46         }
47     }
48 
49     public static void main(String argv[]) throws Throwable {
50         Class<?> cl = java.lang.Class.class;
51         m = cl.getDeclaredMethod("getClassAccessFlagsRaw", new Class[0]);
< prev index next >