8180375: Rename <baseName>Provider to <packagename>.spi.<simpleName>Provider

Reviewed-by: mchung
This commit is contained in:
Naoto Sato 2017-06-01 14:52:53 -07:00
parent 59744df73d
commit b2870f2b5f
46 changed files with 520 additions and 102 deletions

View file

@ -216,16 +216,17 @@ import static sun.security.util.SecurityConstants.GET_CLASSLOADER_PERMISSION;
* the caller module, those resource bundles need to be loaded from service * the caller module, those resource bundles need to be loaded from service
* providers of {@link ResourceBundleProvider}. The caller module must declare * providers of {@link ResourceBundleProvider}. The caller module must declare
* "{@code uses}" and the service interface name is the concatenation of the * "{@code uses}" and the service interface name is the concatenation of the
* base name of the bundles and the string "{@code Provider}". The * package name of the base name, string "{@code .spi.}", the simple class
* name of the base name, and the string "{@code Provider}". The
* <em>bundle provider modules</em> containing resource bundles must * <em>bundle provider modules</em> containing resource bundles must
* declare "{@code provides}" with the service interface name and * declare "{@code provides}" with the service interface name and
* its implementation class name. For example, if the base name is * its implementation class name. For example, if the base name is
* "{@code com.example.app.MyResources}", the caller module must declare * "{@code com.example.app.MyResources}", the caller module must declare
* "{@code uses com.example.app.MyResourcesProvider;}" and a module containing resource * "{@code uses com.example.app.spi.MyResourcesProvider;}" and a module containing resource
* bundles must declare "{@code provides com.example.app.MyResourcesProvider * bundles must declare "{@code provides com.example.app.spi.MyResourcesProvider
* with com.example.app.internal.MyResourcesProviderImpl;}" * with com.example.app.internal.MyResourcesProviderImpl;}"
* where {@code com.example.app.internal.MyResourcesProviderImpl} is an * where {@code com.example.app.internal.MyResourcesProviderImpl} is an
* implementation class of {@code com.example.app.MyResourcesProvider}.</li> * implementation class of {@code com.example.app.spi.MyResourcesProvider}.</li>
* <li>If you want to use non-standard formats in named modules, such as XML, * <li>If you want to use non-standard formats in named modules, such as XML,
* {@link ResourceBundleProvider} needs to be used.</li> * {@link ResourceBundleProvider} needs to be used.</li>
* <li>The {@code getBundle} method with a {@code ClassLoader} may not be able to * <li>The {@code getBundle} method with a {@code ClassLoader} may not be able to
@ -243,9 +244,10 @@ import static sun.security.util.SecurityConstants.GET_CLASSLOADER_PERMISSION;
* *
* The {@code getBundle} factory methods load service providers of * The {@code getBundle} factory methods load service providers of
* {@link ResourceBundleProvider}, if available, using {@link ServiceLoader}. * {@link ResourceBundleProvider}, if available, using {@link ServiceLoader}.
* The service type is designated by {@code basename+"Provider"}. For * The service type is designated by
* {@code <package name> + ".spi." + <simple name> + "Provider"}. For
* example, if the base name is "{@code com.example.app.MyResources}", the service * example, if the base name is "{@code com.example.app.MyResources}", the service
* type is {@code com.example.app.MyResourcesProvider}. * type is {@code com.example.app.spi.MyResourcesProvider}.
* <p> * <p>
* In named modules, the loaded service providers for the given base name are * In named modules, the loaded service providers for the given base name are
* used to load resource bundles. If no service provider is available, or if * used to load resource bundles. If no service provider is available, or if
@ -923,7 +925,12 @@ public abstract class ResourceBundle {
* <p> Resource bundles in named modules may be encapsulated. When * <p> Resource bundles in named modules may be encapsulated. When
* the resource bundle is loaded from a provider, the caller module * the resource bundle is loaded from a provider, the caller module
* must have an appropriate <i>uses</i> clause in its <i>module descriptor</i> * must have an appropriate <i>uses</i> clause in its <i>module descriptor</i>
* to declare that the module uses implementations of {@code "baseName"Provider}. * to declare that the module uses implementations of
* {@code <package name> + ".spi." + <simple name> + "Provider"}.
* Otherwise, it will load the resource bundles that are local in the
* given module or that are visible to the class loader of the given module
* (refer to the <a href="#bundleprovider">Resource Bundles in Named Modules</a>
* section for details).
* When the resource bundle is loaded from the specified module, it is * When the resource bundle is loaded from the specified module, it is
* subject to the encapsulation rules specified by * subject to the encapsulation rules specified by
* {@link Module#getResourceAsStream Module.getResourceAsStream}. * {@link Module#getResourceAsStream Module.getResourceAsStream}.
@ -958,20 +965,17 @@ public abstract class ResourceBundle {
* <p> Resource bundles in named modules may be encapsulated. When * <p> Resource bundles in named modules may be encapsulated. When
* the resource bundle is loaded from a provider, the caller module * the resource bundle is loaded from a provider, the caller module
* must have an appropriate <i>uses</i> clause in its <i>module descriptor</i> * must have an appropriate <i>uses</i> clause in its <i>module descriptor</i>
* to declare that the module uses implementations of {@code "baseName"Provider}. * to declare that the module uses implementations of
* {@code <package name> + ".spi." + <simple name> + "Provider"}.
* Otherwise, it will load the resource bundles that are local in the
* given module or that are visible to the class loader of the given module
* (refer to the <a href="#bundleprovider">Resource Bundles in Named Modules</a>
* section for details).
* When the resource bundle is loaded from the specified module, it is * When the resource bundle is loaded from the specified module, it is
* subject to the encapsulation rules specified by * subject to the encapsulation rules specified by
* {@link Module#getResourceAsStream Module.getResourceAsStream}. * {@link Module#getResourceAsStream Module.getResourceAsStream}.
* *
* <p> * <p>
* 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
* <a href="#bundleprovider">Resource Bundles in Named Modules</a> section
* for details).
*
* <p>
* If the given {@code module} is an unnamed module, then this method is * If the given {@code module} is an unnamed module, then this method is
* equivalent to calling {@link #getBundle(String, Locale, ClassLoader) * equivalent to calling {@link #getBundle(String, Locale, ClassLoader)
* getBundle(baseName, targetLocale, module.getClassLoader()} to load * getBundle(baseName, targetLocale, module.getClassLoader()} to load
@ -1070,8 +1074,10 @@ public abstract class ResourceBundle {
* Resource bundles in a named module are private to that module. If * 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 * the caller is in a named module, this method will find resource bundles
* from the service providers of {@link java.util.spi.ResourceBundleProvider} * from the service providers of {@link java.util.spi.ResourceBundleProvider}
* and also find resource bundles that are in the caller's module or * if any. Otherwise, it will load the resource bundles that are visible to
* that are visible to the given class loader. * the given {@code loader} (refer to the
* <a href="#bundleprovider">Resource Bundles in Named Modules</a> section
* for details).
* If the caller is in a named module and the given {@code loader} is * 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 * 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 * a named module, this method will not find resource bundles from named
@ -1883,8 +1889,15 @@ public abstract class ResourceBundle {
private static Class<ResourceBundleProvider> private static Class<ResourceBundleProvider>
getResourceBundleProviderType(String baseName, ClassLoader loader) getResourceBundleProviderType(String baseName, ClassLoader loader)
{ {
// Look up <baseName> + "Provider" // Look up <packagename> + ".spi." + <name>"Provider"
String providerName = baseName + "Provider"; int i = baseName.lastIndexOf('.');
if (i <= 0) {
return null;
}
String name = baseName.substring(i+1, baseName.length()) + "Provider";
String providerName = baseName.substring(0, i) + ".spi." + name;
// Use the class loader of the getBundle caller so that the caller's // Use the class loader of the getBundle caller so that the caller's
// visibility of the provider type is checked. // visibility of the provider type is checked.
return AccessController.doPrivileged( return AccessController.doPrivileged(

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -35,11 +35,11 @@ import java.util.ResourceBundle;
* during a call to the * during a call to the
* {@link ResourceBundle#getBundle(String, Locale, ClassLoader) * {@link ResourceBundle#getBundle(String, Locale, ClassLoader)
* ResourceBundle.getBundle} method. The provider service type is determined by * ResourceBundle.getBundle} method. The provider service type is determined by
* {@code basename+"Provider"}. * {@code <package name> + ".spi." + <simple name> + "Provider"}.
* *
* <p> * <p>
* For example, if the base name is "com.example.app.MyResources", * 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:
* <pre>{@code * <pre>{@code
* public interface MyResourcesProvider extends ResourceBundleProvider { * public interface MyResourcesProvider extends ResourceBundleProvider {
* } * }

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,7 @@ import java.util.ResourceBundle;
import java.util.Set; import java.util.Set;
import java.util.spi.AbstractResourceBundleProvider; import java.util.spi.AbstractResourceBundleProvider;
import jdk.test.resources.MyResourcesProvider; import jdk.test.resources.spi.MyResourcesProvider;
public class MyResourcesAsia extends AbstractResourceBundleProvider public class MyResourcesAsia extends AbstractResourceBundleProvider
implements MyResourcesProvider implements MyResourcesProvider

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,6 @@
module asiabundles { module asiabundles {
requires test; requires test;
provides jdk.test.resources.MyResourcesProvider provides jdk.test.resources.spi.MyResourcesProvider
with jdk.test.resources.asia.MyResourcesAsia; with jdk.test.resources.asia.MyResourcesAsia;
} }

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,7 @@ import java.util.ResourceBundle;
import java.util.Set; import java.util.Set;
import java.util.spi.AbstractResourceBundleProvider; import java.util.spi.AbstractResourceBundleProvider;
import jdk.test.resources.MyResourcesProvider; import jdk.test.resources.spi.MyResourcesProvider;
public class MyResourcesEU extends AbstractResourceBundleProvider public class MyResourcesEU extends AbstractResourceBundleProvider
implements MyResourcesProvider implements MyResourcesProvider

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,6 @@
module eubundles { module eubundles {
requires test; requires test;
provides jdk.test.resources.MyResourcesProvider provides jdk.test.resources.spi.MyResourcesProvider
with jdk.test.resources.eu.MyResourcesEU; with jdk.test.resources.eu.MyResourcesEU;
} }

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,7 @@ package jdk.test.resources;
import java.util.Locale; import java.util.Locale;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import java.util.spi.AbstractResourceBundleProvider; import java.util.spi.AbstractResourceBundleProvider;
import jdk.test.resources.spi.MyResourcesProvider;
public class MyResourcesProviderImpl extends AbstractResourceBundleProvider public class MyResourcesProviderImpl extends AbstractResourceBundleProvider
implements MyResourcesProvider implements MyResourcesProvider

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -21,7 +21,7 @@
* questions. * questions.
*/ */
package jdk.test.resources; package jdk.test.resources.spi;
import java.util.spi.ResourceBundleProvider; import java.util.spi.ResourceBundleProvider;

View file

@ -22,7 +22,7 @@
*/ */
module test { module test {
exports jdk.test.resources to eubundles, asiabundles; exports jdk.test.resources.spi to eubundles, asiabundles;
uses jdk.test.resources.MyResourcesProvider; uses jdk.test.resources.spi.MyResourcesProvider;
provides jdk.test.resources.MyResourcesProvider with jdk.test.resources.MyResourcesProviderImpl; provides jdk.test.resources.spi.MyResourcesProvider with jdk.test.resources.MyResourcesProviderImpl;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,7 +24,7 @@
package jdk.test.resources.asia; package jdk.test.resources.asia;
import java.util.Locale; import java.util.Locale;
import jdk.test.resources.MyResourcesProvider; import jdk.test.resources.spi.MyResourcesProvider;
public class MyResourcesAsia extends MyResourcesProvider { public class MyResourcesAsia extends MyResourcesProvider {
public MyResourcesAsia() { public MyResourcesAsia() {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,6 @@
module asiabundles { module asiabundles {
requires test; requires test;
provides jdk.test.resources.MyResourcesProvider provides jdk.test.resources.spi.MyResourcesProvider
with jdk.test.resources.asia.MyResourcesAsia; with jdk.test.resources.asia.MyResourcesAsia;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,7 +24,7 @@
package jdk.test.resources.eu; package jdk.test.resources.eu;
import java.util.Locale; import java.util.Locale;
import jdk.test.resources.MyResourcesProvider; import jdk.test.resources.spi.MyResourcesProvider;
public class MyResourcesEU extends MyResourcesProvider { public class MyResourcesEU extends MyResourcesProvider {
public MyResourcesEU() { public MyResourcesEU() {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,6 @@
module eubundles { module eubundles {
requires test; requires test;
provides jdk.test.resources.MyResourcesProvider provides jdk.test.resources.spi.MyResourcesProvider
with jdk.test.resources.eu.MyResourcesEU; with jdk.test.resources.eu.MyResourcesEU;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
package jdk.test.resources; package jdk.test.resources;
import java.util.Locale; import java.util.Locale;
import jdk.test.resources.spi.MyResourcesProvider;
public class MyResourcesProviderImpl extends MyResourcesProvider { public class MyResourcesProviderImpl extends MyResourcesProvider {
public MyResourcesProviderImpl() { public MyResourcesProviderImpl() {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -21,7 +21,7 @@
* questions. * questions.
*/ */
package jdk.test.resources; package jdk.test.resources.spi;
import java.util.Locale; import java.util.Locale;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -22,7 +22,7 @@
*/ */
module test { module test {
exports jdk.test.resources to eubundles, asiabundles; exports jdk.test.resources.spi to eubundles, asiabundles;
uses jdk.test.resources.MyResourcesProvider; uses jdk.test.resources.spi.MyResourcesProvider;
provides jdk.test.resources.MyResourcesProvider with jdk.test.resources.MyResourcesProviderImpl; provides jdk.test.resources.spi.MyResourcesProvider with jdk.test.resources.MyResourcesProviderImpl;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,7 +24,7 @@
package jdk.test.resources.asia; package jdk.test.resources.asia;
import java.util.Locale; import java.util.Locale;
import jdk.test.resources.MyResourcesProvider; import jdk.test.resources.spi.MyResourcesProvider;
/** /**
* *

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,6 @@
module asiabundles { module asiabundles {
requires mainbundles; requires mainbundles;
provides jdk.test.resources.MyResourcesProvider provides jdk.test.resources.spi.MyResourcesProvider
with jdk.test.resources.asia.MyResourcesAsia; with jdk.test.resources.asia.MyResourcesAsia;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,7 +24,7 @@
package jdk.test.resources.eu; package jdk.test.resources.eu;
import java.util.Locale; import java.util.Locale;
import jdk.test.resources.MyResourcesProvider; import jdk.test.resources.spi.MyResourcesProvider;
/** /**
* *

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,6 @@
module eubundles { module eubundles {
requires mainbundles; requires mainbundles;
provides jdk.test.resources.MyResourcesProvider provides jdk.test.resources.spi.MyResourcesProvider
with jdk.test.resources.eu.MyResourcesEU; with jdk.test.resources.eu.MyResourcesEU;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
package jdk.test.resources; package jdk.test.resources;
import java.util.Locale; import java.util.Locale;
import jdk.test.resources.spi.MyResourcesProvider;
public class MyResourcesMain extends MyResourcesProvider { public class MyResourcesMain extends MyResourcesProvider {
public MyResourcesMain() { public MyResourcesMain() {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -21,7 +21,7 @@
* questions. * questions.
*/ */
package jdk.test.resources; package jdk.test.resources.spi;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -22,7 +22,7 @@
*/ */
module mainbundles { module mainbundles {
exports jdk.test.resources to test, eubundles, asiabundles; exports jdk.test.resources.spi to test, eubundles, asiabundles;
provides jdk.test.resources.MyResourcesProvider provides jdk.test.resources.spi.MyResourcesProvider
with jdk.test.resources.MyResourcesMain; with jdk.test.resources.MyResourcesMain;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,5 +23,5 @@
module test { module test {
requires mainbundles; requires mainbundles;
uses jdk.test.resources.MyResourcesProvider; uses jdk.test.resources.spi.MyResourcesProvider;
} }

View file

@ -0,0 +1,52 @@
#
# Copyright (c) 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.
#
# @test
# @bug 8180375
# @summary Tests resource bundles are correctly loaded from
# modules through "<packageName>.spi.<simpleName>Provider" types.
set -e
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
$JAVAC --module-source-path $TESTSRC/src -d mods --module m1,m2
mkdir -p mods/m1/p/resources mods/m2/p/resources
cp $TESTSRC/src/m1/p/resources/*.properties mods/m1/p/resources
cp $TESTSRC/src/m2/p/resources/*.properties mods/m2/p/resources
mkdir classes
$JAVAC -d classes $TESTSRC/src/Main.java
$JAVA -cp classes Main

View file

@ -0,0 +1,66 @@
/*
* Copyright (c) 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.
*/
import java.lang.module.Configuration;
import java.lang.module.ModuleFinder;
import java.lang.reflect.Method;
import java.nio.file.Paths;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
public class Main {
public static void main(String... args) throws Exception {
ModuleFinder afterFinder = ModuleFinder.of(Paths.get("mods"));
Configuration cf = ModuleLayer.boot().configuration()
.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();
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);
String enResult = bundle.getString("key");
String jaResult = jabundle.getString("key");
if (!"hi".equals(enResult) || !"ja".equals(jaResult)) {
throw new RuntimeException("Unexpected resources loaded: en: " +
enResult + ", ja: " + jaResult);
}
Class<?> c = Class.forName(m1, "p.Main");
Method m = c.getDeclaredMethod("run");
m.invoke(null);
}
}

View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 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.
*/
module m1 {
exports p;
exports p.resources.spi;
uses p.resources.spi.MyResourceProvider;
provides p.resources.spi.MyResourceProvider with p.internal.BundleProvider;
}

View file

@ -0,0 +1,53 @@
/*
* Copyright (c) 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 p;
import java.util.Locale;
import java.util.ResourceBundle;
import java.io.InputStream;
public class Main {
public static void main(String... args) {
run();
}
public static void run() {
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);
String enResult = bundle.getString("key");
String jaResult = bundle1.getString("key");
if (!"hi".equals(enResult) || !"ja".equals(jaResult)) {
throw new RuntimeException("Unexpected resources loaded: en: " +
enResult + ", ja: " + jaResult);
}
}
}

View file

@ -0,0 +1,50 @@
/*
* Copyright (c) 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 p.internal;
import p.resources.spi.MyResourceProvider;
import java.io.IOException;
import java.io.InputStream;
import java.io.UncheckedIOException;
import java.util.Locale;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
import java.util.spi.AbstractResourceBundleProvider;
public class BundleProvider extends AbstractResourceBundleProvider
implements MyResourceProvider {
public BundleProvider() {
super();
}
@Override
public ResourceBundle getBundle(String baseName, Locale locale) {
if (locale.equals(Locale.ENGLISH) || locale.equals(Locale.ROOT)) {
return super.getBundle(baseName, locale);
}
return null;
}
}

View file

@ -0,0 +1,24 @@
#
# Copyright (c) 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.
#
key=hi

View file

@ -0,0 +1,30 @@
/*
* Copyright (c) 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 p.resources.spi;
import java.util.spi.ResourceBundleProvider;
public interface MyResourceProvider extends ResourceBundleProvider {
}

View file

@ -0,0 +1,27 @@
/*
* Copyright (c) 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.
*/
module m2 {
requires m1;
provides p.resources.spi.MyResourceProvider with p.internal.BundleProvider;
}

View file

@ -0,0 +1,47 @@
/*
* Copyright (c) 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 p.internal;
import p.resources.spi.MyResourceProvider;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.spi.AbstractResourceBundleProvider;
public class BundleProvider extends AbstractResourceBundleProvider
implements MyResourceProvider {
public BundleProvider() {
super();
}
@Override
public ResourceBundle getBundle(String baseName, Locale locale) {
if (locale.equals(Locale.JAPANESE)) {
return super.getBundle(baseName, locale);
}
return null;
}
}

View file

@ -0,0 +1,24 @@
#
# Copyright (c) 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.
#
key=ja

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -21,7 +21,7 @@
* questions. * questions.
*/ */
package jdk.test.resources; package jdk.test.resources.spi;
import java.util.Locale; import java.util.Locale;
import java.util.spi.AbstractResourceBundleProvider; import java.util.spi.AbstractResourceBundleProvider;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -22,6 +22,6 @@
*/ */
module bundles { module bundles {
exports jdk.test.resources to test; exports jdk.test.resources.spi to test;
provides jdk.test.resources.MyResourcesProvider with jdk.test.resources.MyResourcesProvider; provides jdk.test.resources.spi.MyResourcesProvider with jdk.test.resources.spi.MyResourcesProvider;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,5 +24,5 @@
module test { module test {
requires bundles; requires bundles;
uses jdk.test.resources.MyResourcesProvider; uses jdk.test.resources.spi.MyResourcesProvider;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -21,7 +21,7 @@
* questions. * questions.
*/ */
package jdk.test.resources.exported.classes; package jdk.test.resources.exported.classes.spi;
import java.util.Locale; import java.util.Locale;
import java.util.spi.AbstractResourceBundleProvider; import java.util.spi.AbstractResourceBundleProvider;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,6 @@ module exported.named.bundles {
// unqualified exports to verify that resource bundles are not picked // unqualified exports to verify that resource bundles are not picked
// up by other named modules // up by other named modules
exports jdk.test.resources.exported.classes; exports jdk.test.resources.exported.classes;
provides jdk.test.resources.exported.classes.MyResourcesProvider provides jdk.test.resources.exported.classes.spi.MyResourcesProvider
with jdk.test.resources.exported.classes.MyResourcesProvider; with jdk.test.resources.exported.classes.spi.MyResourcesProvider;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -21,7 +21,7 @@
* questions. * questions.
*/ */
package jdk.test.resources.classes; package jdk.test.resources.classes.spi;
import java.util.Locale; import java.util.Locale;
import java.util.ResourceBundle; import java.util.ResourceBundle;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -21,7 +21,7 @@
* questions. * questions.
*/ */
package jdk.test.resources.props; package jdk.test.resources.props.spi;
import java.util.Locale; import java.util.Locale;
import java.util.ResourceBundle; import java.util.ResourceBundle;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -22,10 +22,10 @@
*/ */
module named.bundles { module named.bundles {
exports jdk.test.resources.classes to test; // exports only to test exports jdk.test.resources.classes.spi to test; // exports only to test
exports jdk.test.resources.props to test; // exports only to test exports jdk.test.resources.props.spi to test; // exports only to test
provides jdk.test.resources.classes.MyResourcesProvider provides jdk.test.resources.classes.spi.MyResourcesProvider
with jdk.test.resources.classes.MyResourcesProvider; with jdk.test.resources.classes.spi.MyResourcesProvider;
provides jdk.test.resources.props.MyResourcesProvider provides jdk.test.resources.props.spi.MyResourcesProvider
with jdk.test.resources.props.MyResourcesProvider; with jdk.test.resources.props.spi.MyResourcesProvider;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -22,8 +22,8 @@
*/ */
module test { module test {
// jdk.test.resources.classes.MyResourcesProvider is in named.bundles. // jdk.test.resources.classes.spi.MyResourcesProvider is in named.bundles.
requires named.bundles; requires named.bundles;
uses jdk.test.resources.classes.MyResourcesProvider; uses jdk.test.resources.classes.spi.MyResourcesProvider;
uses jdk.test.resources.props.MyResourcesProvider; uses jdk.test.resources.props.spi.MyResourcesProvider;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -21,7 +21,7 @@
* questions. * questions.
*/ */
package jdk.test.resources; package jdk.test.resources.spi;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.InputStream; import java.io.InputStream;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -22,6 +22,6 @@
*/ */
module bundles { module bundles {
exports jdk.test.resources to test; exports jdk.test.resources.spi to test;
provides jdk.test.resources.MyResourcesProvider with jdk.test.resources.MyResourcesProvider; provides jdk.test.resources.spi.MyResourcesProvider with jdk.test.resources.spi.MyResourcesProvider;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,5 +24,5 @@
module test { module test {
requires bundles; requires bundles;
uses jdk.test.resources.MyResourcesProvider; uses jdk.test.resources.spi.MyResourcesProvider;
} }