Mercurial > hg > truffle
comparison src/share/vm/prims/jvm.cpp @ 7457:35431a769282
8004823: Add VM support for type annotation reflection
Reviewed-by: dholmes, coleenp
Contributed-by: joel.franck@oracle.com
author | stefank |
---|---|
date | Thu, 20 Dec 2012 10:22:19 +0100 |
parents | 070d523b96a7 |
children | ade95d680b42 |
comparison
equal
deleted
inserted
replaced
7456:7d42f3b08300 | 7457:35431a769282 |
---|---|
1571 Method* m = jvm_get_method_common(method, CHECK_NULL); | 1571 Method* m = jvm_get_method_common(method, CHECK_NULL); |
1572 return (jbyteArray) JNIHandles::make_local(env, | 1572 return (jbyteArray) JNIHandles::make_local(env, |
1573 Annotations::make_java_array(m->parameter_annotations(), THREAD)); | 1573 Annotations::make_java_array(m->parameter_annotations(), THREAD)); |
1574 JVM_END | 1574 JVM_END |
1575 | 1575 |
1576 /* Type use annotations support (JDK 1.8) */ | |
1577 | |
1578 JVM_ENTRY(jbyteArray, JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls)) | |
1579 assert (cls != NULL, "illegal class"); | |
1580 JVMWrapper("JVM_GetClassTypeAnnotations"); | |
1581 ResourceMark rm(THREAD); | |
1582 // Return null for arrays and primitives | |
1583 if (!java_lang_Class::is_primitive(JNIHandles::resolve(cls))) { | |
1584 Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls)); | |
1585 if (k->oop_is_instance()) { | |
1586 typeArrayOop a = Annotations::make_java_array(InstanceKlass::cast(k)->type_annotations()->class_annotations(), CHECK_NULL); | |
1587 return (jbyteArray) JNIHandles::make_local(env, a); | |
1588 } | |
1589 } | |
1590 return NULL; | |
1591 JVM_END | |
1592 | |
1576 | 1593 |
1577 // New (JDK 1.4) reflection implementation ///////////////////////////////////// | 1594 // New (JDK 1.4) reflection implementation ///////////////////////////////////// |
1578 | 1595 |
1579 JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, jboolean publicOnly)) | 1596 JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, jboolean publicOnly)) |
1580 { | 1597 { |