src/hotspot/share/prims/jvm.cpp
changeset 48477 b7af6f568d00
parent 48196 5ee29f4ec472
child 48826 c4d9d1b08e2e
equal deleted inserted replaced
48476:ca9489245872 48477:b7af6f568d00
   676 
   676 
   677 
   677 
   678 // Misc. class handling ///////////////////////////////////////////////////////////
   678 // Misc. class handling ///////////////////////////////////////////////////////////
   679 
   679 
   680 
   680 
   681 JVM_ENTRY(jclass, JVM_GetCallerClass(JNIEnv* env, int depth))
   681 JVM_ENTRY(jclass, JVM_GetCallerClass(JNIEnv* env))
   682   JVMWrapper("JVM_GetCallerClass");
   682   JVMWrapper("JVM_GetCallerClass");
   683 
       
   684   // Pre-JDK 8 and early builds of JDK 8 don't have a CallerSensitive annotation; or
       
   685   // sun.reflect.Reflection.getCallerClass with a depth parameter is provided
       
   686   // temporarily for existing code to use until a replacement API is defined.
       
   687   if (SystemDictionary::reflect_CallerSensitive_klass() == NULL || depth != JVM_CALLER_DEPTH) {
       
   688     Klass* k = thread->security_get_caller_class(depth);
       
   689     return (k == NULL) ? NULL : (jclass) JNIHandles::make_local(env, k->java_mirror());
       
   690   }
       
   691 
   683 
   692   // Getting the class of the caller frame.
   684   // Getting the class of the caller frame.
   693   //
   685   //
   694   // The call stack at this point looks something like this:
   686   // The call stack at this point looks something like this:
   695   //
   687   //