Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8224243

Add implSpec's to AccessibleObject and seal Executable

    XMLWordPrintable

    Details

      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}.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              darcy Joe Darcy
              Reporter:
              dbessono Dmitry Bessonov
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: