Details
-
Bug
-
Resolution: Fixed
-
P3
-
None
Description
The spec https://download.java.net/java/early_access/jdk13/docs/api/java.base/java/lang/reflect/AccessibleObject.html#getAnnotation(java.lang.Class)
still says:
"Description copied from interface: AnnotatedElement
Returns this element's annotation for the specified type if such an annotation is present, else null."
In fact the following:
new AccessibleObject() {}.getAnnotation(Deprecated.class);
leads to
java.lang.AssertionError: All subclasses should override this method
same thing with
new AccessibleObject() {}.getAnnotationsByType(Deprecated.class);
This (default) behavior deserves to be specified for example with @implSpec
* @implSpec
* This default implementation throws {@code AssertionError}.
still says:
"Description copied from interface: AnnotatedElement
Returns this element's annotation for the specified type if such an annotation is present, else null."
In fact the following:
new AccessibleObject() {}.getAnnotation(Deprecated.class);
leads to
java.lang.AssertionError: All subclasses should override this method
same thing with
new AccessibleObject() {}.getAnnotationsByType(Deprecated.class);
This (default) behavior deserves to be specified for example with @implSpec
* @implSpec
* This default implementation throws {@code AssertionError}.
Attachments
Issue Links
- csr for
-
JDK-8267506 Add implSpec's to AccessibleObject and seal Executable
- Closed
- is blocked by
-
JDK-8260514 JEP 409: Sealed Classes
- Closed
- relates to
-
JDK-8246775 JEP 397: Sealed Classes (Second Preview)
- Closed
-
JDK-8224022 Add @Meant-to-be-sealed annotation type to guide compiler warnings
- Open
-
JDK-8288573 Make Executable.getParameterCount() actually abstract
- Resolved
-
JDK-8283414 Update java.base to use sealed classes (umbrella)
- Closed
(1 relates to, 2 links to)