< prev index next >

src/java.base/share/classes/java/lang/ClassLoader.java

Print this page
@@ -62,10 +62,11 @@
  import jdk.internal.loader.NativeLibraries;
  import jdk.internal.perf.PerfCounter;
  import jdk.internal.misc.Unsafe;
  import jdk.internal.misc.VM;
  import jdk.internal.reflect.CallerSensitive;
+ import jdk.internal.reflect.CallerSensitiveAdapter;
  import jdk.internal.reflect.Reflection;
  import jdk.internal.util.StaticProperty;
  import sun.reflect.misc.ReflectUtil;
  import sun.security.util.SecurityConstants;
  

@@ -1613,13 +1614,17 @@
       *
       * @since   1.7
       */
      @CallerSensitive
      protected static boolean registerAsParallelCapable() {
-         Class<? extends ClassLoader> callerClass =
-             Reflection.getCallerClass().asSubclass(ClassLoader.class);
-         return ParallelLoaders.register(callerClass);
+         return registerAsParallelCapable(Reflection.getCallerClass());
+     }
+ 
+     // Caller-sensitive adapter method for reflective invocation
+     @CallerSensitiveAdapter
+     private static boolean registerAsParallelCapable(Class<?> caller) {
+         return ParallelLoaders.register(caller.asSubclass(ClassLoader.class));
      }
  
      /**
       * Returns {@code true} if this class loader is registered as
       * {@linkplain #registerAsParallelCapable parallel capable}, otherwise
< prev index next >