Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig006.java
40948 views
/*1* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223package nsk.jvmti.GetClassSignature;2425import java.io.*;26import java.util.*;2728import nsk.share.*;2930/**31* This test checks that the JVMTI function <code>GetClassSignature()</code>32* returns generic signature information properly.<br>33* The test creates instances of tested classes. Some of them are generic.34* Then an agent part obtains the class signatures. Proper generic signature35* should be returned for the generic classes, or NULL otherwise.36*/37public class getclsig006 {38static {39try {40System.loadLibrary("getclsig006");41} catch (UnsatisfiedLinkError ule) {42System.err.println("Could not load \"getclsig006\" library");43System.err.println("java.library.path:"44+ System.getProperty("java.library.path"));45throw ule;46}47}4849native int check();5051public static void main(String[] argv) {52argv = nsk.share.jvmti.JVMTITest.commonInit(argv);5354// produce JCK-like exit status55System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE);56}5758public static int run(String argv[], PrintStream out) {59return new getclsig006().runThis(argv, out);60}6162private int runThis(String argv[], PrintStream out) {63// create instances of tested classes64getclsig006b<String> _getclsig006b =65new getclsig006b<String>();66getclsig006c<Boolean, Integer> _getclsig006c =67new getclsig006c<Boolean, Integer>();68getclsig006if<Object> _getclsig006if =69new getclsig006d<Object>();70getclsig006g<getclsig006f> _getclsig006g =71new getclsig006g<getclsig006f>();7273return check();74}75}7677/*78* Dummy classes used only for verifying generic signature information79* in an agent.80*/8182class getclsig006b<L extends String> {}8384class getclsig006c<A, B extends Integer> {}8586interface getclsig006if<I> {}8788class getclsig006d<T> implements getclsig006if<T> {}8990class getclsig006e {}9192class getclsig006f extends getclsig006e implements getclsig006if {}9394class getclsig006g<E extends getclsig006e & getclsig006if> {}959697