Mercurial > hg > truffle
diff 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 |
line wrap: on
line diff
--- a/src/share/vm/prims/jvm.cpp Mon Oct 07 12:20:28 2013 -0400 +++ b/src/share/vm/prims/jvm.cpp Tue Oct 08 02:56:06 2013 -0400 @@ -668,13 +668,12 @@ JVM_ENTRY(jclass, JVM_GetCallerClass(JNIEnv* env, int depth)) JVMWrapper("JVM_GetCallerClass"); - // Pre-JDK 8 and early builds of JDK 8 don't have a CallerSensitive annotation. - if (SystemDictionary::reflect_CallerSensitive_klass() == NULL) { + // Pre-JDK 8 and early builds of JDK 8 don't have a CallerSensitive annotation; or + // sun.reflect.Reflection.getCallerClass with a depth parameter is provided + // temporarily for existing code to use until a replacement API is defined. + if (SystemDictionary::reflect_CallerSensitive_klass() == NULL || depth != JVM_CALLER_DEPTH) { Klass* k = thread->security_get_caller_class(depth); return (k == NULL) ? NULL : (jclass) JNIHandles::make_local(env, k->java_mirror()); - } else { - // Basic handshaking with Java_sun_reflect_Reflection_getCallerClass - assert(depth == -1, "wrong handshake depth"); } // Getting the class of the caller frame.