< prev index next >

test/hotspot/jtreg/runtime/cds/appcds/jvmti/ClassFileLoadHookTest.java

Print this page
*** 1,7 ***
  /*
!  * 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.
--- 1,7 ---
  /*
!  * 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.

*** 94,7 ***
--- 94,16 ---
                  "-XX:+WhiteBoxAPI", useWb,
                  "-agentlib:SimpleClassFileLoadHook=LoadMe,beforeHook,after_Hook",
                  "ClassFileLoadHook",
                  "" + ClassFileLoadHook.TestCaseId.SHARING_ON_CFLH_ON);
          TestCommon.checkExec(out);
+ 
+         // Leyden: if dumped with -XX:+PreloadSharedClasses, cannot use archive when CFLH
+         TestCommon.testDump(appJar, sharedClasses, "-XX:+PreloadSharedClasses");
+         out = TestCommon.exec(appJar,
+                 "-agentlib:SimpleClassFileLoadHook=LoadMe,beforeHook,after_Hook",
+                 "ClassFileLoadHook",
+                 "" + ClassFileLoadHook.TestCaseId.SHARING_ON_CFLH_ON);
+         out.shouldContain("CDS archive has preloaded classes. It cannot be used when JVMTI ClassFileLoadHook is in use.");
+         out.shouldNotHaveExitValue(0);
      }
  }
< prev index next >