Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/runtime/7160757/Test7160757.java
32284 views
/*1* Copyright (c) 2012, 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*/2223/*24* @test Test7160757.java25* @bug 716075726* @summary Tests that superclass initialization is not skipped27*/2829public class Test7160757 {3031public static void main(String args[]) throws Exception {3233ClassLoader loader = new SLoader();34try {35Class.forName("S", true, loader);36System.out.println("FAILED");37throw new Exception("Should have thrown a VerifyError.");38} catch (VerifyError e) {39System.out.println(e);40System.out.println("PASSED");41}42}4344static class SLoader extends ClassLoader {4546/**47* public class S extends Throwable {48* public S() {49* aload_050* invokespecial Object.<init>()51* return52* }53* }54*/55static byte b(int i) { return (byte)i; }56static byte S_class[] = {57b(0xca), b(0xfe), b(0xba), b(0xbe), 0x00, 0x00, 0x00, 0x32,580x00, 0x0c, 0x0a, 0x00, 0x0b, 0x00, 0x07, 0x07,590x00, 0x08, 0x07, 0x00, 0x09, 0x01, 0x00, 0x06,600x3c, 0x69, 0x6e, 0x69, 0x74, 0x3e, 0x01, 0x00,610x03, 0x28, 0x29, 0x56, 0x01, 0x00, 0x04, 0x43,620x6f, 0x64, 0x65, 0x0c, 0x00, 0x04, 0x00, 0x05,630x01, 0x00, 0x01, 0x53, 0x01, 0x00, 0x13, 0x6a,640x61, 0x76, 0x61, 0x2f, 0x6c, 0x61, 0x6e, 0x67,650x2f, 0x54, 0x68, 0x72, 0x6f, 0x77, 0x61, 0x62,660x6c, 0x65, 0x01, 0x00, 0x10, 0x6a, 0x61, 0x76,670x61, 0x2f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x4f,680x62, 0x6a, 0x65, 0x63, 0x74, 0x07, 0x00, 0x0a,690x00, 0x21, 0x00, 0x02, 0x00, 0x03, 0x00, 0x00,700x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x04,710x00, 0x05, 0x00, 0x01, 0x00, 0x06, 0x00, 0x00,720x00, 0x11, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00,730x00, 0x05, 0x2a, b(0xb7), 0x00, 0x01, b(0xb1), 0x00,740x00, 0x00, 0x00, 0x00, 0x0075};7677public Class findClass(String name) throws ClassNotFoundException {78return defineClass(name, S_class, 0, S_class.length);79}80}81}828384