< prev index next > test/hotspot/jtreg/runtime/cds/appcds/jvmti/ClassFileLoadHookTest.java
Print this page
/*
! * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
/*
! * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
"-XX:+WhiteBoxAPI", useWb,
"-agentlib:SimpleClassFileLoadHook=LoadMe,beforeHook,after_Hook",
"ClassFileLoadHook",
"" + ClassFileLoadHook.TestCaseId.SHARING_ON_CFLH_ON);
TestCommon.checkExec(out);
+
+ // JEP 483: if dumped with -XX:+AOTClassLinking, cannot use archive when CFLH
+ TestCommon.testDump(appJar, sharedClasses, useWb, "-XX:+AOTClassLinking");
+ out = TestCommon.exec(appJar,
+ "-XX:+UnlockDiagnosticVMOptions",
+ "-XX:+WhiteBoxAPI", useWb,
+ "-agentlib:SimpleClassFileLoadHook=LoadMe,beforeHook,after_Hook",
+ "-Xlog:cds",
+ "ClassFileLoadHook",
+ "" + ClassFileLoadHook.TestCaseId.SHARING_ON_CFLH_ON);
+ if (out.contains("Using AOT-linked classes: false")) {
+ // We are running with VM options that do not support -XX:+AOTClassLinking
+ out.shouldHaveExitValue(0);
+ } else {
+ out.shouldContain("CDS archive has aot-linked classes. It cannot be used when JVMTI ClassFileLoadHook is in use.");
+ out.shouldNotHaveExitValue(0);
+ }
}
}
< prev index next >