开发者

How to find all methods overriding superclass/interface methods without @Override annotation?

开发者 https://www.devze.com 2023-02-09 18:26 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消