changeset 16142:ba41440d6e2b

8169435: ClassLoader.isParallelCapable is final and conflicting method may get VerifyError Reviewed-by: acorn, dholmes, mchung
author bchristi
date Wed, 23 Nov 2016 10:34:10 -0800
parents 6a8da2c37469
children efdfc159ee09
files src/java.base/share/classes/java/lang/ClassLoader.java test/java/lang/ClassLoader/IsParallelCapable.java
diffstat 2 files changed, 14 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/ClassLoader.java	Wed Nov 23 11:47:29 2016 -0500
+++ b/src/java.base/share/classes/java/lang/ClassLoader.java	Wed Nov 23 10:34:10 2016 -0800
@@ -104,9 +104,9 @@
  * class or resource itself.
  *
  * <p> Class loaders that support concurrent loading of classes are known as
- * <em>{@linkplain #isParallelCapable() parallel capable}</em> class loaders and
- * are required to register themselves at their class initialization time by
- * invoking the {@link
+ * <em>{@linkplain #isRegisteredAsParallelCapable() parallel capable}</em> class
+ * loaders and are required to register themselves at their class initialization
+ * time by invoking the {@link
  * #registerAsParallelCapable <tt>ClassLoader.registerAsParallelCapable</tt>}
  * method. Note that the <tt>ClassLoader</tt> class is registered as parallel
  * capable by default. However, its subclasses still need to register themselves
@@ -1495,7 +1495,8 @@
     }
 
     /**
-     * Registers the caller as {@linkplain #isParallelCapable() parallel capable}.
+     * Registers the caller as
+     * {@linkplain #isRegisteredAsParallelCapable() parallel capable}.
      * The registration succeeds if and only if all of the following
      * conditions are met:
      * <ol>
@@ -1509,7 +1510,7 @@
      * @return  {@code true} if the caller is successfully registered as
      *          parallel capable and {@code false} if otherwise.
      *
-     * @see #isParallelCapable()
+     * @see #isRegisteredAsParallelCapable()
      *
      * @since   1.7
      */
@@ -1521,7 +1522,7 @@
     }
 
     /**
-     * Returns {@code true} if this class loader is
+     * Returns {@code true} if this class loader is registered as
      * {@linkplain #registerAsParallelCapable parallel capable}, otherwise
      * {@code false}.
      *
@@ -1532,7 +1533,7 @@
      *
      * @since   9
      */
-    public final boolean isParallelCapable() {
+    public final boolean isRegisteredAsParallelCapable() {
         return ParallelLoaders.isRegistered(this.getClass());
     }
 
--- a/test/java/lang/ClassLoader/IsParallelCapable.java	Wed Nov 23 11:47:29 2016 -0500
+++ b/test/java/lang/ClassLoader/IsParallelCapable.java	Wed Nov 23 10:34:10 2016 -0800
@@ -23,8 +23,8 @@
 
 /*
  * @test
- * @bug 8165793
- * @summary Test ClassLoader.isParallelCapable() method
+ * @bug 8165793 8169435
+ * @summary Test ClassLoader.isRegisteredAsParallelCapable() method
  * @run main IsParallelCapable
  */
 
@@ -85,7 +85,7 @@
     }
 
     public static void main(String[] args) throws Exception {
-        if (!ClassLoader.getSystemClassLoader().isParallelCapable()) {
+        if (!ClassLoader.getSystemClassLoader().isRegisteredAsParallelCapable()) {
             throw new RuntimeException("System classloader not parallel capable!?");
         }
 
@@ -100,10 +100,10 @@
     private static void testClassLoaderClass(Class<? extends TestCL> klazz) {
         try {
             TestCL cl = (TestCL)klazz.newInstance();
-            if (cl.expectCapable() != cl.isParallelCapable()) {
+            if (cl.expectCapable() != cl.isRegisteredAsParallelCapable()) {
                 throw new RuntimeException(klazz + " expectCapable: " +
-                        cl.expectCapable() + ", isParallelCapable: " +
-                        cl.isParallelCapable());
+                        cl.expectCapable() + ", isRegisteredAsParallelCapable: " +
+                        cl.isRegisteredAsParallelCapable());
             } else {
                 System.out.println(klazz + " passed");
             }