mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8004823: Add VM support for type annotation reflection
Reviewed-by: dholmes, coleenp
This commit is contained in:
parent
9c761152db
commit
6ed6cb5375
22 changed files with 302 additions and 11 deletions
|
@ -1573,6 +1573,23 @@ JVM_ENTRY(jbyteArray, JVM_GetMethodParameterAnnotations(JNIEnv *env, jobject met
|
|||
Annotations::make_java_array(m->parameter_annotations(), THREAD));
|
||||
JVM_END
|
||||
|
||||
/* Type use annotations support (JDK 1.8) */
|
||||
|
||||
JVM_ENTRY(jbyteArray, JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls))
|
||||
assert (cls != NULL, "illegal class");
|
||||
JVMWrapper("JVM_GetClassTypeAnnotations");
|
||||
ResourceMark rm(THREAD);
|
||||
// Return null for arrays and primitives
|
||||
if (!java_lang_Class::is_primitive(JNIHandles::resolve(cls))) {
|
||||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
|
||||
if (k->oop_is_instance()) {
|
||||
typeArrayOop a = Annotations::make_java_array(InstanceKlass::cast(k)->type_annotations()->class_annotations(), CHECK_NULL);
|
||||
return (jbyteArray) JNIHandles::make_local(env, a);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
JVM_END
|
||||
|
||||
|
||||
// New (JDK 1.4) reflection implementation /////////////////////////////////////
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue