< prev index next >

test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/ClassVersionAfterRedefine.java

Print this page

 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  * @test
 26  * @bug 8267555
 27  * @requires vm.jvmti
 28  * @summary Class redefinition with a different class file version
 29  * @library /test/lib
 30  * @compile TestClassOld.jasm TestClassNew.jasm

 31  * @run main RedefineClassHelper
 32  * @run main/othervm -javaagent:redefineagent.jar ClassVersionAfterRedefine
 33  */
 34 
 35 import java.io.InputStream;
 36 import java.lang.reflect.Method;
 37 
 38 import static jdk.test.lib.Asserts.assertTrue;
 39 
 40 public class ClassVersionAfterRedefine extends ClassLoader {
 41 
 42     private static String myName = ClassVersionAfterRedefine.class.getName();
 43 
 44     private static byte[] getBytecodes(String name) throws Exception {
 45         InputStream is = ClassVersionAfterRedefine.class.getResourceAsStream(name + ".class");
 46         byte[] buf = is.readAllBytes();
 47         System.out.println("sizeof(" + name + ".class) == " + buf.length);
 48         return buf;
 49     }
 50 

 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  * @test
 26  * @bug 8267555
 27  * @requires vm.jvmti
 28  * @summary Class redefinition with a different class file version
 29  * @library /test/lib
 30  * @compile TestClassOld.jasm TestClassNew.jasm
 31  * @build jdk.test.lib.helpers.ClassFileInstaller jdk.test.lib.compiler.InMemoryJavaCompiler
 32  * @run main RedefineClassHelper
 33  * @run main/othervm -javaagent:redefineagent.jar ClassVersionAfterRedefine
 34  */
 35 
 36 import java.io.InputStream;
 37 import java.lang.reflect.Method;
 38 
 39 import static jdk.test.lib.Asserts.assertTrue;
 40 
 41 public class ClassVersionAfterRedefine extends ClassLoader {
 42 
 43     private static String myName = ClassVersionAfterRedefine.class.getName();
 44 
 45     private static byte[] getBytecodes(String name) throws Exception {
 46         InputStream is = ClassVersionAfterRedefine.class.getResourceAsStream(name + ".class");
 47         byte[] buf = is.readAllBytes();
 48         System.out.println("sizeof(" + name + ".class) == " + buf.length);
 49         return buf;
 50     }
 51 
< prev index next >