8001307: Modify ACC_SUPER behavior

Disallow non-virtual calls even when ACC_SUPER is absent.

Reviewed-by: kvn, acorn
This commit is contained in:
Keith McGuigan 2012-11-05 17:03:33 -05:00
parent d936c96d3b
commit c1be65b49c
2 changed files with 5 additions and 2 deletions

View File

@ -786,7 +786,7 @@ void LinkResolver::runtime_resolve_special_method(CallInfo& result, methodHandle
if (check_access && if (check_access &&
// a) check if ACC_SUPER flag is set for the current class // 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!) // 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() && current_klass->is_subtype_of(method_klass()) && current_klass() != method_klass() &&
// c) check if the method is not <init> // c) check if the method is not <init>

View File

@ -3602,7 +3602,10 @@ class CommandLineFlags {
"Enable internal testing APIs") \ "Enable internal testing APIs") \
\ \
product(bool, PrintGCCause, true, \ product(bool, PrintGCCause, true, \
"Include GC cause in GC logging") "Include GC cause in GC logging") \
\
product(bool, AllowNonVirtualCalls, false, \
"Obey the ACC_SUPER flag and allow invokenonvirtual calls")
/* /*
* Macros for factoring of globals * Macros for factoring of globals