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ć
  • 63,078
  • 28
  • 122
  • 148

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
  • 588,226
  • 146
  • 1,060
  • 1,140
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ć
  • 63,078
  • 28
  • 122
  • 148
  • 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
  • 501
  • 4
  • 12