VerifyProtectedConstructor.java revision 0
0N/A * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A * have any questions. 0N/A * @summary Verify that protected constructor calls are not allowed for classfile version >= 50 (but that they are allowed for lesser versions). 0N/A * @author Keith McGuigan 0N/A throw new Exception(
"FAIL: should be no VerifyError for CF version 49");
0N/A throw new Exception(
"FAIL: should be a VerifyError for CF version 50");
0N/A /* -- code for super class A.A -- 0N/A 0xcafebabe00000032L,
0x000a0a0003000707L,
0N/A 0x0008070009010006L,
0x3c696e69743e0100L,
0N/A 0x0328295601000443L,
0x6f64650c00040005L,
0N/A 0x010003412f410100L,
0x106a6176612f6c61L,
0N/A 0x6e672f4f626a6563L,
0x7400210002000300L,
0N/A 0x0000000001000400L,
0x0400050001000600L,
0N/A 0x0000110001000100L,
0x0000052ab70001b1L,
0N/A 0x0000000000000000L // 2 bytes extra 0N/A // This class is in violation of the spec since it accesses 0N/A // a protected constructor of a superclass while not being in the 0N/A /* -- code for test class -- 0N/A public class B extends A.A { 0N/A public static void f() { new A.A(); } 0N/A 0xcafebabe00000032L,
0x000b0a0002000807L,
0N/A 0x000907000a010006L,
0x3c696e69743e0100L,
0N/A 0x0328295601000443L,
0x6f6465010001660cL,
0N/A 0x0004000501000341L,
0x2f41010003422f42L,
0N/A 0x0021000300020000L,
0x0000000200010004L,
0N/A 0x0005000100060000L,
0x0011000100010000L,
0N/A 0x00052ab70001b100L,
0x0000000009000700L,
434N/A 0x0500010006000000L,
0x1500020000000000L,
0N/A 0x09bb000259b70001L,
0x57b1000000000000L // no extra bytes 0N/A // Change B.B to C.C, D.D, ... for subsequent calls so we can call this 0N/A // multiple times and define different classes. 0N/A // convert long array to byte array