hotspot/src/share/vm/prims/methodHandles.cpp
changeset 38719 133bf85c3f36
parent 38259 b495d1cfe673
child 39289 a17f754703e5
--- a/hotspot/src/share/vm/prims/methodHandles.cpp	Thu May 26 20:43:13 2016 -0400
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp	Fri May 27 10:52:39 2016 -0400
@@ -713,12 +713,16 @@
   TempNewSymbol type = lookup_signature(type_str(), (mh_invoke_id != vmIntrinsics::_none), CHECK_(empty));
   if (type == NULL)  return empty;  // no such signature exists in the VM
 
+  LinkInfo::AccessCheck access_check = caller.not_null() ?
+                                              LinkInfo::needs_access_check :
+                                              LinkInfo::skip_access_check;
+
   // Time to do the lookup.
   switch (flags & ALL_KINDS) {
   case IS_METHOD:
     {
       CallInfo result;
-      LinkInfo link_info(defc, name, type, caller, caller.not_null());
+      LinkInfo link_info(defc, name, type, caller, access_check);
       {
         assert(!HAS_PENDING_EXCEPTION, "");
         if (ref_kind == JVM_REF_invokeStatic) {
@@ -755,7 +759,7 @@
   case IS_CONSTRUCTOR:
     {
       CallInfo result;
-      LinkInfo link_info(defc, name, type, caller, caller.not_null());
+      LinkInfo link_info(defc, name, type, caller, access_check);
       {
         assert(!HAS_PENDING_EXCEPTION, "");
         if (name == vmSymbols::object_initializer_name()) {
@@ -776,7 +780,7 @@
       fieldDescriptor result; // find_field initializes fd if found
       {
         assert(!HAS_PENDING_EXCEPTION, "");
-        LinkInfo link_info(defc, name, type, caller, /*check_access*/false);
+        LinkInfo link_info(defc, name, type, caller, LinkInfo::skip_access_check);
         LinkResolver::resolve_field(result, link_info, Bytecodes::_nop, false, THREAD);
         if (HAS_PENDING_EXCEPTION) {
           return empty;