changeset 14480:f83388bef364

Add new modular resource bundle test
author okutsu
date Fri, 13 Nov 2015 22:20:14 -0800
parents 950cdf782005
children 6276fb427a98
files test/java/util/ResourceBundle/modules/visibility/src/embargo/jdk/embargo/TestWithNoModuleArg.java test/java/util/ResourceBundle/modules/visibility/src/embargo/jdk/embargo/TestWithUnnamedModuleArg.java test/java/util/ResourceBundle/modules/visibility/src/embargo/module-info.java test/java/util/ResourceBundle/modules/visibility/src/exported.named.bundles/jdk/test/resources/exported/classes/MyResources.java test/java/util/ResourceBundle/modules/visibility/src/exported.named.bundles/jdk/test/resources/exported/classes/MyResourcesProvider.java test/java/util/ResourceBundle/modules/visibility/src/exported.named.bundles/jdk/test/resources/exported/props/MyResources.properties test/java/util/ResourceBundle/modules/visibility/src/exported.named.bundles/module-info.java test/java/util/ResourceBundle/modules/visibility/src/named.bundles/jdk/test/resources/classes/MyResources.java test/java/util/ResourceBundle/modules/visibility/src/named.bundles/jdk/test/resources/classes/MyResourcesProvider.java test/java/util/ResourceBundle/modules/visibility/src/named.bundles/jdk/test/resources/props/MyResources.properties test/java/util/ResourceBundle/modules/visibility/src/named.bundles/jdk/test/resources/props/MyResourcesProvider.java test/java/util/ResourceBundle/modules/visibility/src/named.bundles/module-info.java test/java/util/ResourceBundle/modules/visibility/src/pkg/jdk/pkg/resources/classes/MyResources.java test/java/util/ResourceBundle/modules/visibility/src/pkg/jdk/pkg/resources/props/MyResources.properties test/java/util/ResourceBundle/modules/visibility/src/pkg/jdk/pkg/test/Main.java test/java/util/ResourceBundle/modules/visibility/src/test/jdk/test/TestWithNoModuleArg.java test/java/util/ResourceBundle/modules/visibility/src/test/jdk/test/TestWithUnnamedModuleArg.java test/java/util/ResourceBundle/modules/visibility/src/test/module-info.java test/java/util/ResourceBundle/modules/visibility/visibility.sh
diffstat 19 files changed, 1070 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/ResourceBundle/modules/visibility/src/embargo/jdk/embargo/TestWithNoModuleArg.java	Fri Nov 13 22:20:14 2015 -0800
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2015, 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 jdk.embargo;
+
+import java.lang.reflect.Module;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class TestWithNoModuleArg {
+    public static void main(String[] args) throws Exception {
+        if (args.length != 2) {
+            System.out.println("Usage: java ... basename should-be-loaded-flag");
+            System.out.println("  ex. java ... jdk.test.resources.classes.MyResources false");
+            return;
+        }
+
+        String basename = args[0];
+        boolean shouldBeLoaded = "true".equals(args[1]);
+
+        int errors = 0;
+        try {
+            // Set the default Locale to Locale.ROOT to avoid any confusions related to fallback
+            Locale.setDefault(Locale.ROOT);
+            ResourceBundle rb = ResourceBundle.getBundle(basename);
+            if (shouldBeLoaded) {
+                System.out.println("Passed: got resource bundle:");
+            } else {
+                System.out.println("Failed: no MissingResourceException thrown");
+                errors++;
+            }
+            System.out.println("            bundle = " + rb);
+        } catch (MissingResourceException e) {
+            if (!shouldBeLoaded) {
+                System.out.println("Passed: got expected " + e);
+            } else {
+                System.out.println("Failed: got unexpected " + e);
+                errors++;
+            }
+            System.out.println("            cause = " + e.getCause());
+        } catch (Throwable t) {
+            System.out.println("Failed: unexpected throwable: " + t);
+            errors++;
+        }
+
+        if (errors > 0) {
+            throw new RuntimeException(errors + " errors");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/ResourceBundle/modules/visibility/src/embargo/jdk/embargo/TestWithUnnamedModuleArg.java	Fri Nov 13 22:20:14 2015 -0800
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2015, 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 jdk.embargo;
+
+import java.lang.reflect.Module;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class TestWithUnnamedModuleArg {
+    public static void main(String[] args) throws Exception {
+        if (args.length != 2) {
+            System.out.println("Usage: java ... basename should-be-loaded-flag");
+            System.out.println("  ex. java ... jdk.test.resources.classes.MyResources false");
+            return;
+        }
+
+        String basename = args[0];
+        boolean shouldBeLoaded = "true".equals(args[1]);
+
+        int errors = 0;
+
+        ClassLoader cl = Thread.currentThread().getContextClassLoader();
+        if (cl == null) {
+            cl = ClassLoader.getSystemClassLoader();
+        }
+
+        try {
+            // Set the default Locale to Locale.ROOT to avoid any confusions related to fallback
+            Locale.setDefault(Locale.ROOT);
+            ResourceBundle rb = ResourceBundle.getBundle(basename,
+                                                         cl.getUnnamedModule());
+            if (shouldBeLoaded) {
+                System.out.println("Passed: got resource bundle:");
+            } else {
+                System.out.println("Failed: no MissingResourceException thrown");
+                errors++;
+            }
+            System.out.println("        bundle = " + rb);
+        } catch (MissingResourceException e) {
+            if (!shouldBeLoaded) {
+                System.out.println("Passed: got expected " + e);
+            } else {
+                System.out.println("Failed: got unexpected " + e);
+                errors++;
+            }
+            System.out.println("        cause = " + e.getCause());
+        } catch (Throwable t) {
+            System.out.println("Failed: unexpected throwable: " + t);
+            errors++;
+        }
+
+        if (errors > 0) {
+            throw new RuntimeException(errors + " errors");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/ResourceBundle/modules/visibility/src/embargo/module-info.java	Fri Nov 13 22:20:14 2015 -0800
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2015, 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 embargo {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/ResourceBundle/modules/visibility/src/exported.named.bundles/jdk/test/resources/exported/classes/MyResources.java	Fri Nov 13 22:20:14 2015 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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 jdk.test.resources.exported.classes;
+
+import java.util.ListResourceBundle;
+
+public class MyResources extends ListResourceBundle {
+    @Override
+    public Object[][] getContents() {
+        return new Object[][] {
+            { "key", "root: message" }
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/ResourceBundle/modules/visibility/src/exported.named.bundles/jdk/test/resources/exported/classes/MyResourcesProvider.java	Fri Nov 13 22:20:14 2015 -0800
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2015, 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 jdk.test.resources.exported.classes;
+
+import java.util.Locale;
+import java.util.spi.AbstractResourceBundleProvider;
+
+public class MyResourcesProvider extends AbstractResourceBundleProvider {
+    public MyResourcesProvider() {
+        super("java.class", "java.properties");
+        System.err.println("MyResourcesProvider called " + this);
+    }
+
+    @Override
+    protected String toBundleName(String baseName, Locale locale) {
+        StringBuilder sb = new StringBuilder(baseName);
+        String lang = locale.getLanguage();
+        if (!lang.isEmpty()) {
+            sb.append('_').append(lang);
+            String country = locale.getCountry();
+            if (!country.isEmpty()) {
+                sb.append('_').append(country);
+            }
+        }
+        return sb.toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/ResourceBundle/modules/visibility/src/exported.named.bundles/jdk/test/resources/exported/props/MyResources.properties	Fri Nov 13 22:20:14 2015 -0800
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+key=root: message
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/ResourceBundle/modules/visibility/src/exported.named.bundles/module-info.java	Fri Nov 13 22:20:14 2015 -0800
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2015, 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 exported.named.bundles {
+    // unqualified exports to verify that resource bundles are not picked
+    // up by other named modules
+    exports jdk.test.resources.exported.classes;
+    exports jdk.test.resources.exported.props;
+    provides jdk.test.resources.exported.classes.MyResourcesProvider
+        with jdk.test.resources.exported.classes.MyResourcesProvider;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/ResourceBundle/modules/visibility/src/named.bundles/jdk/test/resources/classes/MyResources.java	Fri Nov 13 22:20:14 2015 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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 jdk.test.resources.classes;
+
+import java.util.ListResourceBundle;
+
+public class MyResources extends ListResourceBundle {
+    @Override
+    public Object[][] getContents() {
+        return new Object[][] {
+            { "key", "root: message" }
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/ResourceBundle/modules/visibility/src/named.bundles/jdk/test/resources/classes/MyResourcesProvider.java	Fri Nov 13 22:20:14 2015 -0800
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2015, 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 jdk.test.resources.classes;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.spi.AbstractResourceBundleProvider;
+
+public class MyResourcesProvider extends AbstractResourceBundleProvider {
+    public MyResourcesProvider() {
+        super("java.class");
+    }
+
+    @Override
+    protected String toBundleName(String baseName, Locale locale) {
+        StringBuilder sb = new StringBuilder(baseName);
+        String lang = locale.getLanguage();
+        if (!lang.isEmpty()) {
+            sb.append('_').append(lang);
+            String country = locale.getCountry();
+            if (!country.isEmpty()) {
+                sb.append('_').append(country);
+            }
+        }
+        return sb.toString();
+    }
+
+    @Override
+    public ResourceBundle getBundle(String baseName, Locale locale) {
+        ResourceBundle rb = super.getBundle(baseName, locale);
+        String tag = locale.toLanguageTag();
+        if (tag.equals("und")) {
+            tag = "ROOT"; // to a human friendly name
+        }
+        System.out.printf("    MyResourcesProvider.getBundle(%s, %s)%n         -> %s%n",
+                          baseName, tag, rb);
+        return rb;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/ResourceBundle/modules/visibility/src/named.bundles/jdk/test/resources/props/MyResources.properties	Fri Nov 13 22:20:14 2015 -0800
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+key=root: message
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/ResourceBundle/modules/visibility/src/named.bundles/jdk/test/resources/props/MyResourcesProvider.java	Fri Nov 13 22:20:14 2015 -0800
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2015, 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 jdk.test.resources.props;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.spi.AbstractResourceBundleProvider;
+
+public class MyResourcesProvider extends AbstractResourceBundleProvider {
+    public MyResourcesProvider() {
+        super("java.properties");
+    }
+
+    @Override
+    protected String toBundleName(String baseName, Locale locale) {
+        StringBuilder sb = new StringBuilder(baseName);
+        String lang = locale.getLanguage();
+        if (!lang.isEmpty()) {
+            sb.append('_').append(lang);
+            String country = locale.getCountry();
+            if (!country.isEmpty()) {
+                sb.append('_').append(country);
+            }
+        }
+        return sb.toString();
+    }
+
+    @Override
+    public ResourceBundle getBundle(String baseName, Locale locale) {
+        ResourceBundle rb = super.getBundle(baseName, locale);
+        String tag = locale.toLanguageTag();
+        if (tag.equals("und")) {
+            tag = "ROOT"; // to a human friendly name
+        }
+        System.out.printf("    MyResourcesProvider.getBundle(%s, %s)%n         -> %s%n",
+                          baseName, tag, rb);
+        return rb;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/ResourceBundle/modules/visibility/src/named.bundles/module-info.java	Fri Nov 13 22:20:14 2015 -0800
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2015, 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 named.bundles {
+    exports jdk.test.resources.classes to test; // exports only to test
+    exports jdk.test.resources.props to test;   // exports only to test
+    provides jdk.test.resources.classes.MyResourcesProvider
+        with jdk.test.resources.classes.MyResourcesProvider;
+    provides jdk.test.resources.props.MyResourcesProvider
+        with jdk.test.resources.props.MyResourcesProvider;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/ResourceBundle/modules/visibility/src/pkg/jdk/pkg/resources/classes/MyResources.java	Fri Nov 13 22:20:14 2015 -0800
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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 jdk.pkg.resources.classes;
+
+import java.util.ListResourceBundle;
+
+public class MyResources extends ListResourceBundle {
+    @Override
+    public Object[][] getContents() {
+        return new Object[][] {
+            { "key", "root: message" }
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/ResourceBundle/modules/visibility/src/pkg/jdk/pkg/resources/props/MyResources.properties	Fri Nov 13 22:20:14 2015 -0800
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+key=root: message
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/ResourceBundle/modules/visibility/src/pkg/jdk/pkg/test/Main.java	Fri Nov 13 22:20:14 2015 -0800
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2015, 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 jdk.pkg.test;
+
+import java.lang.reflect.Module;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class Main {
+    public static void main(String[] args) throws Exception {
+        if (args.length != 2) {
+            System.out.println("Usage: java ... basename should-be-loaded-flag");
+            System.out.println("  ex. java ... jdk.test.resources.classes.MyResources false");
+            return;
+        }
+
+        String basename = args[0];
+        boolean shouldBeLoaded = "true".equals(args[1]);
+
+        int errors = 0;
+
+        ClassLoader cl = Thread.currentThread().getContextClassLoader();
+        if (cl == null) {
+            cl = ClassLoader.getSystemClassLoader();
+        }
+
+        try {
+            // Use the default Locale to avoid confusion related to fallback
+            Locale.setDefault(Locale.ENGLISH);
+            ResourceBundle rb = ResourceBundle.getBundle(basename,
+                                                         cl.getUnnamedModule());
+            if (shouldBeLoaded) {
+                System.out.println("Passed: got resource bundle:");
+            } else {
+                System.out.println("Failed: no MissingResourceException thrown");
+                errors++;
+            }
+            System.out.println("            bundle = " + rb);
+        } catch (MissingResourceException e) {
+            if (!shouldBeLoaded) {
+                System.out.println("Passed: got expected " + e);
+            } else {
+                System.out.println("Failed: got unexpected " + e);
+                errors++;
+            }
+            System.out.println("            cause = " + e.getCause());
+        } catch (Throwable t) {
+            System.out.println("Failed: unexpected throwable: " + t);
+            errors++;
+        }
+
+        if (errors > 0) {
+            throw new RuntimeException(errors + " errors");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/ResourceBundle/modules/visibility/src/test/jdk/test/TestWithNoModuleArg.java	Fri Nov 13 22:20:14 2015 -0800
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2015, 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 jdk.test;
+
+import java.lang.reflect.Module;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class TestWithNoModuleArg {
+    public static void main(String[] args) throws Exception {
+        if (args.length != 2) {
+            System.out.println("Usage: java ... basename should-be-loaded-flag");
+            System.out.println("  ex. java ... jdk.test.resources.classes.MyResources false");
+            return;
+        }
+
+        String basename = args[0];
+        boolean shouldBeLoaded = "true".equals(args[1]);
+
+        int errors = 0;
+        try {
+            // Set the default Locale to Locale.ROOT to avoid any confusions related to fallback
+            Locale.setDefault(Locale.ROOT);
+            ResourceBundle rb = ResourceBundle.getBundle(basename);
+            if (shouldBeLoaded) {
+                System.out.println("Passed: got resource bundle:");
+            } else {
+                System.out.println("Failed: no MissingResourceException thrown");
+                errors++;
+            }
+            System.out.println("            bundle = " + rb);
+        } catch (MissingResourceException e) {
+            if (!shouldBeLoaded) {
+                System.out.println("Passed: got expected " + e);
+            } else {
+                System.out.println("Failed: got unexpected " + e);
+                errors++;
+            }
+            System.out.println("            cause = " + e.getCause());
+        } catch (Throwable t) {
+            System.out.println("Failed: unexpected throwable: " + t);
+            errors++;
+        }
+
+        if (errors > 0) {
+            throw new RuntimeException(errors + " errors");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/ResourceBundle/modules/visibility/src/test/jdk/test/TestWithUnnamedModuleArg.java	Fri Nov 13 22:20:14 2015 -0800
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2015, 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 jdk.test;
+
+import java.lang.reflect.Module;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class TestWithUnnamedModuleArg {
+    public static void main(String[] args) throws Exception {
+        if (args.length != 2) {
+            System.out.println("Usage: java ... basename should-be-loaded-flag");
+            System.out.println("  ex. java ... jdk.test.resources.classes.MyResources false");
+            return;
+        }
+
+        String basename = args[0];
+        boolean shouldBeLoaded = "true".equals(args[1]);
+
+        int errors = 0;
+
+        ClassLoader cl = Thread.currentThread().getContextClassLoader();
+        if (cl == null) {
+            cl = ClassLoader.getSystemClassLoader();
+        }
+
+        try {
+            // Set the default Locale to Locale.ROOT to avoid any confusions related to fallback
+            Locale.setDefault(Locale.ROOT);
+            ResourceBundle rb = ResourceBundle.getBundle(basename,
+                                                         cl.getUnnamedModule());
+            if (shouldBeLoaded) {
+                System.out.println("Passed: got resource bundle:");
+            } else {
+                System.out.println("Failed: no MissingResourceException thrown");
+                errors++;
+            }
+            System.out.println("            bundle = " + rb);
+        } catch (MissingResourceException e) {
+            if (!shouldBeLoaded) {
+                System.out.println("Passed: got expected " + e);
+            } else {
+                System.out.println("Failed: got unexpected " + e);
+                errors++;
+            }
+            System.out.println("            cause = " + e.getCause());
+        } catch (Throwable t) {
+            System.out.println("Failed: unexpected throwable: " + t);
+            errors++;
+        }
+
+        if (errors > 0) {
+            throw new RuntimeException(errors + " errors");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/ResourceBundle/modules/visibility/src/test/module-info.java	Fri Nov 13 22:20:14 2015 -0800
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2015, 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 test {
+    // jdk.test.resources.classes.MyResourcesProvider is in named.bundles.
+    requires named.bundles;
+    uses jdk.test.resources.classes.MyResourcesProvider;
+    uses jdk.test.resources.props.MyResourcesProvider;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/ResourceBundle/modules/visibility/visibility.sh	Fri Nov 13 22:20:14 2015 -0800
@@ -0,0 +1,233 @@
+#
+# Copyright (c) 2015, 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
+# @bug 8137317 8139238
+# @summary Visibility tests for ResourceBundle.getBundle with and without
+# an unnamed module argument.
+
+
+set -e
+STATUS=0
+
+runJava()
+{
+    echo "Executing java $@"
+    $JAVA $@ || STATUS=1
+    echo
+}
+
+if [ -z "$TESTJAVA" ]; then
+  if [ $# -lt 1 ]; then exit 1; fi
+  TESTJAVA="$1"; shift
+  COMPILEJAVA="${TESTJAVA}"
+  TESTSRC="`pwd`"
+  TESTCLASSES="`pwd`"
+fi
+
+JAVAC="$COMPILEJAVA/bin/javac"
+JAVA="$TESTJAVA/bin/java"
+
+rm -rf mods classes
+
+MODS=`cd $TESTSRC/src; find . -name module-info.java -exec dirname {} \; | sed 's:\./::'`
+
+for M in $MODS
+do
+    mkdir -p mods/$M
+    CLASSES="`find $TESTSRC/src/$M -name '*.java'`"
+    if [ "x$CLASSES" != x ]; then
+        $JAVAC -g -d mods -modulesourcepath $TESTSRC/src $CLASSES
+    fi
+    PROPS="`(cd $TESTSRC/src/$M; find . -name '*.properties')`"
+    if [ "x$PROPS" != x ]; then
+        for P in $PROPS
+        do
+            D=`dirname $P`
+            mkdir -p mods/$M/$D
+            cp $TESTSRC/src/$M/$P mods/$M/$D/
+        done
+    fi
+done
+
+# Package jdk.test is in named module "test".
+# Package jdk.embargo is in named module "embargo".
+
+# jdk.{test,embargo}.TestWithUnnamedModuleArg call:
+#     ResourceBundle.getBundle(basename, classloader.getUnnamedModule())
+#     where classloader is the TCCL or system class loader.
+# jdk.{test,embargo}.TestWithNoModuleArg call:
+#     ResourceBundle.getBundle(basename)
+
+# jdk.test.resources[.exported].classes.* are class-based resource bundles.
+# jdk.test.resources[.exported].props.* are properties file-based resource bundles.
+
+# Packages jdk.test.resources.{classes,props} in named module "named.bundles"
+# are exported only to named module "test".
+# Packages jdk.test.resources.exported.{classes,props} in named module
+# "exported.named.bundle" are exported to unnamed modules.
+
+########################################
+# Test cases with jdk.test.resources.* #
+########################################
+
+# Tests using jdk.test.TestWithNoModuleArg and jdk.embargo.TestWithNoModuleArg
+# neither of which specifies an unnamed module with ResourceBundle.getBundle().
+
+# jdk.test.resources.{classes,props}.* are available only to named module "test"
+# by ResourceBundleProvider.
+runJava -mp mods -m test/jdk.test.TestWithNoModuleArg \
+    jdk.test.resources.classes.MyResources true
+runJava -mp mods -m test/jdk.test.TestWithNoModuleArg \
+    jdk.test.resources.props.MyResources true
+runJava -mp mods -m embargo/jdk.embargo.TestWithNoModuleArg \
+    jdk.test.resources.classes.MyResources false
+runJava -mp mods -m embargo/jdk.embargo.TestWithNoModuleArg \
+    jdk.test.resources.props.MyResources false
+
+# Add mods/named.bundles to the class path.
+runJava -cp mods/named.bundles -mp mods -m test/jdk.test.TestWithNoModuleArg \
+    jdk.test.resources.classes.MyResources true
+runJava -cp mods/named.bundles -mp mods -m test/jdk.test.TestWithNoModuleArg \
+    jdk.test.resources.props.MyResources true
+runJava -cp mods/named.bundles -mp mods -m embargo/jdk.embargo.TestWithNoModuleArg \
+    jdk.test.resources.classes.MyResources false
+runJava -cp mods/named.bundles -mp mods -m embargo/jdk.embargo.TestWithNoModuleArg \
+    jdk.test.resources.props.MyResources false
+
+# Tests using jdk.test.TestWithUnnamedModuleArg and jdk.embargo.TestWithUnnamedModuleArg
+# both of which specify an unnamed module with ResourceBundle.getBundle.
+
+# jdk.test.resources.classes is exported to named module "test".
+# IllegalAccessException is thrown in ResourceBundle.Control.newBundle().
+runJava -mp mods -m test/jdk.test.TestWithUnnamedModuleArg \
+    jdk.test.resources.classes.MyResources false
+
+# jdk.test.resources.props is exported to named module "test".
+# loader.getResource() doesn't find jdk.test.resources.props.MyResources.
+runJava -mp mods -m test/jdk.test.TestWithUnnamedModuleArg \
+    jdk.test.resources.props.MyResources false
+
+# IllegalAccessException is thrown in ResourceBundle.Control.newBundle().
+runJava -mp mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
+    jdk.test.resources.classes.MyResources false
+# jdk.test.resources.props is exported to named module "test".
+# loader.getResource() doesn't find jdk.test.resources.props.MyResources.
+runJava -mp mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
+    jdk.test.resources.props.MyResources false
+
+# Add mods/named.bundles to the class path
+
+# IllegalAccessException is thrown in ResourceBundle.Control.newBundle().
+runJava -cp mods/named.bundles -mp mods -m test/jdk.test.TestWithUnnamedModuleArg \
+        jdk.test.resources.classes.MyResources false
+# loader.getResource() finds jdk.test.resources.exported.props.MyResources.
+runJava -cp mods/named.bundles -mp mods -m test/jdk.test.TestWithUnnamedModuleArg \
+        jdk.test.resources.props.MyResources true
+
+# jdk.test.resources.exported.classes.MyResources is treated
+# as if the class is in an unnamed module.
+runJava -cp mods/named.bundles -mp mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
+        jdk.test.resources.classes.MyResources true
+# loader.getResource() finds jdk.test.resources.exported.props.MyResources.
+runJava -cp mods/named.bundles -mp mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
+        jdk.test.resources.props.MyResources true
+
+#################################################
+# Test cases with jdk.test.resources.exported.* #
+#################################################
+# Tests using jdk.test.TestWithNoModuleArg and jdk.embargo.TestWithNoModuleArg
+# neither of which specifies an unnamed module with ResourceBundle.getBundle.
+
+# None of jdk.test.resources.exported.** is available to the named modules.
+runJava -mp mods -m test/jdk.test.TestWithNoModuleArg \
+    jdk.test.resources.exported.classes.MyResources false
+runJava -mp mods -m test/jdk.test.TestWithNoModuleArg \
+    jdk.test.resources.exported.props.MyResources false
+runJava -mp mods -m embargo/jdk.embargo.TestWithNoModuleArg \
+    jdk.test.resources.exported.classes.MyResources false
+runJava -mp mods -m embargo/jdk.embargo.TestWithNoModuleArg \
+    jdk.test.resources.exported.props.MyResources false
+
+# Add mods/exported.named.bundles to the class path.
+runJava -cp mods/exported.named.bundles -mp mods -m test/jdk.test.TestWithNoModuleArg \
+    jdk.test.resources.exported.classes.MyResources false
+runJava -cp mods/exported.named.bundles -mp mods -m test/jdk.test.TestWithNoModuleArg \
+    jdk.test.resources.exported.props.MyResources false
+runJava -cp mods/exported.named.bundles -mp mods -m embargo/jdk.embargo.TestWithNoModuleArg \
+    jdk.test.resources.exported.classes.MyResources false
+runJava -cp mods/exported.named.bundles -mp mods -m embargo/jdk.embargo.TestWithNoModuleArg \
+    jdk.test.resources.exported.props.MyResources false
+
+# Tests using jdk.test.TestWithUnnamedModuleArg and jdk.embargo.TestWithUnnamedModuleArg
+# which specify an unnamed module with ResourceBundle.getBundle.
+
+# loader.loadClass() doesn't find jdk.test.resources.exported.classes.MyResources
+# and throws a ClassNotFoundException.
+runJava -mp mods -m test/jdk.test.TestWithUnnamedModuleArg \
+        jdk.test.resources.exported.classes.MyResources false
+# The properties files in jdk.test.resources.exported.props are not found with loader.getResource().
+runJava -mp mods -m test/jdk.test.TestWithUnnamedModuleArg \
+        jdk.test.resources.exported.props.MyResources false
+
+
+# loader.loadClass() doesn't find jdk.test.resources.exported.classes.MyResources
+# and throws a ClassNotFoundException.
+runJava -mp mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
+        jdk.test.resources.exported.classes.MyResources false
+# The properties files in jdk.test.resources.exported.props are not found
+# with loader.getResource().
+runJava -mp mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
+        jdk.test.resources.exported.props.MyResources false
+
+# Add mods/exported.named.bundles to the class path.
+
+# jdk.test.resources.exported.classes.MyResources.getModule().isNamed() returns false.
+runJava -cp mods/exported.named.bundles -mp mods -m test/jdk.test.TestWithUnnamedModuleArg \
+        jdk.test.resources.exported.classes.MyResources true
+# loader.getResource() finds jdk.test.resources.exported.props.MyResources.
+runJava -cp mods/exported.named.bundles -mp mods -m test/jdk.test.TestWithUnnamedModuleArg \
+        jdk.test.resources.exported.props.MyResources true
+
+# jdk.test.resources.exported.classes.MyResources.getModule().isNamed() returns false.
+runJava -cp mods/exported.named.bundles -mp mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
+        jdk.test.resources.exported.classes.MyResources true
+# loader.getResource() finds jdk.test.resources.exported.props.MyResources.
+runJava -cp mods/exported.named.bundles -mp mods -m embargo/jdk.embargo.TestWithUnnamedModuleArg \
+        jdk.test.resources.exported.props.MyResources true
+
+#######################################
+# Test cases with jdk.pkg.resources.* #
+#######################################
+# Prepare resource bundles in an unnamed module
+PKG=$TESTSRC/src/pkg
+mkdir -p classes/jdk/pkg/resources/props
+$JAVAC -g -d classes $PKG/jdk/pkg/test/Main.java $PKG/jdk/pkg/resources/classes/MyResources.java
+cp $PKG/jdk/pkg/resources/props/MyResources.properties classes/jdk/pkg/resources/props
+
+# jdk.pkg.resources.* are in an unnamed module.
+# jdk.pkg.test.Main calls ResourceBundle.getBundle with an unnamed module.
+runJava -cp classes jdk.pkg.test.Main jdk.pkg.resources.classes.MyResources true
+runJava -cp classes jdk.pkg.test.Main jdk.pkg.resources.props.MyResources true
+
+exit $STATUS