diff src/share/vm/oops/instanceKlass.cpp @ 652:4aaa9f5e02a8

4766230: Hotspot vtable inconsistencies cause core dumps. 6579515. 6582242. Reviewed-by: kamg, coleenp
author acorn
date Wed, 18 Mar 2009 17:20:57 -0400
parents 98cb887364d3
children d3676b4cb78c
line wrap: on
line diff
--- a/src/share/vm/oops/instanceKlass.cpp	Mon Mar 16 08:50:53 2009 -0400
+++ b/src/share/vm/oops/instanceKlass.cpp	Wed Mar 18 17:20:57 2009 -0400
@@ -1859,6 +1859,25 @@
   }
 }
 
+// Returns true iff super_method can be overridden by a method in targetclassname
+// See JSL 3rd edition 8.4.6.1
+// Assumes name-signature match
+// "this" is instanceKlass of super_method which must exist
+// note that the instanceKlass of the method in the targetclassname has not always been created yet
+bool instanceKlass::is_override(methodHandle super_method, Handle targetclassloader, symbolHandle targetclassname, TRAPS) {
+   // Private methods can not be overridden
+   if (super_method->is_private()) {
+     return false;
+   }
+   // If super method is accessible, then override
+   if ((super_method->is_protected()) ||
+       (super_method->is_public())) {
+     return true;
+   }
+   // Package-private methods are not inherited outside of package
+   assert(super_method->is_package_private(), "must be package private");
+   return(is_same_class_package(targetclassloader(), targetclassname()));
+}
 
 jint instanceKlass::compute_modifier_flags(TRAPS) const {
   klassOop k = as_klassOop();