summaryrefslogtreecommitdiff
path: root/vm
diff options
context:
space:
mode:
authorAndrew John Hughes <gnu_andrew@member.fsf.org>2008-03-05 21:16:34 +0000
committerAndrew John Hughes <gnu_andrew@member.fsf.org>2008-03-05 21:16:34 +0000
commit8b2997fa8e0e25964540141d181779f29297a11a (patch)
tree849c4c22650baf217903d07bcf593a06dd42e6e3 /vm
parent4e2974d2e7ae56365142789aac83ab0104027672 (diff)
downloadclasspath-8b2997fa8e0e25964540141d181779f29297a11a.tar.gz
2008-03-04 Andrew John Hughes <gnu_andrew@member.fsf.org>
* java/lang/reflect/AccessibleObject.java: (getAnnotation(Class)): Documented. (getAnnotations()): Likewise. (getDeclaredAnnotations()): Likewise. (isAnnotationPresent(Class)): Likewise. * java/lang/reflect/Constructor.java, * java/lang/reflect/Field.java, * java/lang/reflect/Method.java, * vm/reference/java/lang/reflect/VMConstructor.java, * vm/reference/java/lang/reflect/VMField.java, * vm/reference/java/lang/reflect/VMMethod.java: (getAnnotation(Class)): Added. (getDeclaredAnnotations()): Likewise.
Diffstat (limited to 'vm')
-rw-r--r--vm/reference/java/lang/reflect/VMConstructor.java24
-rw-r--r--vm/reference/java/lang/reflect/VMField.java26
-rw-r--r--vm/reference/java/lang/reflect/VMMethod.java24
3 files changed, 74 insertions, 0 deletions
diff --git a/vm/reference/java/lang/reflect/VMConstructor.java b/vm/reference/java/lang/reflect/VMConstructor.java
index c50291ccf..93b92b419 100644
--- a/vm/reference/java/lang/reflect/VMConstructor.java
+++ b/vm/reference/java/lang/reflect/VMConstructor.java
@@ -136,4 +136,28 @@ final class VMConstructor
return true;
}
+ /**
+ * Returns the element's annotation for the specified annotation type,
+ * or <code>null</code> if no such annotation exists.
+ *
+ * @param annotationClass the type of annotation to look for.
+ * @return this element's annotation for the specified type, or
+ * <code>null</code> if no such annotation exists.
+ * @throws NullPointerException if the annotation class is <code>null</code>.
+ */
+ native Annotation getAnnotation(Class annotationClass);
+
+ /**
+ * Returns all annotations directly defined by the element. If there are
+ * no annotations directly associated with the element, then a zero-length
+ * array will be returned. The returned array may be modified by the client
+ * code, but this will have no effect on the annotation content of this
+ * class, and hence no effect on the return value of this method for
+ * future callers.
+ *
+ * @return the annotations directly defined by the element.
+ * @since 1.5
+ */
+ native Annotation[] getDeclaredAnnotations();
+
}
diff --git a/vm/reference/java/lang/reflect/VMField.java b/vm/reference/java/lang/reflect/VMField.java
index a4b4dbb58..b54cd16e2 100644
--- a/vm/reference/java/lang/reflect/VMField.java
+++ b/vm/reference/java/lang/reflect/VMField.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package java.lang.reflect;
+import java.lang.annotation.Annotation;
+
final class VMField
{
Class declaringClass;
@@ -514,4 +516,28 @@ final class VMField
return true;
}
+ /**
+ * Returns the element's annotation for the specified annotation type,
+ * or <code>null</code> if no such annotation exists.
+ *
+ * @param annotationClass the type of annotation to look for.
+ * @return this element's annotation for the specified type, or
+ * <code>null</code> if no such annotation exists.
+ * @throws NullPointerException if the annotation class is <code>null</code>.
+ */
+ native Annotation getAnnotation(Class annotationClass);
+
+ /**
+ * Returns all annotations directly defined by the element. If there are
+ * no annotations directly associated with the element, then a zero-length
+ * array will be returned. The returned array may be modified by the client
+ * code, but this will have no effect on the annotation content of this
+ * class, and hence no effect on the return value of this method for
+ * future callers.
+ *
+ * @return the annotations directly defined by the element.
+ * @since 1.5
+ */
+ native Annotation[] getDeclaredAnnotations();
+
}
diff --git a/vm/reference/java/lang/reflect/VMMethod.java b/vm/reference/java/lang/reflect/VMMethod.java
index bc8afc11d..9654452ca 100644
--- a/vm/reference/java/lang/reflect/VMMethod.java
+++ b/vm/reference/java/lang/reflect/VMMethod.java
@@ -175,5 +175,29 @@ final class VMMethod
return true;
}
+ /**
+ * Returns the element's annotation for the specified annotation type,
+ * or <code>null</code> if no such annotation exists.
+ *
+ * @param annotationClass the type of annotation to look for.
+ * @return this element's annotation for the specified type, or
+ * <code>null</code> if no such annotation exists.
+ * @throws NullPointerException if the annotation class is <code>null</code>.
+ */
+ native Annotation getAnnotation(Class annotationClass);
+
+ /**
+ * Returns all annotations directly defined by the element. If there are
+ * no annotations directly associated with the element, then a zero-length
+ * array will be returned. The returned array may be modified by the client
+ * code, but this will have no effect on the annotation content of this
+ * class, and hence no effect on the return value of this method for
+ * future callers.
+ *
+ * @return the annotations directly defined by the element.
+ * @since 1.5
+ */
+ native Annotation[] getDeclaredAnnotations();
+
}