1 /* 2 * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. 3 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 4 */ 5 6 // When -XX:+PreloadSharedClasses is enabled, this class will be 7 // archived in the unlinked state. When we try to use this class 8 // at runtime, a VerifyError should be thrown. 9 10 super public class BadNewClass2 11 version 52:0 12 { 13 14 15 public Method "<init>":"()V" 16 stack 1 locals 1 17 { 18 aload_0; 19 invokespecial Method java/lang/Object."<init>":"()V"; 20 return; 21 } 22 23 /* 24 * The following method tries to return a NotFoo as a Foo. 25 * Verifier should fail. 26 */ 27 public Method doit:"()LFoo;" 28 stack 2 locals 1 29 { 30 new class NotFoo; 31 dup; 32 invokespecial Method NotFoo."<init>":"()V"; 33 astore_0; 34 aload_0; 35 areturn; // tries to return a NotFoo as a Foo 36 } 37 38 }