Skip to content

Java: Deprecate and remove Element::getDoc #5320

Description

@Marcono1234

Element::getDoc only performs an implicit cast of this:

/** Cast this element to a `Documentable`. */
Documentable getDoc() { result = this }

  • This is probably redundant because you can instead write a cast element.(Document) ...
  • It is irritating because it suggests that every Element can be 'converted' to Document, which is not the case
  • It causes irritating error messages when used on types which cannot be cast to Document:
    Error message screenshot

Therefore it might be good to deprecate and remove the predicate.

Edit: Package is not a good example for an Element which does not extend Document since it should support documentation, see #5288. Though there are other Element subclasses such as Import or Modifier which cannot be documented in Java.

Relates to #3705

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions