changeset 11133:aa18d1783f1e

8062588: Support java.util.spi.*, java.text.spi.*, java.awt.im.spi loaded from classpath Reviewed-by: alanb
author naoto
date Tue, 16 Dec 2014 12:48:31 -0800
parents c8c8e1a13fa6
children 8bb2d5d056bf
files src/java.base/share/classes/java/util/spi/LocaleServiceProvider.java src/java.base/share/classes/sun/util/locale/provider/SPILocaleProviderAdapter.java src/java.desktop/share/classes/java/awt/im/spi/package.html src/java.desktop/share/classes/sun/awt/im/ExecutableInputMethodManager.java test/ProblemList.txt test/java/util/Locale/LocaleProviders.sh test/java/util/PluggableLocale/BreakIteratorProviderTest.sh test/java/util/PluggableLocale/CalendarDataProviderTest.sh test/java/util/PluggableLocale/CalendarNameProviderTest.sh test/java/util/PluggableLocale/ClasspathTest.java test/java/util/PluggableLocale/ClasspathTest.sh test/java/util/PluggableLocale/CollatorProviderTest.sh test/java/util/PluggableLocale/CurrencyNameProviderTest.sh test/java/util/PluggableLocale/DateFormatProviderTest.sh test/java/util/PluggableLocale/DateFormatSymbolsProviderTest.sh test/java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.sh test/java/util/PluggableLocale/ExecTest.sh test/java/util/PluggableLocale/GenericTest.sh test/java/util/PluggableLocale/LocaleNameProviderTest.sh test/java/util/PluggableLocale/NumberFormatProviderTest.sh test/java/util/PluggableLocale/TimeZoneNameProviderTest.sh test/java/util/ResourceBundle/Bug6299235Test.sh
diffstat 22 files changed, 65 insertions(+), 89 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/util/spi/LocaleServiceProvider.java	Tue Dec 16 11:49:37 2014 -0800
+++ b/src/java.base/share/classes/java/util/spi/LocaleServiceProvider.java	Tue Dec 16 12:48:31 2014 -0800
@@ -43,9 +43,8 @@
  * supported by the Java runtime environment itself.
  *
  * <h3>Packaging of Locale Sensitive Service Provider Implementations</h3>
- * Implementations of these locale sensitive services are packaged using the
- * <a href="../../../../technotes/guides/extensions/index.html">Java Extension Mechanism</a>
- * as installed extensions.  A provider identifies itself with a
+ * Implementations of these locale sensitive services can be made available
+ * by adding them to the application's class path. A provider identifies itself with a
  * provider-configuration file in the resource directory META-INF/services,
  * using the fully qualified provider interface class name as the file name.
  * The file should contain a list of fully-qualified concrete provider class names,
--- a/src/java.base/share/classes/sun/util/locale/provider/SPILocaleProviderAdapter.java	Tue Dec 16 11:49:37 2014 -0800
+++ b/src/java.base/share/classes/sun/util/locale/provider/SPILocaleProviderAdapter.java	Tue Dec 16 12:48:31 2014 -0800
@@ -77,7 +77,8 @@
                 public P run() {
                     P delegate = null;
 
-                    for (LocaleServiceProvider provider : ServiceLoader.loadInstalled(c)) {
+                    for (LocaleServiceProvider provider :
+                             ServiceLoader.load(c, ClassLoader.getSystemClassLoader())) {
                         if (delegate == null) {
                             try {
                                 delegate =
--- a/src/java.desktop/share/classes/java/awt/im/spi/package.html	Tue Dec 16 11:49:37 2014 -0800
+++ b/src/java.desktop/share/classes/java/awt/im/spi/package.html	Tue Dec 16 12:48:31 2014 -0800
@@ -55,9 +55,8 @@
 
 <H4><A NAME="Packaging"></A>Packaging Input Methods</H4>
 
-<P>Input methods are packaged as installed extensions, as specified
-by the <A HREF="../../../../../technotes/guides/extensions/index.html">Extension
-Mechanism</A>. The main JAR file of an input method must contain the
+<P>Input methods can be made available by adding them to the application's
+class path. The main JAR file of an input method must contain the
 file:</P>
 
 <PRE>    META-INF/services/java.awt.im.spi.InputMethodDescriptor</PRE>
--- a/src/java.desktop/share/classes/sun/awt/im/ExecutableInputMethodManager.java	Tue Dec 16 11:49:37 2014 -0800
+++ b/src/java.desktop/share/classes/sun/awt/im/ExecutableInputMethodManager.java	Tue Dec 16 12:48:31 2014 -0800
@@ -259,7 +259,8 @@
                 AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                     public Object run() {
                         for (InputMethodDescriptor descriptor :
-                            ServiceLoader.loadInstalled(InputMethodDescriptor.class)) {
+                            ServiceLoader.load(InputMethodDescriptor.class,
+                                               ClassLoader.getSystemClassLoader())) {
                             ClassLoader cl = descriptor.getClass().getClassLoader();
                             javaInputMethodLocatorList.add(new InputMethodLocator(descriptor, cl, null));
                         }
--- a/test/ProblemList.txt	Tue Dec 16 11:49:37 2014 -0800
+++ b/test/ProblemList.txt	Tue Dec 16 12:48:31 2014 -0800
@@ -306,22 +306,6 @@
 # 8051641
 sun/util/calendar/zi/TestZoneInfo310.java                        generic-all
 
-# 8062588
-java/util/Locale/LocaleProviders.sh                              generic-all
-java/util/PluggableLocale/BreakIteratorProviderTest.sh           generic-all
-java/util/PluggableLocale/CalendarDataProviderTest.sh            generic-all
-java/util/PluggableLocale/CalendarNameProviderTest.sh            generic-all
-java/util/PluggableLocale/CollatorProviderTest.sh                generic-all
-java/util/PluggableLocale/CurrencyNameProviderTest.sh            generic-all
-java/util/PluggableLocale/DateFormatProviderTest.sh              generic-all
-java/util/PluggableLocale/DateFormatSymbolsProviderTest.sh       generic-all
-java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.sh    generic-all
-java/util/PluggableLocale/GenericTest.sh                         generic-all
-java/util/PluggableLocale/LocaleNameProviderTest.sh              generic-all
-java/util/PluggableLocale/NumberFormatProviderTest.sh            generic-all
-java/util/PluggableLocale/TimeZoneNameProviderTest.sh            generic-all
-java/util/ResourceBundle/Bug6299235Test.sh                       generic-all
-
 # 8062512
 java/util/spi/ResourceBundleControlProvider/UserDefaultControlTest.java generic-all
 
--- a/test/java/util/Locale/LocaleProviders.sh	Tue Dec 16 11:49:37 2014 -0800
+++ b/test/java/util/Locale/LocaleProviders.sh	Tue Dec 16 12:48:31 2014 -0800
@@ -137,7 +137,7 @@
 
 runTest()
 {
-    RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSES} -Djava.locale.providers=$PREFLIST LocaleProviders $METHODNAME $PARAM1 $PARAM2 $PARAM3"
+    RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSES}${PS}${SPICLASSES} -Djava.locale.providers=$PREFLIST LocaleProviders $METHODNAME $PARAM1 $PARAM2 $PARAM3"
     echo ${RUNCMD}
     ${RUNCMD}
     result=$?
@@ -189,6 +189,7 @@
   PARAM2=zh
   PARAM3=CN
 fi
+SPICLASSES=
 runTest
 
 # testing SPI is NOT selected, as there is none.
@@ -197,6 +198,7 @@
 PARAM1=JRE
 PARAM2=en
 PARAM3=US
+SPICLASSES=
 runTest
 
 # testing the order, variaton #1. This assumes en_GB DateFormat data are available both in JRE & CLDR
@@ -205,6 +207,7 @@
 PARAM1=CLDR
 PARAM2=en
 PARAM3=GB
+SPICLASSES=
 runTest
 
 # testing the order, variaton #2. This assumes en_GB DateFormat data are available both in JRE & CLDR
@@ -213,6 +216,7 @@
 PARAM1=JRE
 PARAM2=en
 PARAM3=GB
+SPICLASSES=
 runTest
 
 # testing the order, variaton #3 for non-existent locale in JRE assuming "haw" is not in JRE.
@@ -221,6 +225,7 @@
 PARAM1=CLDR
 PARAM2=haw
 PARAM3=GB
+SPICLASSES=
 runTest
 
 # testing the order, variaton #4 for the bug 7196799. CLDR's "zh" data should be used in "zh_CN"
@@ -229,6 +234,7 @@
 PARAM1=CLDR
 PARAM2=zh
 PARAM3=CN
+SPICLASSES=
 runTest
 
 # testing FALLBACK provider. SPI and invalid one cases.
@@ -237,16 +243,19 @@
 PARAM1=FALLBACK
 PARAM2=en
 PARAM3=US
+SPICLASSES=
 runTest
 PREFLIST=FOO
 PARAM1=JRE
 PARAM2=en
 PARAM3=US
+SPICLASSES=
 runTest
 PREFLIST=BAR,SPI
 PARAM1=FALLBACK
 PARAM2=en
 PARAM3=US
+SPICLASSES=
 runTest
 
 # testing 7198834 fix. Only works on Windows Vista or upper.
@@ -255,22 +264,25 @@
 PARAM1=
 PARAM2=
 PARAM3=
+SPICLASSES=
 runTest
 
 # testing 8000245 fix.
 METHODNAME=tzNameTest
-PREFLIST="JRE -Djava.ext.dirs=${SPIDIR}"
+PREFLIST=JRE
 PARAM1=Europe/Moscow
 PARAM2=
 PARAM3=
+SPICLASSES=${SPIDIR}
 runTest
 
 # testing 8000615 fix.
 METHODNAME=tzNameTest
-PREFLIST="JRE -Djava.ext.dirs=${SPIDIR}"
+PREFLIST=JRE
 PARAM1=America/Los_Angeles
 PARAM2=
 PARAM3=
+SPICLASSES=${SPIDIR}
 runTest
 
 # testing 8001440 fix.
@@ -279,6 +291,7 @@
 PARAM1=
 PARAM2=
 PARAM3=
+SPICLASSES=
 runTest
 
 # testing 8010666 fix.
@@ -289,15 +302,17 @@
   PARAM1=
   PARAM2=
   PARAM3=
+  SPICLASSES=
   runTest
 fi
 
 # testing 8013086 fix.
 METHODNAME=bug8013086Test
-PREFLIST="JRE,SPI -Djava.ext.dirs=${SPIDIR}"
+PREFLIST=JRE,SPI
 PARAM1=ja
 PARAM2=JP
 PARAM3=
+SPICLASSES=${SPIDIR}
 runTest
 
 # testing 8013903 fix. (Windows only)
@@ -306,12 +321,14 @@
 PARAM1=
 PARAM2=
 PARAM3=
+SPICLASSES=
 runTest
 METHODNAME=bug8013903Test
 PREFLIST=HOST
 PARAM1=
 PARAM2=
 PARAM3=
+SPICLASSES=
 runTest
 
 # testing 8027289 fix, if the platform format default is zh_CN
@@ -323,12 +340,14 @@
   PARAM1=FFE5
   PARAM2=
   PARAM3=
+  SPICLASSES=
   runTest
   METHODNAME=bug8027289Test
   PREFLIST=HOST
   PARAM1=00A5
   PARAM2=
   PARAM3=
+  SPICLASSES=
   runTest
 fi
 
--- a/test/java/util/PluggableLocale/BreakIteratorProviderTest.sh	Tue Dec 16 11:49:37 2014 -0800
+++ b/test/java/util/PluggableLocale/BreakIteratorProviderTest.sh	Tue Dec 16 12:48:31 2014 -0800
@@ -23,6 +23,6 @@
 #
 #
 # @test
-# @bug 4052440
+# @bug 4052440 8062588
 # @summary BreakIteratorProvider tests
-# @run shell ExecTest.sh foo BreakIteratorProviderTest true
+# @run shell ExecTest.sh foo BreakIteratorProviderTest
--- a/test/java/util/PluggableLocale/CalendarDataProviderTest.sh	Tue Dec 16 11:49:37 2014 -0800
+++ b/test/java/util/PluggableLocale/CalendarDataProviderTest.sh	Tue Dec 16 12:48:31 2014 -0800
@@ -23,6 +23,6 @@
 #
 #
 # @test
-# @bug 7058207 8000986
+# @bug 7058207 8000986 8062588
 # @summary CalendarDataProvider tests
-# @run shell ExecTest.sh bar CalendarDataProviderTest true
+# @run shell ExecTest.sh bar CalendarDataProviderTest
--- a/test/java/util/PluggableLocale/CalendarNameProviderTest.sh	Tue Dec 16 11:49:37 2014 -0800
+++ b/test/java/util/PluggableLocale/CalendarNameProviderTest.sh	Tue Dec 16 12:48:31 2014 -0800
@@ -22,6 +22,6 @@
 #
 
 # @test
-# @bug 8000986
+# @bug 8000986 8062588
 # @summary CalendarNameProvider tests
-# @run shell ExecTest.sh bar CalendarNameProviderTest true
+# @run shell ExecTest.sh bar CalendarNameProviderTest
--- a/test/java/util/PluggableLocale/ClasspathTest.java	Tue Dec 16 11:49:37 2014 -0800
+++ b/test/java/util/PluggableLocale/ClasspathTest.java	Tue Dec 16 12:48:31 2014 -0800
@@ -36,13 +36,13 @@
 
     ClasspathTest() {
         /*
-         * Since providers can only be loaded from the extension directory,
-         * this test will fail if they are loaded from classpath.
+         * Since providers can be loaded from the application's classpath,
+         * this test will fail if they are NOT loaded from classpath.
          */
         Locale OSAKA = new Locale("ja", "JP", "osaka");
         List<Locale> availableLocales = Arrays.asList(Locale.getAvailableLocales());
-        if (availableLocales.contains(OSAKA)) {
-            throw new RuntimeException("LSS providers were loaded from the class path.");
+        if (!availableLocales.contains(OSAKA)) {
+            throw new RuntimeException("LSS providers were NOT loaded from the class path.");
         }
     }
 }
--- a/test/java/util/PluggableLocale/ClasspathTest.sh	Tue Dec 16 11:49:37 2014 -0800
+++ b/test/java/util/PluggableLocale/ClasspathTest.sh	Tue Dec 16 12:48:31 2014 -0800
@@ -23,7 +23,6 @@
 #
 #
 # @test
-# @bug 6388652
-# @summary  Checks whether providers can only be loaded from extension directories, 
-#     not from classpath.
-# @run shell ExecTest.sh bar ClasspathTest false
+# @bug 6388652 8062588
+# @summary  Checks whether providers can be loaded from classpath.
+# @run shell ExecTest.sh bar ClasspathTest
--- a/test/java/util/PluggableLocale/CollatorProviderTest.sh	Tue Dec 16 11:49:37 2014 -0800
+++ b/test/java/util/PluggableLocale/CollatorProviderTest.sh	Tue Dec 16 12:48:31 2014 -0800
@@ -23,6 +23,6 @@
 #
 #
 # @test
-# @bug 4052440
+# @bug 4052440 8062588 
 # @summary CollatorProvider tests
-# @run shell ExecTest.sh foo CollatorProviderTest true
+# @run shell ExecTest.sh foo CollatorProviderTest
--- a/test/java/util/PluggableLocale/CurrencyNameProviderTest.sh	Tue Dec 16 11:49:37 2014 -0800
+++ b/test/java/util/PluggableLocale/CurrencyNameProviderTest.sh	Tue Dec 16 12:48:31 2014 -0800
@@ -23,6 +23,6 @@
 #
 #
 # @test
-# @bug 4052440 7199750 8000997
+# @bug 4052440 7199750 8000997 8062588
 # @summary CurrencyNameProvider tests
-# @run shell ExecTest.sh bar CurrencyNameProviderTest true
+# @run shell ExecTest.sh bar CurrencyNameProviderTest
--- a/test/java/util/PluggableLocale/DateFormatProviderTest.sh	Tue Dec 16 11:49:37 2014 -0800
+++ b/test/java/util/PluggableLocale/DateFormatProviderTest.sh	Tue Dec 16 12:48:31 2014 -0800
@@ -23,6 +23,6 @@
 #
 #
 # @test
-# @bug 4052440 7003643
+# @bug 4052440 7003643 8062588 
 # @summary DateFormatProvider tests
-# @run shell ExecTest.sh foo DateFormatProviderTest true
+# @run shell ExecTest.sh foo DateFormatProviderTest
--- a/test/java/util/PluggableLocale/DateFormatSymbolsProviderTest.sh	Tue Dec 16 11:49:37 2014 -0800
+++ b/test/java/util/PluggableLocale/DateFormatSymbolsProviderTest.sh	Tue Dec 16 12:48:31 2014 -0800
@@ -23,6 +23,6 @@
 #
 #
 # @test
-# @bug 4052440 7200341
+# @bug 4052440 7200341 8062588
 # @summary DateFormatSymbolsProvider tests
-# @run shell ExecTest.sh foo DateFormatSymbolsProviderTest true
+# @run shell ExecTest.sh foo DateFormatSymbolsProviderTest
--- a/test/java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.sh	Tue Dec 16 11:49:37 2014 -0800
+++ b/test/java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.sh	Tue Dec 16 12:48:31 2014 -0800
@@ -23,6 +23,6 @@
 #
 #
 # @test
-# @bug 4052440
+# @bug 4052440 8062588
 # @summary DecimalFormatSymbolsProvider tests
-# @run shell ExecTest.sh foo DecimalFormatSymbolsProviderTest true
+# @run shell ExecTest.sh foo DecimalFormatSymbolsProviderTest
--- a/test/java/util/PluggableLocale/ExecTest.sh	Tue Dec 16 11:49:37 2014 -0800
+++ b/test/java/util/PluggableLocale/ExecTest.sh	Tue Dec 16 12:48:31 2014 -0800
@@ -76,14 +76,6 @@
     ;;
 esac
 
-# set classpath and extension directory variables
-if [ -d ${TESTJAVA}${FS}lib${FS}ext ]
-then
-    EXTDIRS="${TESTJAVA}${FS}lib${FS}ext${PS}${TESTCLASSES}"
-else
-    EXTDIRS="${TESTJAVA}${FS}jre${FS}lib${FS}ext${PS}${TESTCLASSES}"
-fi
-
 case "$1" in
   "foo" )
     cp ${TESTSRC}${FS}fooprovider.jar ${TESTCLASSES}
@@ -122,12 +114,7 @@
 fi
 
 # run
-if [ "$3" = "true" ]
-then
-  RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Djava.ext.dirs=${EXTDIRS} $2 "
-else
-  RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${CLASSPATHARG} $2 "
-fi
+RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${CLASSPATHARG} $2 "
 
 echo ${RUNCMD}
 ${RUNCMD}
--- a/test/java/util/PluggableLocale/GenericTest.sh	Tue Dec 16 11:49:37 2014 -0800
+++ b/test/java/util/PluggableLocale/GenericTest.sh	Tue Dec 16 12:48:31 2014 -0800
@@ -23,6 +23,6 @@
 #
 #
 # @test
-# @bug 4052440
+# @bug 4052440 8062588
 # @summary Generic tests for the pluggable locales feature
-# @run shell ExecTest.sh foobar GenericTest true
+# @run shell ExecTest.sh foobar GenericTest
--- a/test/java/util/PluggableLocale/LocaleNameProviderTest.sh	Tue Dec 16 11:49:37 2014 -0800
+++ b/test/java/util/PluggableLocale/LocaleNameProviderTest.sh	Tue Dec 16 12:48:31 2014 -0800
@@ -23,6 +23,6 @@
 #
 #
 # @test
-# @bug 4052440 8000273
+# @bug 4052440 8000273 8062588
 # @summary LocaleNameProvider tests
-# @run shell ExecTest.sh bar LocaleNameProviderTest true
+# @run shell ExecTest.sh bar LocaleNameProviderTest
--- a/test/java/util/PluggableLocale/NumberFormatProviderTest.sh	Tue Dec 16 11:49:37 2014 -0800
+++ b/test/java/util/PluggableLocale/NumberFormatProviderTest.sh	Tue Dec 16 12:48:31 2014 -0800
@@ -23,6 +23,6 @@
 #
 #
 # @test
-# @bug 4052440 7003643
+# @bug 4052440 7003643 8062588
 # @summary NumberFormatProvider tests
-# @run shell ExecTest.sh foo NumberFormatProviderTest true
+# @run shell ExecTest.sh foo NumberFormatProviderTest
--- a/test/java/util/PluggableLocale/TimeZoneNameProviderTest.sh	Tue Dec 16 11:49:37 2014 -0800
+++ b/test/java/util/PluggableLocale/TimeZoneNameProviderTest.sh	Tue Dec 16 12:48:31 2014 -0800
@@ -23,6 +23,6 @@
 #
 #
 # @test
-# @bug 4052440 8003267
+# @bug 4052440 8003267 8062588
 # @summary TimeZoneNameProvider tests
-# @run shell ExecTest.sh bar TimeZoneNameProviderTest true
+# @run shell ExecTest.sh bar TimeZoneNameProviderTest
--- a/test/java/util/ResourceBundle/Bug6299235Test.sh	Tue Dec 16 11:49:37 2014 -0800
+++ b/test/java/util/ResourceBundle/Bug6299235Test.sh	Tue Dec 16 12:48:31 2014 -0800
@@ -55,27 +55,14 @@
   exit 1
 fi
 
-# See if TESTJAVA points to JRE or JDK
-if [ -d "${TESTJAVA}${FILESEP}jre" ]; then
-    JRE_EXT_DIR=${TESTJAVA}${FILESEP}jre${FILESEP}lib${FILESEP}ext
-else
-    JRE_EXT_DIR=${TESTJAVA}${FILESEP}lib${FILESEP}ext
-fi
-
-if [ -d "${JRE_EXT_DIR}" ]; then
-    NEW_EXT_DIR="${JRE_EXT_DIR}${PATHSEP}${TESTSRC}"
-else
-    NEW_EXT_DIR=${TESTSRC}
-fi
-
 echo "TESTJAVA=${TESTJAVA}"
 echo "TESTSRC=${TESTSRC}"
 echo "TESTCLASSES=${TESTCLASSES}"
 echo "NEW_EXT_DIR=${NEW_EXT_DIR}"
 
 cd ${TESTSRC}
-
-${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTCLASSES} -Djava.ext.dirs=${NEW_EXT_DIR} Bug6299235Test
+echo 
+${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}awtres.jar Bug6299235Test
 
 if [ $? -ne 0 ]
     then