--- old/src/hotspot/share/classfile/classLoader.cpp 2020-06-10 11:20:50.875694593 -0700 +++ new/src/hotspot/share/classfile/classLoader.cpp 2020-06-10 11:20:50.575683300 -0700 @@ -1528,6 +1528,19 @@ FileMapInfo::allocate_shared_path_table(); } } + +// Helper function used by CDS code to get the number of module path +// entries during shared classpath setup time. +int ClassLoader::num_module_path_entries() { + Arguments::assert_is_dumping_archive(); + int num_entries = 0; + ClassPathEntry* e= ClassLoader::_module_path_entries; + while (e != NULL) { + num_entries ++; + e = e->next(); + } + return num_entries; +} #endif jlong ClassLoader::classloader_time_ms() { --- old/src/hotspot/share/classfile/classLoader.hpp 2020-06-10 11:20:51.443715974 -0700 +++ new/src/hotspot/share/classfile/classLoader.hpp 2020-06-10 11:20:51.143704681 -0700 @@ -388,16 +388,7 @@ // Helper function used by CDS code to get the number of module path // entries during shared classpath setup time. - static int num_module_path_entries() { - Arguments::assert_is_dumping_archive(); - int num_entries = 0; - ClassPathEntry* e= ClassLoader::_module_path_entries; - while (e != NULL) { - num_entries ++; - e = e->next(); - } - return num_entries; - } + static int num_module_path_entries(); static void exit_with_path_failure(const char* error, const char* message); static char* skip_uri_protocol(char* source); static void record_result(InstanceKlass* ik, const ClassFileStream* stream, TRAPS); --- old/src/hotspot/share/classfile/systemDictionary.cpp 2020-06-10 11:20:52.255746541 -0700 +++ new/src/hotspot/share/classfile/systemDictionary.cpp 2020-06-10 11:20:51.955735248 -0700 @@ -1232,6 +1232,7 @@ InstanceKlass* SystemDictionary::load_shared_boot_class(Symbol* class_name, PackageEntry* pkg_entry, TRAPS) { + assert(UseSharedSpaces, "Sanity check"); InstanceKlass* ik = SystemDictionaryShared::find_builtin_class(class_name); if (ik != NULL && ik->is_shared_boot_class()) { return load_shared_class(ik, Handle(), Handle(), NULL, pkg_entry, THREAD); @@ -1251,18 +1252,30 @@ Handle class_loader, TRAPS) { assert(!ModuleEntryTable::javabase_moduleEntry()->is_patched(), "Cannot use sharing if java.base is patched"); - ResourceMark rm(THREAD); - int path_index = ik->shared_classpath_index(); - ClassLoaderData* loader_data = class_loader_data(class_loader); - if (path_index < 0) { + if (ik->shared_classpath_index() < 0) { // path_index < 0 indicates that the class is intended for a custom loader // and should not be loaded by boot/platform/app loaders - if (loader_data->is_builtin_class_loader_data()) { + if (is_builtin_class_loader(class_loader())) { return false; } else { return true; } } + + // skip class visibility check + if (MetaspaceShared::use_optimized_module_handling()) { + assert(SystemDictionary::is_shared_class_visible_impl(class_name, ik, pkg_entry, class_loader, THREAD), "Optimizing module handling failed."); + return true; + } + return is_shared_class_visible_impl(class_name, ik, pkg_entry, class_loader, THREAD); +} + +bool SystemDictionary::is_shared_class_visible_impl(Symbol* class_name, + InstanceKlass* ik, + PackageEntry* pkg_entry, + Handle class_loader, TRAPS) { + int path_index = ik->shared_classpath_index(); + ClassLoaderData* loader_data = class_loader_data(class_loader); SharedClassPathEntry* ent = (SharedClassPathEntry*)FileMapInfo::shared_path(path_index); if (!Universe::is_module_initialized()) { @@ -1560,12 +1573,14 @@ // Search for classes in the CDS archive. InstanceKlass* k = NULL; - { + #if INCLUDE_CDS + if (UseSharedSpaces) + { PerfTraceTime vmtimer(ClassLoader::perf_shared_classload_time()); k = load_shared_boot_class(class_name, pkg_entry, THREAD); -#endif } +#endif if (k == NULL) { // Use VM class loader --- old/src/hotspot/share/classfile/systemDictionary.hpp 2020-06-10 11:20:53.351787798 -0700 +++ new/src/hotspot/share/classfile/systemDictionary.hpp 2020-06-10 11:20:53.051776505 -0700 @@ -627,6 +627,10 @@ static bool is_shared_class_visible(Symbol* class_name, InstanceKlass* ik, PackageEntry* pkg_entry, Handle class_loader, TRAPS); + static bool is_shared_class_visible_impl(Symbol* class_name, + InstanceKlass* ik, + PackageEntry* pkg_entry, + Handle class_loader, TRAPS); static bool check_shared_class_super_type(InstanceKlass* child, InstanceKlass* super, Handle class_loader, Handle protection_domain, bool is_superclass, TRAPS); --- old/src/hotspot/share/memory/filemap.cpp 2020-06-10 11:20:54.419828000 -0700 +++ new/src/hotspot/share/memory/filemap.cpp 2020-06-10 11:20:54.119816708 -0700 @@ -217,6 +217,7 @@ _compressed_class_ptrs = UseCompressedClassPointers; _max_heap_size = MaxHeapSize; _narrow_klass_shift = CompressedKlassPointers::shift(); + _use_optimized_module_handling = MetaspaceShared::use_optimized_module_handling(); // The following fields are for sanity checks for whether this archive // will function correctly with this JVM and the bootclasspath it's @@ -2130,6 +2131,11 @@ return false; } + if (!_use_optimized_module_handling) { + MetaspaceShared::disable_optimized_module_handling(); + log_info(cds)("use_optimized_module_handling disabled: archive was created without optimized module handling"); + } + return true; } --- old/src/hotspot/share/memory/filemap.hpp 2020-06-10 11:20:55.259859621 -0700 +++ new/src/hotspot/share/memory/filemap.hpp 2020-06-10 11:20:54.959848328 -0700 @@ -227,6 +227,8 @@ char* _mapped_base_address; // Actual base address where archive is mapped. bool _allow_archiving_with_java_agent; // setting of the AllowArchivingWithJavaAgent option + bool _use_optimized_module_handling;// No module-relation VM options were specified, so we can skip + // some expensive operations. size_t _ptrmap_size_in_bits; // Size of pointer relocation bitmap char* from_mapped_offset(size_t offset) const { --- old/src/hotspot/share/memory/metaspaceShared.cpp 2020-06-10 11:20:56.071890187 -0700 +++ new/src/hotspot/share/memory/metaspaceShared.cpp 2020-06-10 11:20:55.767878744 -0700 @@ -89,6 +89,7 @@ void* MetaspaceShared::_shared_metaspace_static_top = NULL; intx MetaspaceShared::_relocation_delta; char* MetaspaceShared::_requested_base_address; +bool MetaspaceShared::_use_optimized_module_handling = true; // The CDS archive is divided into the following regions: // mc - misc code (the method entry trampolines, c++ vtables) @@ -2376,6 +2377,7 @@ static_mapinfo->map_heap_regions(); } }); + log_info(cds)("Using optimized module handling %s", MetaspaceShared::use_optimized_module_handling() ? "enabled" : "disabled"); } else { unmap_archive(static_mapinfo); unmap_archive(dynamic_mapinfo); --- old/src/hotspot/share/memory/metaspaceShared.hpp 2020-06-10 11:20:56.891921055 -0700 +++ new/src/hotspot/share/memory/metaspaceShared.hpp 2020-06-10 11:20:56.591909762 -0700 @@ -184,6 +184,7 @@ static void* _shared_metaspace_static_top; static intx _relocation_delta; static char* _requested_base_address; + static bool _use_optimized_module_handling; public: enum { // core archive spaces @@ -372,6 +373,11 @@ static void write_core_archive_regions(FileMapInfo* mapinfo, GrowableArray* closed_oopmaps, GrowableArray* open_oopmaps); + + // Can we skip some expensive operations related to modules? + static bool use_optimized_module_handling() { return _use_optimized_module_handling; } + static void disable_optimized_module_handling() { _use_optimized_module_handling = false; } + private: #if INCLUDE_CDS static void write_region(FileMapInfo* mapinfo, int region_idx, DumpRegion* dump_region, --- old/src/hotspot/share/runtime/arguments.cpp 2020-06-10 11:20:57.443941834 -0700 +++ new/src/hotspot/share/runtime/arguments.cpp 2020-06-10 11:20:57.139930390 -0700 @@ -1467,6 +1467,12 @@ value = &prop[key_len + 1]; } + if (is_internal_module_property(key) || + strcmp(key, "jdk.module.main") == 0) { + MetaspaceShared::disable_optimized_module_handling(); + log_info(cds)("Using optimized module handling disabled due to incompatible property: %s=%s", key, value); + } + if (strcmp(key, "java.compiler") == 0) { process_java_compiler_argument(value); // Record value in Arguments, but let it get passed to Java. @@ -2510,6 +2516,8 @@ // -bootclasspath/a: } else if (match_option(option, "-Xbootclasspath/a:", &tail)) { Arguments::append_sysclasspath(tail); + MetaspaceShared::disable_optimized_module_handling(); + log_info(cds)("Using optimized module handling disabled due to bootclasspath was appended"); // -bootclasspath/p: } else if (match_option(option, "-Xbootclasspath/p:", &tail)) { jio_fprintf(defaultStream::output_stream(), --- /dev/null 2019-11-19 22:05:02.069813242 -0800 +++ new/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/OptimizeModuleHandlingTest.java 2020-06-10 11:20:57.727952525 -0700 @@ -0,0 +1,311 @@ +/* + * Copyright (c) 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. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +/** + * @test + * @requires vm.cds + * @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds + * @run driver OptimizeModuleHandlingTest + * @summary test module path changes for optimization of + * module handling. + * + */ + +import java.io.File; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +import jdk.test.lib.process.OutputAnalyzer; + +public class OptimizeModuleHandlingTest { + + private static final Path USER_DIR = Paths.get(System.getProperty("user.dir")); + + private static final String TEST_SRC = System.getProperty("test.src"); + + private static final Path SRC_DIR = Paths.get(TEST_SRC, "src"); + private static final Path MODS_DIR = Paths.get("mody"); + + // the module name of the test module + private static final String MAIN_MODULE = "com.bars"; + private static final String TEST_MODULE = "com.foos"; + + // the module main class + private static final String MAIN_CLASS = "com.bars.Main"; + private static final String TEST_CLASS = "com.foos.Test"; + + private static String PATH_LIBS = "modylibs"; + private static Path libsDir = null; + private static Path mainJar = null; + private static Path testJar = null; + + private static String CLASS_FOUND_MESSAGE = "com.foos.Test found"; + private static String CLASS_NOT_FOUND_MESSAGE = "java.lang.ClassNotFoundException: com.foos.Test"; + private static String OPTIMIZE_ENABLED = "Using optimized module handling enabled"; + private static String OPTIMIZE_DISABLED = "Using optimized module handling disabled"; + private static String MAIN_FROM_JAR = "class,load.*com.bars.Main.*[.]jar"; + private static String MAIN_FROM_CDS = "class,load.*com.bars.Main.*shared objects file"; + private static String TEST_FROM_JAR = "class,load.*com.foos.Test.*[.]jar"; + private static String TEST_FROM_CDS = "class,load.*com.foos.Test.*shared objects file"; + private static String MAP_FAILED = "Unable to use shared archive"; + private static String PATH_SEPARATOR = File.pathSeparator; + + public static void buildTestModule() throws Exception { + + // javac -d mods/$TESTMODULE src/$TESTMODULE/** + JarBuilder.compileModule(SRC_DIR.resolve(TEST_MODULE), + MODS_DIR.resolve(TEST_MODULE), + null); + + // javac -d mods/$TESTMODULE --module-path MOD_DIR src/$TESTMODULE/** + JarBuilder.compileModule(SRC_DIR.resolve(MAIN_MODULE), + MODS_DIR.resolve(MAIN_MODULE), + MODS_DIR.toString()); + + libsDir = Files.createTempDirectory(USER_DIR, PATH_LIBS); + mainJar = libsDir.resolve(MAIN_MODULE + ".jar"); + testJar = libsDir.resolve(TEST_MODULE + ".jar"); + + // modylibs contains both modules com.foos.jar, com.bars.jar + // build com.foos.jar + String classes = MODS_DIR.resolve(TEST_MODULE).toString(); + JarBuilder.createModularJar(testJar.toString(), classes, TEST_CLASS); + + // build com.bars.jar + classes = MODS_DIR.resolve(MAIN_MODULE).toString(); + JarBuilder.createModularJar(mainJar.toString(), classes, MAIN_CLASS); + } + + public static void main(String... args) throws Exception { + runWithModulePath(); + runWithJarPath(); + } + + private static void tty(String... args) { + for (String s : args) { + System.out.print(s + " "); + } + System.out.print("\n"); + } + + public static void runWithModulePath(String... extraRuntimeArgs) throws Exception { + // compile the modules and create the modular jar files + buildTestModule(); + String appClasses[] = {MAIN_CLASS, TEST_CLASS}; + // create an archive with the classes in the modules built in the + // previous step + OutputAnalyzer output = TestCommon.createArchive( + null, appClasses, + "--module-path", + libsDir.toString(), + "-m", MAIN_MODULE); + TestCommon.checkDump(output); + + // following 1 - 4 test with CDS off + tty("1. run with CDS off"); + TestCommon.execOff( "-p", libsDir.toString(), + "-m", MAIN_MODULE) + .shouldHaveExitValue(0) + .shouldNotContain(OPTIMIZE_ENABLED) + .shouldContain(CLASS_FOUND_MESSAGE); + tty("2. run with CDS off, without module path"); + TestCommon.execOff("-cp", + mainJar.toString(), + MAIN_CLASS) + .shouldHaveExitValue(0) + .shouldContain(CLASS_NOT_FOUND_MESSAGE); + tty("3. run with CDS off, but with full jars in path"); + TestCommon.execOff( "-cp", mainJar.toString() + PATH_SEPARATOR + testJar.toString(), + MAIN_CLASS) + .shouldHaveExitValue(0) + .shouldNotContain(OPTIMIZE_ENABLED) + .shouldContain(CLASS_FOUND_MESSAGE); + tty("4. run with CDS off, only main jar on path, but given moudle path"); + TestCommon.execOff( "-cp", mainJar.toString(), + "--module-path", libsDir.toString(), + "--add-modules", TEST_MODULE, + MAIN_CLASS) + .shouldHaveExitValue(0) + .shouldNotContain(OPTIMIZE_ENABLED) + .shouldContain(CLASS_FOUND_MESSAGE); + + // Following 5 - 10 test with CDS on + tty("5. run with CDS on, with module path"); + String prefix[] = {"-Djava.class.path=", "-Xlog:cds", "-Xlog:class+load"}; + TestCommon.runWithModules(prefix, + null, // --upgrade-module-path + libsDir.toString(), // --module-path + MAIN_MODULE) // -m + .assertNormalExit(out -> { + out.shouldNotContain(OPTIMIZE_ENABLED) + .shouldContain(OPTIMIZE_DISABLED) + .shouldMatch(MAIN_FROM_CDS) // // archived Main class is for module only + .shouldContain(CLASS_FOUND_MESSAGE); + }); + tty("6. run with CDS on, with module paths set correctly"); + TestCommon.run("-Xlog:cds", + "-Xlog:class+load", + "-p", libsDir.toString(), + "-m", MAIN_MODULE) + .assertNormalExit(out -> { + out.shouldContain(CLASS_FOUND_MESSAGE) + .shouldMatch(MAIN_FROM_CDS) + .shouldMatch(TEST_FROM_CDS) + .shouldContain(OPTIMIZE_DISABLED) + .shouldNotContain(OPTIMIZE_ENABLED); + }); + tty("7. run with CDS on, with jar on path"); + TestCommon.run("-Xlog:cds", + "-Xlog:class+load", + "-cp", mainJar.toString() + PATH_SEPARATOR + testJar.toString(), + MAIN_CLASS) + .assertNormalExit(out -> { + out.shouldContain(CLASS_FOUND_MESSAGE) + .shouldMatch(MAIN_FROM_JAR) + .shouldMatch(TEST_FROM_JAR) + .shouldContain(OPTIMIZE_DISABLED) + .shouldNotContain(OPTIMIZE_ENABLED); + }); + + tty("8. run with CDS on, with --module-path, with jar should fail"); + TestCommon.run("-Xlog:cds", + "-Xlog:class+load", + "-p", libsDir.toString(), + "-cp", mainJar.toString(), + MAIN_CLASS) + .assertNormalExit(out -> { + out.shouldContain(CLASS_NOT_FOUND_MESSAGE) + .shouldMatch(MAIN_FROM_JAR) + .shouldNotContain(OPTIMIZE_ENABLED); + }); + tty("9. run with CDS on, with com.foos on --module-path, with main jar on cp should pass"); + TestCommon.run("-Xlog:cds", + "-Xlog:class+load", + "--module-path", libsDir.toString(), + "--add-modules", TEST_MODULE, + "-cp", mainJar.toString(), + MAIN_CLASS) + .assertNormalExit(out -> { + out.shouldContain(CLASS_FOUND_MESSAGE) + .shouldMatch(MAIN_FROM_JAR) + .shouldMatch(TEST_FROM_CDS) + .shouldNotContain(OPTIMIZE_ENABLED); + }); + tty("10. run with CDS on, --module-path, with -Xbootclasspath/a: ."); + TestCommon.run("-Xlog:cds", + "-Xbootclasspath/a:", ".", + "--module-path", libsDir.toString(), + MAIN_CLASS) + .assertAbnormalExit(out -> { + out.shouldNotContain(CLASS_FOUND_MESSAGE) + .shouldContain(OPTIMIZE_DISABLED) // mapping info + .shouldContain("shared class paths mismatch"); + }); + } + + public static void runWithJarPath(String... extraRuntimeArgs) throws Exception { + // compile the modules and create the modular jar files + buildTestModule(); + String appClasses[] = {MAIN_CLASS, TEST_CLASS}; + // create an archive with the classes in the modules built in the + // previous step + OutputAnalyzer output = TestCommon.createArchive( + testJar.toString() + PATH_SEPARATOR + mainJar.toString(), + appClasses); + TestCommon.checkDump(output); + + // tests 1 - 4 test with CDS off are same as with module archive. + tty("tests 1 - 4 test with CDS off are same as with module archive, skipped"); + + // Following 5 - 9 test with CDS on + tty("5. run with CDS on, with module path"); + String prefix[] = {"-Djava.class.path=", "-Xlog:cds"}; + TestCommon.runWithModules(prefix, + null, // --upgrade-module-path + libsDir.toString(), // --module-path + MAIN_MODULE) // -m + .assertAbnormalExit(out -> { + out.shouldContain(MAP_FAILED) + .shouldNotContain(OPTIMIZE_ENABLED) + .shouldNotContain(CLASS_FOUND_MESSAGE); + }); + tty("6. run with CDS on, with module paths set correctly"); + TestCommon.run("-Xlog:cds", + "-p", libsDir.toString(), + "-m", MAIN_MODULE) + .assertAbnormalExit(out -> { + out.shouldContain(MAP_FAILED) + .shouldNotContain(CLASS_FOUND_MESSAGE) + .shouldNotContain(OPTIMIZE_ENABLED); + }); + tty("7. run with CDS on, with jar on path"); + TestCommon.run("-Xlog:cds", + "-Xlog:class+load", + "-cp", testJar.toString() + PATH_SEPARATOR + mainJar.toString(), + MAIN_CLASS) + .assertNormalExit(out -> { + out.shouldMatch(MAIN_FROM_CDS) + .shouldMatch(TEST_FROM_CDS) + .shouldContain(CLASS_FOUND_MESSAGE) + .shouldContain(OPTIMIZE_ENABLED); + }); + tty("8. run with CDS on, with --module-path, with jars on classpath should run but not optimized"); + TestCommon.run("-Xlog:cds", + "-Xlog:class+load", + "-p", libsDir.toString(), + "-cp", testJar.toString() + PATH_SEPARATOR + mainJar.toString(), + "--add-modules=com.bars", // Main/Test from jars + MAIN_CLASS) + .assertNormalExit(out -> { + out.shouldMatch(MAIN_FROM_JAR) + .shouldMatch(TEST_FROM_JAR) + .shouldContain(CLASS_FOUND_MESSAGE) + .shouldNotContain(OPTIMIZE_ENABLED); + }); + tty("9. run with CDS on, with main jar only on classpath should not pass"); + TestCommon.run("-Xlog:cds", + "-cp", mainJar.toString(), + MAIN_CLASS) + .assertAbnormalExit(out -> { + out.shouldContain(MAP_FAILED) + .shouldNotContain(CLASS_FOUND_MESSAGE) + .shouldNotContain(CLASS_NOT_FOUND_MESSAGE) + .shouldNotContain(OPTIMIZE_ENABLED) + .shouldNotContain(OPTIMIZE_DISABLED); + }); + tty("10. run with CDS on, with main/test jars on classpath also with -Xbootclasspath/a: should not pass"); + TestCommon.run("-Xlog:cds", + "-cp", mainJar.toString() + PATH_SEPARATOR + testJar.toString(), + "-Xbootclasspath/a:", ".", + MAIN_CLASS) + .assertAbnormalExit(out -> { + out.shouldNotContain(CLASS_FOUND_MESSAGE) + .shouldNotContain(CLASS_NOT_FOUND_MESSAGE) + .shouldContain(OPTIMIZE_DISABLED) + .shouldNotContain(OPTIMIZE_ENABLED) + .shouldContain(MAP_FAILED); + }); + } +} --- /dev/null 2019-11-19 22:05:02.069813242 -0800 +++ new/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/src/com.bars/com/bars/Main.java 2020-06-10 11:20:58.311974508 -0700 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 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. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +package com.bars; +public class Main { + public static void main(String... args) { + try { + System.out.println("Main.class from " + Main.class.getModule()); + Class.forName("com.foos.Test"); + System.out.println("com.foos.Test found!"); + } catch (ClassNotFoundException e) { + System.out.println("ClassNotFoundException " + e); + } + } +} --- /dev/null 2019-11-19 22:05:02.069813242 -0800 +++ new/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/src/com.bars/module-info.java 2020-06-10 11:20:58.879995889 -0700 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 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. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +module com.bars { + requires com.foos; +} --- /dev/null 2019-11-19 22:05:02.069813242 -0800 +++ new/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/src/com.foos/com/foos/Test.java 2020-06-10 11:20:59.448017271 -0700 @@ -0,0 +1,31 @@ +/* + * Copyright (c) 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. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +package com.foos; +public class Test { + public static String getString() { return "Test"; } + public static void main(String args[]) { + System.out.println(getString()); + } +} --- /dev/null 2019-11-19 22:05:02.069813242 -0800 +++ new/test/hotspot/jtreg/runtime/cds/appcds/jigsaw/modulepath/src/com.foos/module-info.java 2020-06-10 11:21:00.020038803 -0700 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 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. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +module com.foos { + exports com.foos; +}