8240245: Avoid calling is_shared_class_visible() in SystemDictionary::load_shared_class()

SystemDitionary::load_shared_class can avoid calling is_shared_class_visible if dumptime and runtime do not use modulepath and boot classpath appending.

Reviewed-by: iklam, ccheung
This commit is contained in:
Yumin Qi 2020-06-10 23:16:27 -07:00
parent 6d8c81f694
commit 96fadefaa3
14 changed files with 496 additions and 17 deletions

View File

@ -1528,6 +1528,19 @@ void ClassLoader::initialize_module_path(TRAPS) {
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() {

View File

@ -388,16 +388,7 @@ class ClassLoader: AllStatic {
// 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);

View File

@ -1232,6 +1232,7 @@ InstanceKlass* SystemDictionary::resolve_from_stream(Symbol* class_name,
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 @@ bool SystemDictionary::is_shared_class_visible(Symbol* class_name,
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()) {
@ -1596,12 +1609,14 @@ InstanceKlass* SystemDictionary::load_instance_class(Symbol* class_name, Handle
// 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

View File

@ -629,6 +629,10 @@ protected:
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);

View File

@ -217,6 +217,7 @@ void FileMapHeader::populate(FileMapInfo* mapinfo, size_t alignment) {
_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 @@ bool FileMapHeader::validate() {
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;
}

View File

@ -227,6 +227,8 @@ class FileMapHeader: private CDSFileMapHeaderBase {
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 {

View File

@ -89,6 +89,7 @@ size_t MetaspaceShared::_i2i_entry_code_buffers_size = 0;
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 @@ MapArchiveResult MetaspaceShared::map_archives(FileMapInfo* static_mapinfo, File
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);

View File

@ -184,6 +184,7 @@ class MetaspaceShared : AllStatic {
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 @@ class MetaspaceShared : AllStatic {
static void write_core_archive_regions(FileMapInfo* mapinfo,
GrowableArray<ArchiveHeapOopmapInfo>* closed_oopmaps,
GrowableArray<ArchiveHeapOopmapInfo>* 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,

View File

@ -1467,6 +1467,12 @@ bool Arguments::add_property(const char* prop, PropertyWriteable writeable, Prop
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 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m
// -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(),

View File

@ -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);
});
}
}

View File

@ -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);
}
}
}

View File

@ -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;
}

View File

@ -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());
}
}

View File

@ -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;
}