diff --git a/src/share/vm/interpreter/linkResolver.cpp b/src/share/vm/interpreter/linkResolver.cpp index efb2a164fa2d7e17b35a425f467ef0e86f1b7d68..824afc194656922a0b650991cf63fbbace6a7294 100644 --- a/src/share/vm/interpreter/linkResolver.cpp +++ b/src/share/vm/interpreter/linkResolver.cpp @@ -803,7 +803,7 @@ void LinkResolver::runtime_resolve_special_method(CallInfo& result, methodHandle if (!direct_calling_default_method && 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() && diff --git a/src/share/vm/runtime/globals.hpp b/src/share/vm/runtime/globals.hpp index 8a0be8f8a4fb7b8e2204b61bde31216e0658b72a..d2e885abeee5526a54a5d3a35f7db796df8fb812 100644 --- a/src/share/vm/runtime/globals.hpp +++ b/src/share/vm/runtime/globals.hpp @@ -3640,7 +3640,10 @@ class CommandLineFlags { "Enable internal testing APIs") \ \ 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