Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-35131

@Override annotation should be applied to implementations of interface methods

    Details

    • Business Value:
      2

      Description

      The @Override annotation is currently being applied when a method implementation overrides an ancestor's method implementation. However, the @Override annotation should also be applied when a class implements an interface's method. This achieves two things:

      1. The compiler checks for that the method indeed overrides or implements an ancestor method. If a match is not found, the compiler reports the error and fails. The developer can then update the implementation's signature to keep it in-sync with the interface.
      2. The annotation clarifies the author's intent of implementing the interface method.

      Considerations:

      • Since the JavadocFormatter already inserts the annotation for implementation of abstract base class methods, it should be improved to insert the annotation for implementation of interface methods.
      • The service builder templates should be checked to apply the annotation for this case, too.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Subcomponents