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, searc开发者_开发百科h technique in any IDE would help
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".
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)
In Netbeans, right click the project, select Inspect and Transform, select "Add @Override Annotation" from the Single Inspection combo-box, hit Inspect, then Refactor.
精彩评论