8225540: In core reflection note whether returned annotations are declaration or type annotations

Reviewed-by: alanb, prappo
This commit is contained in:
Joe Darcy 2020-04-09 14:16:17 -07:00
parent b7d5172b89
commit 455d2e7cea
13 changed files with 209 additions and 24 deletions

View file

@ -3779,9 +3779,14 @@ public final class Class<T> implements java.io.Serializable,
}
/**
* {@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);
@ -3800,6 +3805,10 @@ public final class Class<T> implements java.io.Serializable,
}
/**
* {@inheritDoc}
* <p>Note that any annotations returned by this method are
* declaration annotations.
*
* @throws NullPointerException {@inheritDoc}
* @since 1.8
*/
@ -3814,13 +3823,22 @@ public final class Class<T> implements java.io.Serializable,
}
/**
* {@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
*/
@ -3833,6 +3851,10 @@ public final class Class<T> implements java.io.Serializable,
}
/**
* {@inheritDoc}
* <p>Note that any annotations returned by this method are
* declaration annotations.
*
* @throws NullPointerException {@inheritDoc}
* @since 1.8
*/
@ -3845,8 +3867,13 @@ public final class Class<T> implements java.io.Serializable,
}
/**
* {@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);
}