6

It's clear that having @Override annotation on overriding methods is a good practice. Is there an automatic way of finding all methods that miss the @Override annotation in a project? A script, search technique in any IDE would help

Boris Pavlović
  • 60,971
  • 26
  • 119
  • 144

3 Answers3

6

Eclipse shows warnings if you are missing @Override. You can go to:

Window > Preferences > Java > Compiler > Errors/Warnings > Annotations

You can choose to have warning or even error for "Missing @Override annotation".

Bozho
  • 572,413
  • 138
  • 1,043
  • 1,132
5

In IntelliJ IDEA open Settings CtrlAltS in Inspections open Class Structure -> 'Missing @Override annotation'

For version 15.0.3 and newer: Editor > Inspections > Java > Inheritance Issues > Missing @ Override (via @skubski)

Boris Pavlović
  • 60,971
  • 26
  • 119
  • 144
  • 1
    This now is under Editor > Inspections > Java > Inheritance Issues > Missing @ Override (Using IJ 15.0.3) – skubski Mar 03 '16 at 12:49
4

In Netbeans, right click the project, select Inspect and Transform, select "Add @Override Annotation" from the Single Inspection combo-box, hit Inspect, then Refactor.

kazmer
  • 381
  • 3
  • 12