@@ -924,7 +925,12 @@ *
Resource bundles in named modules may be encapsulated. When
* the resource bundle is loaded from a provider, the caller module
* must have an appropriate uses clause in its module descriptor
- * to declare that the module uses implementations of {@code "baseName"Provider}.
+ * to declare that the module uses implementations of
+ * {@code Resource bundles in named modules may be encapsulated. When
* the resource bundle is loaded from a provider, the caller module
* must have an appropriate uses clause in its module descriptor
- * to declare that the module uses implementations of {@code "baseName"Provider}.
+ * to declare that the module uses implementations of
+ * {@code
- * If the given {@code module} is a named module, this method will
- * load the service providers for {@link java.util.spi.ResourceBundleProvider}
- * and also resource bundles that are local in the given module or that
- * are visible to the class loader of the given module (refer to the
- * Resource Bundles in Named Modules section
- * for details).
- *
- *
* If the given {@code module} is an unnamed module, then this method is
* equivalent to calling {@link #getBundle(String, Locale, ClassLoader)
* getBundle(baseName, targetLocale, module.getClassLoader()} to load
@@ -1071,8 +1074,10 @@
* Resource bundles in a named module are private to that module. If
* the caller is in a named module, this method will find resource bundles
* from the service providers of {@link java.util.spi.ResourceBundleProvider}
- * and also find resource bundles that are in the caller's module or
- * that are visible to the given class loader.
+ * if any. Otherwise, it will load the resource bundles that are visible to
+ * the given {@code loader} (refer to the
+ * Resource Bundles in Named Modules section
+ * for details).
* If the caller is in a named module and the given {@code loader} is
* different than the caller's class loader, or if the caller is not in
* a named module, this method will not find resource bundles from named
--- old/src/java.base/share/classes/java/util/spi/ResourceBundleProvider.java 2017-05-17 14:54:58.498076344 -0700
+++ new/src/java.base/share/classes/java/util/spi/ResourceBundleProvider.java 2017-05-17 14:54:58.192071089 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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
@@ -35,11 +35,11 @@
* during a call to the
* {@link ResourceBundle#getBundle(String, Locale, ClassLoader)
* ResourceBundle.getBundle} method. The provider service type is determined by
- * {@code basename+"Provider"}.
+ * {@code
* For example, if the base name is "com.example.app.MyResources",
- * {@code com.example.app.MyResourcesProvider} will be the provider service type:
+ * {@code com.example.app.spi.MyResourcesProvider} will be the provider service type:
* {@code
* public interface MyResourcesProvider extends ResourceBundleProvider {
* }
--- old/test/java/util/ResourceBundle/modules/appbasic/src/test/module-info.java 2017-05-17 14:54:59.547094361 -0700
+++ new/test/java/util/ResourceBundle/modules/appbasic/src/test/module-info.java 2017-05-17 14:54:59.235089002 -0700
@@ -24,5 +24,5 @@
module test {
exports jdk.test.resources.spi to eubundles, asiabundles;
uses jdk.test.resources.spi.MyResourcesProvider;
- provides jdk.test.resources.spi.MyResourcesProvider with jdk.test.resources.spi.MyResourcesProviderImpl;
+ provides jdk.test.resources.spi.MyResourcesProvider with jdk.test.resources.MyResourcesProviderImpl;
}
--- old/test/java/util/ResourceBundle/modules/appbasic2/src/test/module-info.java 2017-05-17 14:55:00.594112343 -0700
+++ new/test/java/util/ResourceBundle/modules/appbasic2/src/test/module-info.java 2017-05-17 14:55:00.291107139 -0700
@@ -24,5 +24,5 @@
module test {
exports jdk.test.resources.spi to eubundles, asiabundles;
uses jdk.test.resources.spi.MyResourcesProvider;
- provides jdk.test.resources.spi.MyResourcesProvider with jdk.test.resources.spi.MyResourcesProviderImpl;
+ provides jdk.test.resources.spi.MyResourcesProvider with jdk.test.resources.MyResourcesProviderImpl;
}
--- old/test/java/util/ResourceBundle/modules/layer/src/Main.java 2017-05-17 14:55:01.735131940 -0700
+++ new/test/java/util/ResourceBundle/modules/layer/src/Main.java 2017-05-17 14:55:01.431126719 -0700
@@ -34,16 +34,23 @@
ModuleFinder afterFinder = ModuleFinder.of(Paths.get("mods"));
Configuration cf = ModuleLayer.boot().configuration()
- .resolveAndBind(ModuleFinder.of(), afterFinder, List.of("m1", "m2"));
+ .resolveAndBind(ModuleFinder.of(), afterFinder,
+ List.of("m1", "m2"));
System.out.println("Configuration: " + cf);
ModuleLayer l = ModuleLayer.defineModulesWithManyLoaders(cf,
- List.of(ModuleLayer.boot()), ClassLoader.getPlatformClassLoader()).layer();
+ List.of(ModuleLayer.boot()),
+ ClassLoader.getPlatformClassLoader())
+ .layer();
Module m1 = l.findModule("m1").get();
- ResourceBundle bundle = ResourceBundle.getBundle("p.resources.MyResource", Locale.US, m1);
- ResourceBundle jabundle = ResourceBundle.getBundle("p.resources.MyResource", Locale.JAPANESE, m1);
+ ResourceBundle bundle =
+ ResourceBundle.getBundle("p.resources.MyResource",
+ Locale.US, m1);
+ ResourceBundle jabundle =
+ ResourceBundle.getBundle("p.resources.MyResource",
+ Locale.JAPANESE, m1);
String enResult = bundle.getString("key");
String jaResult = jabundle.getString("key");
--- old/test/java/util/ResourceBundle/modules/layer/src/m1/p/Main.java 2017-05-17 14:55:02.829150729 -0700
+++ new/test/java/util/ResourceBundle/modules/layer/src/m1/p/Main.java 2017-05-17 14:55:02.515145336 -0700
@@ -33,11 +33,15 @@
}
public static void run() {
- ClassLoader loader = Main.class.getModule().getLayer().findLoader("m1");
- ClassLoader loader2 = Main.class.getModule().getLayer().findLoader("m2");
+ ClassLoader loader =
+ Main.class.getModule().getLayer().findLoader("m1");
+ ClassLoader loader2 =
+ Main.class.getModule().getLayer().findLoader("m2");
- ResourceBundle bundle = ResourceBundle.getBundle("p.resources.MyResource", Locale.US);
- ResourceBundle bundle1 = ResourceBundle.getBundle("p.resources.MyResource", Locale.JAPANESE);
+ ResourceBundle bundle =
+ ResourceBundle.getBundle("p.resources.MyResource", Locale.US);
+ ResourceBundle bundle1 =
+ ResourceBundle.getBundle("p.resources.MyResource", Locale.JAPANESE);
String enResult = bundle.getString("key");
String jaResult = bundle1.getString("key");
--- old/test/java/util/ResourceBundle/modules/appbasic/src/test/jdk/test/resources/spi/MyResourcesProviderImpl.java 2017-05-17 14:55:04.307176114 -0700
+++ /dev/null 2017-04-28 23:56:08.684813438 -0700
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.spi;
-
-import java.util.Locale;
-import java.util.ResourceBundle;
-import java.util.spi.AbstractResourceBundleProvider;
-
-public class MyResourcesProviderImpl extends AbstractResourceBundleProvider
- implements MyResourcesProvider
-{
- public MyResourcesProviderImpl() {
- super("java.class");
- }
- @Override
- public ResourceBundle getBundle(String baseName, Locale locale) {
- if (locale.equals(Locale.ENGLISH) || locale.equals(Locale.ROOT)) {
- return super.getBundle(baseName, locale);
- }
- return null;
- }
-}
--- /dev/null 2017-04-28 23:56:08.684813438 -0700
+++ new/test/java/util/ResourceBundle/modules/appbasic/src/test/jdk/test/resources/MyResourcesProviderImpl.java 2017-05-17 14:55:03.622164349 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2015, 2017, 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;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.spi.AbstractResourceBundleProvider;
+import jdk.test.resources.spi.MyResourcesProvider;
+
+public class MyResourcesProviderImpl extends AbstractResourceBundleProvider
+ implements MyResourcesProvider
+{
+ public MyResourcesProviderImpl() {
+ super("java.class");
+ }
+ @Override
+ public ResourceBundle getBundle(String baseName, Locale locale) {
+ if (locale.equals(Locale.ENGLISH) || locale.equals(Locale.ROOT)) {
+ return super.getBundle(baseName, locale);
+ }
+ return null;
+ }
+}
--- old/test/java/util/ResourceBundle/modules/appbasic2/src/test/jdk/test/resources/spi/MyResourcesProviderImpl.java 2017-05-17 14:55:05.687199815 -0700
+++ /dev/null 2017-04-28 23:56:08.684813438 -0700
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2015, 2017, 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.spi;
-
-import java.util.Locale;
-
-public class MyResourcesProviderImpl extends MyResourcesProvider {
- public MyResourcesProviderImpl() {
- super("java.class");
- }
-
- @Override
- protected String toBundleName(String baseName, Locale locale) {
- return locale.equals(Locale.ROOT) ? baseName : baseName + '_' + locale.getLanguage();
- }
-
- @Override
- protected boolean isSupportedInModule(Locale locale) {
- return locale.equals(Locale.ENGLISH) || locale.equals(Locale.ROOT);
- }
-}
--- /dev/null 2017-04-28 23:56:08.684813438 -0700
+++ new/test/java/util/ResourceBundle/modules/appbasic2/src/test/jdk/test/resources/MyResourcesProviderImpl.java 2017-05-17 14:55:05.087189510 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2015, 2017, 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;
+
+import java.util.Locale;
+import jdk.test.resources.spi.MyResourcesProvider;
+
+public class MyResourcesProviderImpl extends MyResourcesProvider {
+ public MyResourcesProviderImpl() {
+ super("java.class");
+ }
+
+ @Override
+ protected String toBundleName(String baseName, Locale locale) {
+ return locale.equals(Locale.ROOT) ? baseName : baseName + '_' + locale.getLanguage();
+ }
+
+ @Override
+ protected boolean isSupportedInModule(Locale locale) {
+ return locale.equals(Locale.ENGLISH) || locale.equals(Locale.ROOT);
+ }
+}