8169435: ClassLoader.isParallelCapable is final and conflicting method may get VerifyError

Reviewed-by: acorn, dholmes, mchung
This commit is contained in:
Brent Christian 2016-11-23 10:34:10 -08:00
parent 305d776581
commit 36ffe056e1
2 changed files with 14 additions and 13 deletions

View File

@ -104,9 +104,9 @@ import sun.security.util.SecurityConstants;
* 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 @@ public abstract class ClassLoader {
}
/**
* 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 @@ public abstract class ClassLoader {
* @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 @@ public abstract class ClassLoader {
}
/**
* 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 @@ public abstract class ClassLoader {
*
* @since 9
*/
public final boolean isParallelCapable() {
public final boolean isRegisteredAsParallelCapable() {
return ParallelLoaders.isRegistered(this.getClass());
}

View File

@ -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 class IsParallelCapable {
}
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 @@ public class IsParallelCapable {
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");
}