diff src/share/vm/oops/instanceKlass.cpp @ 13401:22eaa15b7960

8026065: InterfaceMethodref for invokespecial must name a direct superinterface Summary: Add verification to check that invokespecial of an InterfaceMethodref names a method in a direct superinterface of the current class or interface in accordance with JSR 335, JVMS 4.9.2 Structural Constraints. Reviewed-by: acorn, hseigel, coleenp Contributed-by: lois.foltan@oracle.com
author hseigel
date Tue, 26 Nov 2013 09:52:22 -0500
parents 6e1826d5c23e
children 379f11bc04fc 9fc985481d78 3205e78d8193
line wrap: on
line diff
--- a/src/share/vm/oops/instanceKlass.cpp	Sat Nov 23 12:25:13 2013 +0100
+++ b/src/share/vm/oops/instanceKlass.cpp	Tue Nov 26 09:52:22 2013 -0500
@@ -1051,6 +1051,18 @@
   return false;
 }
 
+bool InstanceKlass::is_same_or_direct_interface(Klass *k) const {
+  // Verify direct super interface
+  if (this == k) return true;
+  assert(k->is_interface(), "should be an interface class");
+  for (int i = 0; i < local_interfaces()->length(); i++) {
+    if (local_interfaces()->at(i) == k) {
+      return true;
+    }
+  }
+  return false;
+}
+
 objArrayOop InstanceKlass::allocate_objArray(int n, int length, TRAPS) {
   if (length < 0) THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
   if (length > arrayOopDesc::max_array_length(T_OBJECT)) {