Mercurial > hg > graal-jvmci-8
comparison src/share/vm/prims/jvm.cpp @ 12824:615d83933195
8026025: JVM_GetCallerClass allows Reflection.getCallerClass(int depth) to use
Reviewed-by: alanb, dholmes, twisti
Contributed-by: mandy.chung@oracle.com
author | dholmes |
---|---|
date | Tue, 08 Oct 2013 02:56:06 -0400 |
parents | 2720ab7a0d70 |
children | 096c224171c4 0f2de9d724a9 2b8e28fdf503 d35df3079834 21444610cb92 |
comparison
equal
deleted
inserted
replaced
12823:ac9cb1d5a202 | 12824:615d83933195 |
---|---|
666 | 666 |
667 | 667 |
668 JVM_ENTRY(jclass, JVM_GetCallerClass(JNIEnv* env, int depth)) | 668 JVM_ENTRY(jclass, JVM_GetCallerClass(JNIEnv* env, int depth)) |
669 JVMWrapper("JVM_GetCallerClass"); | 669 JVMWrapper("JVM_GetCallerClass"); |
670 | 670 |
671 // Pre-JDK 8 and early builds of JDK 8 don't have a CallerSensitive annotation. | 671 // Pre-JDK 8 and early builds of JDK 8 don't have a CallerSensitive annotation; or |
672 if (SystemDictionary::reflect_CallerSensitive_klass() == NULL) { | 672 // sun.reflect.Reflection.getCallerClass with a depth parameter is provided |
673 // temporarily for existing code to use until a replacement API is defined. | |
674 if (SystemDictionary::reflect_CallerSensitive_klass() == NULL || depth != JVM_CALLER_DEPTH) { | |
673 Klass* k = thread->security_get_caller_class(depth); | 675 Klass* k = thread->security_get_caller_class(depth); |
674 return (k == NULL) ? NULL : (jclass) JNIHandles::make_local(env, k->java_mirror()); | 676 return (k == NULL) ? NULL : (jclass) JNIHandles::make_local(env, k->java_mirror()); |
675 } else { | |
676 // Basic handshaking with Java_sun_reflect_Reflection_getCallerClass | |
677 assert(depth == -1, "wrong handshake depth"); | |
678 } | 677 } |
679 | 678 |
680 // Getting the class of the caller frame. | 679 // Getting the class of the caller frame. |
681 // | 680 // |
682 // The call stack at this point looks something like this: | 681 // The call stack at this point looks something like this: |