--- a/hotspot/src/share/vm/runtime/reflection.cpp Thu May 15 10:44:20 2014 -0700
+++ b/hotspot/src/share/vm/runtime/reflection.cpp Thu May 15 17:38:50 2014 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -466,7 +466,6 @@
// New (1.4) reflection implementation. Allow all accesses from
// sun/reflect/MagicAccessorImpl subclasses to succeed trivially.
if ( JDK_Version::is_gte_jdk14x_version()
- && UseNewReflection
&& current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
return true;
}
@@ -571,7 +570,6 @@
// New (1.4) reflection implementation. Allow all accesses from
// sun/reflect/MagicAccessorImpl subclasses to succeed trivially.
if ( JDK_Version::is_gte_jdk14x_version()
- && UseNewReflection
&& current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
return true;
}
@@ -708,7 +706,7 @@
}
-oop Reflection::new_method(methodHandle method, bool intern_name, bool for_constant_pool_access, TRAPS) {
+oop Reflection::new_method(methodHandle method, bool for_constant_pool_access, TRAPS) {
// In jdk1.2.x, getMethods on an interface erroneously includes <clinit>, thus the complicated assert.
// Also allow sun.reflect.ConstantPool to refer to <clinit> methods as java.lang.reflect.Methods.
assert(!method()->is_initializer() ||
@@ -731,14 +729,8 @@
if (exception_types.is_null()) return NULL;
Symbol* method_name = method->name();
- Handle name;
- if (intern_name) {
- // intern_name is only true with UseNewReflection
- oop name_oop = StringTable::intern(method_name, CHECK_NULL);
- name = Handle(THREAD, name_oop);
- } else {
- name = java_lang_String::create_from_symbol(method_name, CHECK_NULL);
- }
+ oop name_oop = StringTable::intern(method_name, CHECK_NULL);
+ Handle name = Handle(THREAD, name_oop);
if (name == NULL) return NULL;
int modifiers = method->access_flags().as_int() & JVM_RECOGNIZED_METHOD_MODIFIERS;
@@ -825,16 +817,10 @@
}
-oop Reflection::new_field(fieldDescriptor* fd, bool intern_name, TRAPS) {
+oop Reflection::new_field(fieldDescriptor* fd, TRAPS) {
Symbol* field_name = fd->name();
- Handle name;
- if (intern_name) {
- // intern_name is only true with UseNewReflection
- oop name_oop = StringTable::intern(field_name, CHECK_NULL);
- name = Handle(THREAD, name_oop);
- } else {
- name = java_lang_String::create_from_symbol(field_name, CHECK_NULL);
- }
+ oop name_oop = StringTable::intern(field_name, CHECK_NULL);
+ Handle name = Handle(THREAD, name_oop);
Symbol* signature = fd->signature();
instanceKlassHandle holder (THREAD, fd->field_holder());
Handle type = new_type(signature, holder, CHECK_NULL);
@@ -933,27 +919,23 @@
// resolve based on the receiver
if (reflected_method->method_holder()->is_interface()) {
// resolve interface call
- if (ReflectionWrapResolutionErrors) {
- // new default: 6531596
- // Match resolution errors with those thrown due to reflection inlining
- // Linktime resolution & IllegalAccessCheck already done by Class.getMethod()
- method = resolve_interface_call(klass, reflected_method, target_klass, receiver, THREAD);
- if (HAS_PENDING_EXCEPTION) {
- // Method resolution threw an exception; wrap it in an InvocationTargetException
- oop resolution_exception = PENDING_EXCEPTION;
- CLEAR_PENDING_EXCEPTION;
- // JVMTI has already reported the pending exception
- // JVMTI internal flag reset is needed in order to report InvocationTargetException
- if (THREAD->is_Java_thread()) {
- JvmtiExport::clear_detected_exception((JavaThread*) THREAD);
- }
- JavaCallArguments args(Handle(THREAD, resolution_exception));
- THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(),
- vmSymbols::throwable_void_signature(),
- &args);
+ //
+ // Match resolution errors with those thrown due to reflection inlining
+ // Linktime resolution & IllegalAccessCheck already done by Class.getMethod()
+ method = resolve_interface_call(klass, reflected_method, target_klass, receiver, THREAD);
+ if (HAS_PENDING_EXCEPTION) {
+ // Method resolution threw an exception; wrap it in an InvocationTargetException
+ oop resolution_exception = PENDING_EXCEPTION;
+ CLEAR_PENDING_EXCEPTION;
+ // JVMTI has already reported the pending exception
+ // JVMTI internal flag reset is needed in order to report InvocationTargetException
+ if (THREAD->is_Java_thread()) {
+ JvmtiExport::clear_detected_exception((JavaThread*) THREAD);
}
- } else {
- method = resolve_interface_call(klass, reflected_method, target_klass, receiver, CHECK_(NULL));
+ JavaCallArguments args(Handle(THREAD, resolution_exception));
+ THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(),
+ vmSymbols::throwable_void_signature(),
+ &args);
}
} else {
// if the method can be overridden, we resolve using the vtable index.
@@ -970,24 +952,16 @@
// Check for abstract methods as well
if (method->is_abstract()) {
// new default: 6531596
- if (ReflectionWrapResolutionErrors) {
- ResourceMark rm(THREAD);
- Handle h_origexception = Exceptions::new_exception(THREAD,
- vmSymbols::java_lang_AbstractMethodError(),
- Method::name_and_sig_as_C_string(target_klass(),
- method->name(),
- method->signature()));
- JavaCallArguments args(h_origexception);
- THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(),
- vmSymbols::throwable_void_signature(),
- &args);
- } else {
- ResourceMark rm(THREAD);
- THROW_MSG_0(vmSymbols::java_lang_AbstractMethodError(),
- Method::name_and_sig_as_C_string(target_klass(),
- method->name(),
- method->signature()));
- }
+ ResourceMark rm(THREAD);
+ Handle h_origexception = Exceptions::new_exception(THREAD,
+ vmSymbols::java_lang_AbstractMethodError(),
+ Method::name_and_sig_as_C_string(target_klass(),
+ method->name(),
+ method->signature()));
+ JavaCallArguments args(h_origexception);
+ THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(),
+ vmSymbols::throwable_void_signature(),
+ &args);
}
}
}
@@ -1006,7 +980,7 @@
// In the JDK 1.4 reflection implementation, the security check is
// done at the Java level
- if (!(JDK_Version::is_gte_jdk14x_version() && UseNewReflection)) {
+ if (!JDK_Version::is_gte_jdk14x_version()) {
// Access checking (unless overridden by Method)
if (!override) {
@@ -1018,7 +992,7 @@
}
}
- } // !(Universe::is_gte_jdk14x_version() && UseNewReflection)
+ } // !Universe::is_gte_jdk14x_version()
assert(ptypes->is_objArray(), "just checking");
int args_len = args.is_null() ? 0 : args->length();