< prev index next >
src/hotspot/share/prims/jvm.cpp
Print this page
rev 55090 : secret-sfac
*** 1664,1677 ****
return (jobjectArray) JNIHandles::make_local(env, result());
}
JVM_END
static bool select_method(const methodHandle& method, bool want_constructor) {
if (want_constructor) {
! return (method->is_initializer() && !method->is_static());
} else {
! return (!method->is_initializer() && !method->is_overpass());
}
}
static jobjectArray get_class_declared_methods_helper(
JNIEnv *env,
--- 1664,1681 ----
return (jobjectArray) JNIHandles::make_local(env, result());
}
JVM_END
static bool select_method(const methodHandle& method, bool want_constructor) {
+ bool is_ctor = (method->is_object_constructor() ||
+ method->is_static_init_factory());
if (want_constructor) {
! return is_ctor;
} else {
! return (!is_ctor &&
! !method->is_class_initializer() &&
! !method->is_overpass());
}
}
static jobjectArray get_class_declared_methods_helper(
JNIEnv *env,
*** 1729,1738 ****
--- 1733,1744 ----
// Otherwise should probably put a method that throws NSME
result->obj_at_put(i, NULL);
} else {
oop m;
if (want_constructor) {
+ assert(method->is_object_constructor() ||
+ method->is_static_init_factory(), "must be");
m = Reflection::new_constructor(method, CHECK_NULL);
} else {
m = Reflection::new_method(method, false, CHECK_NULL);
}
result->obj_at_put(i, m);
*** 1945,1958 ****
methodHandle m (THREAD, k->find_method(name, sig));
if (m.is_null()) {
THROW_MSG_0(vmSymbols::java_lang_RuntimeException(), "Unable to look up method in target class");
}
oop method;
! if (!m->is_initializer() || m->is_static()) {
! method = Reflection::new_method(m, true, CHECK_NULL);
! } else {
method = Reflection::new_constructor(m, CHECK_NULL);
}
return JNIHandles::make_local(method);
}
JVM_ENTRY(jobject, JVM_ConstantPoolGetMethodAt(JNIEnv *env, jobject obj, jobject unused, jint index))
--- 1951,1964 ----
methodHandle m (THREAD, k->find_method(name, sig));
if (m.is_null()) {
THROW_MSG_0(vmSymbols::java_lang_RuntimeException(), "Unable to look up method in target class");
}
oop method;
! if (m->is_object_constructor()) {
method = Reflection::new_constructor(m, CHECK_NULL);
+ } else {
+ method = Reflection::new_method(m, true, CHECK_NULL);
}
return JNIHandles::make_local(method);
}
JVM_ENTRY(jobject, JVM_ConstantPoolGetMethodAt(JNIEnv *env, jobject obj, jobject unused, jint index))
*** 2457,2467 ****
JVMWrapper("JVM_IsConstructorIx");
ResourceMark rm(THREAD);
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
Method* method = InstanceKlass::cast(k)->methods()->at(method_index);
! return method->name() == vmSymbols::object_initializer_name();
JVM_END
JVM_QUICK_ENTRY(jboolean, JVM_IsVMGeneratedMethodIx(JNIEnv *env, jclass cls, int method_index))
JVMWrapper("JVM_IsVMGeneratedMethodIx");
--- 2463,2473 ----
JVMWrapper("JVM_IsConstructorIx");
ResourceMark rm(THREAD);
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread);
Method* method = InstanceKlass::cast(k)->methods()->at(method_index);
! return method->is_object_constructor();
JVM_END
JVM_QUICK_ENTRY(jboolean, JVM_IsVMGeneratedMethodIx(JNIEnv *env, jclass cls, int method_index))
JVMWrapper("JVM_IsVMGeneratedMethodIx");
< prev index next >