< prev index next >
test/hotspot/jtreg/runtime/cds/appcds/SpecifySysLoaderProp.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2014, 2019, 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) 2014, 2020, 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.
*** 70,87 ****
--- 70,89 ----
// (2) Try to execute the archive with -Djava.system.class.loader=TestClassLoader,
// it should run, but archived non-system classes should be disabled
TestCommon.run(
"-verbose:class",
"-cp", appJar,
+ "-Xlog:cds",
"-Djava.system.class.loader=TestClassLoader",
"ReportMyLoader")
.assertNormalExit("ReportMyLoader's loader = jdk.internal.loader.ClassLoaders$AppClassLoader@", //<-this is still printed because TestClassLoader simply delegates to Launcher$AppLoader, but ...
"TestClassLoader.called = true", //<-but this proves that TestClassLoader was indeed called.
"TestClassLoader: loadClass(\"ReportMyLoader\",") //<- this also proves that TestClassLoader was indeed called.
.assertNormalExit(output -> {
output.shouldMatch(".class,load. TestClassLoader source: file:");
output.shouldMatch(".class,load. ReportMyLoader source: file:.*" + jarFileName);
+ output.shouldContain("full module graph: disabled due to incompatible property: java.system.class.loader=");
});
// (3) Try to change the java.system.class.loader programmatically after
// the app's main method is executed. This should have no effect in terms of
// changing or switching the actual system class loader that's already in use.
< prev index next >