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
    • Similar Issues:
      Show 5 results 

      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.

        Issue Links

          Activity

          Hide
          Lawrence Lee added a comment -

          Committed on:
          Portal 6.1.x GIT ID: b9dbe87b7f5858cfa763d218120e7f710ec2e57a.
          Portal 6.2.x GIT ID: 827042919d9cb009f84c49be45f9efccf1c76855.

          Show
          Lawrence Lee added a comment - Committed on: Portal 6.1.x GIT ID: b9dbe87b7f5858cfa763d218120e7f710ec2e57a. Portal 6.2.x GIT ID: 827042919d9cb009f84c49be45f9efccf1c76855.

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development

                  Structure Helper Panel