< prev index next >
src/java.base/share/classes/java/lang/Class.java
Print this page
@@ -3777,13 +3777,18 @@
else
throw new ClassCastException(this.toString());
}
/**
+ * {@inheritDoc}
+ * <p>Note that any annotation returned by this method is a
+ * declaration annotation.
+ *
* @throws NullPointerException {@inheritDoc}
* @since 1.5
*/
+ @Override
@SuppressWarnings("unchecked")
public <A extends Annotation> A getAnnotation(Class<A> annotationClass) {
Objects.requireNonNull(annotationClass);
return (A) annotationData().annotations.get(annotationClass);
@@ -3798,10 +3803,14 @@
public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) {
return GenericDeclaration.super.isAnnotationPresent(annotationClass);
}
/**
+ * {@inheritDoc}
+ * <p>Note that any annotations returned by this method are
+ * declaration annotations.
+ *
* @throws NullPointerException {@inheritDoc}
* @since 1.8
*/
@Override
public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationClass) {
@@ -3812,17 +3821,26 @@
this,
annotationClass);
}
/**
+ * {@inheritDoc}
+ * <p>Note that any annotations returned by this method are
+ * declaration annotations.
+ *
* @since 1.5
*/
+ @Override
public Annotation[] getAnnotations() {
return AnnotationParser.toArray(annotationData().annotations);
}
/**
+ * {@inheritDoc}
+ * <p>Note that any annotation returned by this method is a
+ * declaration annotation.
+ *
* @throws NullPointerException {@inheritDoc}
* @since 1.8
*/
@Override
@SuppressWarnings("unchecked")
@@ -3831,10 +3849,14 @@
return (A) annotationData().declaredAnnotations.get(annotationClass);
}
/**
+ * {@inheritDoc}
+ * <p>Note that any annotations returned by this method are
+ * declaration annotations.
+ *
* @throws NullPointerException {@inheritDoc}
* @since 1.8
*/
@Override
public <A extends Annotation> A[] getDeclaredAnnotationsByType(Class<A> annotationClass) {
@@ -3843,12 +3865,17 @@
return AnnotationSupport.getDirectlyAndIndirectlyPresent(annotationData().declaredAnnotations,
annotationClass);
}
/**
+ * {@inheritDoc}
+ * <p>Note that any annotations returned by this method are
+ * declaration annotations.
+ *
* @since 1.5
*/
+ @Override
public Annotation[] getDeclaredAnnotations() {
return AnnotationParser.toArray(annotationData().declaredAnnotations);
}
// annotation data that might get invalidated when JVM TI RedefineClasses() is called
< prev index next >