8033126: Can't call default methods from JNI
authorsla
Mon, 03 Feb 2014 15:24:20 +0100
changeset 22737 c2f6dd6c9628
parent 22736 6c317cced072
child 22738 e2e6f03308f9
8033126: Can't call default methods from JNI Reviewed-by: dholmes, acorn, kamg
hotspot/src/share/vm/prims/jni.cpp
--- a/hotspot/src/share/vm/prims/jni.cpp	Mon Feb 03 13:41:26 2014 +0100
+++ b/hotspot/src/share/vm/prims/jni.cpp	Mon Feb 03 15:24:20 2014 +0100
@@ -1320,9 +1320,13 @@
       // interface call
       KlassHandle h_holder(THREAD, holder);
 
-      int itbl_index = m->itable_index();
-      Klass* k = h_recv->klass();
-      selected_method = InstanceKlass::cast(k)->method_at_itable(h_holder(), itbl_index, CHECK);
+      if (call_type == JNI_VIRTUAL) {
+        int itbl_index = m->itable_index();
+        Klass* k = h_recv->klass();
+        selected_method = InstanceKlass::cast(k)->method_at_itable(h_holder(), itbl_index, CHECK);
+      } else {
+        selected_method = m;
+      }
     }
   }