test/runtime/7160757/Test7160757.java

Thu, 19 Sep 2013 09:36:51 -0700

author
cl
date
Thu, 19 Sep 2013 09:36:51 -0700
changeset 5664
34aa07e92d22
parent 0
f90c822e73f8
permissions
-rw-r--r--

Added tag jdk8-b108 for changeset 85072013aad4

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 */
aoqi@0 23
aoqi@0 24 /*
aoqi@0 25 * @test Test7160757.java
aoqi@0 26 * @bug 7160757
aoqi@0 27 * @summary Tests that superclass initialization is not skipped
aoqi@0 28 */
aoqi@0 29
aoqi@0 30 public class Test7160757 {
aoqi@0 31
aoqi@0 32 public static void main(String args[]) throws Exception {
aoqi@0 33
aoqi@0 34 ClassLoader loader = new SLoader();
aoqi@0 35 try {
aoqi@0 36 Class.forName("S", true, loader);
aoqi@0 37 System.out.println("FAILED");
aoqi@0 38 throw new Exception("Should have thrown a VerifyError.");
aoqi@0 39 } catch (VerifyError e) {
aoqi@0 40 System.out.println(e);
aoqi@0 41 System.out.println("PASSED");
aoqi@0 42 }
aoqi@0 43 }
aoqi@0 44
aoqi@0 45 static class SLoader extends ClassLoader {
aoqi@0 46
aoqi@0 47 /**
aoqi@0 48 * public class S extends Throwable {
aoqi@0 49 * public S() {
aoqi@0 50 * aload_0
aoqi@0 51 * invokespecial Object.<init>()
aoqi@0 52 * return
aoqi@0 53 * }
aoqi@0 54 * }
aoqi@0 55 */
aoqi@0 56 static byte b(int i) { return (byte)i; }
aoqi@0 57 static byte S_class[] = {
aoqi@0 58 b(0xca), b(0xfe), b(0xba), b(0xbe), 0x00, 0x00, 0x00, 0x32,
aoqi@0 59 0x00, 0x0c, 0x0a, 0x00, 0x0b, 0x00, 0x07, 0x07,
aoqi@0 60 0x00, 0x08, 0x07, 0x00, 0x09, 0x01, 0x00, 0x06,
aoqi@0 61 0x3c, 0x69, 0x6e, 0x69, 0x74, 0x3e, 0x01, 0x00,
aoqi@0 62 0x03, 0x28, 0x29, 0x56, 0x01, 0x00, 0x04, 0x43,
aoqi@0 63 0x6f, 0x64, 0x65, 0x0c, 0x00, 0x04, 0x00, 0x05,
aoqi@0 64 0x01, 0x00, 0x01, 0x53, 0x01, 0x00, 0x13, 0x6a,
aoqi@0 65 0x61, 0x76, 0x61, 0x2f, 0x6c, 0x61, 0x6e, 0x67,
aoqi@0 66 0x2f, 0x54, 0x68, 0x72, 0x6f, 0x77, 0x61, 0x62,
aoqi@0 67 0x6c, 0x65, 0x01, 0x00, 0x10, 0x6a, 0x61, 0x76,
aoqi@0 68 0x61, 0x2f, 0x6c, 0x61, 0x6e, 0x67, 0x2f, 0x4f,
aoqi@0 69 0x62, 0x6a, 0x65, 0x63, 0x74, 0x07, 0x00, 0x0a,
aoqi@0 70 0x00, 0x21, 0x00, 0x02, 0x00, 0x03, 0x00, 0x00,
aoqi@0 71 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x04,
aoqi@0 72 0x00, 0x05, 0x00, 0x01, 0x00, 0x06, 0x00, 0x00,
aoqi@0 73 0x00, 0x11, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00,
aoqi@0 74 0x00, 0x05, 0x2a, b(0xb7), 0x00, 0x01, b(0xb1), 0x00,
aoqi@0 75 0x00, 0x00, 0x00, 0x00, 0x00
aoqi@0 76 };
aoqi@0 77
aoqi@0 78 public Class findClass(String name) throws ClassNotFoundException {
aoqi@0 79 return defineClass(name, S_class, 0, S_class.length);
aoqi@0 80 }
aoqi@0 81 }
aoqi@0 82 }

mercurial