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

@ -434,9 +434,14 @@ public class Package extends NamedPackage implements java.lang.reflect.Annotated
}
/**
* {@inheritDoc}
* <p>Note that any annotation returned by this method is a
* declaration annotation.
*
* @throws NullPointerException {@inheritDoc}
* @since 1.5
*/
@Override
public <A extends Annotation> A getAnnotation(Class<A> annotationClass) {
return getPackageInfo().getAnnotation(annotationClass);
}
@ -452,6 +457,10 @@ public class Package extends NamedPackage implements java.lang.reflect.Annotated
}
/**
* {@inheritDoc}
* <p>Note that any annotations returned by this method are
* declaration annotations.
*
* @throws NullPointerException {@inheritDoc}
* @since 1.8
*/
@ -461,13 +470,21 @@ public class Package extends NamedPackage implements java.lang.reflect.Annotated
}
/**
* {@inheritDoc}
* <p>Note that any annotations returned by this method are
* declaration annotations.
* @since 1.5
*/
@Override
public Annotation[] getAnnotations() {
return getPackageInfo().getAnnotations();
}
/**
* {@inheritDoc}
* <p>Note that any annotation returned by this method is a
* declaration annotation.
*
* @throws NullPointerException {@inheritDoc}
* @since 1.8
*/
@ -486,8 +503,12 @@ public class Package extends NamedPackage implements java.lang.reflect.Annotated
}
/**
* {@inheritDoc}
* <p>Note that any annotations returned by this method are
* declaration annotations.
* @since 1.5
*/
@Override
public Annotation[] getDeclaredAnnotations() {
return getPackageInfo().getDeclaredAnnotations();
}