changeset 4232:db7028c8a953 jdk7u11-b03

8001307: Modify ACC_SUPER behavior Summary: Disallow non-virtual calls even when ACC_SUPER is absent. Reviewed-by: kvn, acorn
author kamg
date Thu, 08 Nov 2012 17:45:05 -0500
parents 6767490c06a8
children 4d418a1b8be0 c893d43c9fb1
files src/share/vm/interpreter/linkResolver.cpp src/share/vm/runtime/globals.hpp
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/interpreter/linkResolver.cpp	Fri Oct 12 11:55:32 2012 -0700
+++ b/src/share/vm/interpreter/linkResolver.cpp	Thu Nov 08 17:45:05 2012 -0500
@@ -712,7 +712,7 @@
 
     if (check_access &&
         // a) check if ACC_SUPER flag is set for the current class
-        current_klass->is_super() &&
+        (current_klass->is_super() || !AllowNonVirtualCalls) &&
         // b) check if the method class is a superclass of the current class (superclass relation is not reflexive!)
         current_klass->is_subtype_of(method_klass()) && current_klass() != method_klass() &&
         // c) check if the method is not <init>
--- a/src/share/vm/runtime/globals.hpp	Fri Oct 12 11:55:32 2012 -0700
+++ b/src/share/vm/runtime/globals.hpp	Thu Nov 08 17:45:05 2012 -0500
@@ -3902,7 +3902,10 @@
   product(bool, UseVMInterruptibleIO, false,                                \
           "(Unstable, Solaris-specific) Thread interrupt before or with "   \
           "EINTR for I/O operations results in OS_INTRPT. The default value"\
-          " of this flag is true for JDK 6 and earlier")
+          " of this flag is true for JDK 6 and earlier")                    \
+                                                                            \
+  product(bool, AllowNonVirtualCalls, false,                                \
+         "Obey the ACC_SUPER flag and allow invokenonvirtual calls")
 
 /*
  *  Macros for factoring of globals