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

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -509,15 +509,22 @@ public class AccessibleObject implements AnnotatedElement {
new ReflectionFactory.GetReflectionFactoryAction());
/**
* {@inheritDoc}
*
* <p> Note that any annotation returned by this method is a
* declaration annotation.
*
* @throws NullPointerException {@inheritDoc}
* @since 1.5
*/
@Override
public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
throw new AssertionError("All subclasses should override this method");
}
/**
* {@inheritDoc}
*
* @throws NullPointerException {@inheritDoc}
* @since 1.5
*/
@ -527,6 +534,11 @@ public class AccessibleObject implements AnnotatedElement {
}
/**
* {@inheritDoc}
*
* <p> Note that any annotations returned by this method are
* declaration annotations.
*
* @throws NullPointerException {@inheritDoc}
* @since 1.8
*/
@ -536,13 +548,24 @@ public class AccessibleObject implements AnnotatedElement {
}
/**
* {@inheritDoc}
*
* <p> Note that any annotations returned by this method are
* declaration annotations.
*
* @since 1.5
*/
@Override
public Annotation[] getAnnotations() {
return getDeclaredAnnotations();
}
/**
* {@inheritDoc}
*
* <p> Note that any annotation returned by this method is a
* declaration annotation.
*
* @throws NullPointerException {@inheritDoc}
* @since 1.8
*/
@ -555,6 +578,11 @@ public class AccessibleObject implements AnnotatedElement {
}
/**
* {@inheritDoc}
*
* <p> Note that any annotations returned by this method are
* declaration annotations.
*
* @throws NullPointerException {@inheritDoc}
* @since 1.8
*/
@ -567,8 +595,14 @@ public class AccessibleObject implements AnnotatedElement {
}
/**
* {@inheritDoc}
*
* <p> Note that any annotations returned by this method are
* declaration annotations.
*
* @since 1.5
*/
@Override
public Annotation[] getDeclaredAnnotations() {
throw new AssertionError("All subclasses should override this method");
}