andPat
andPat

Reputation: 4522

How to check for missing @Override annotations with Maven

I've a maven project in which, I'm sure, there are classes which need and don't have @Override annotations. Is there a way to configure maven compiler plugin to show a warning on missing @Override annotations?

I'm using Netbeans but I would prefer to do it with maven only

Upvotes: 1

Views: 316

Answers (1)

smsnheck
smsnheck

Reputation: 1593

In Netbeans click on Source > Inspect. Then you can set the "search scope" (project, current file..). When you click on the "Manage" Button you can uncollapse "JDK 1.5 and later" where you can check the box "Add @Override Annotation. This helps you finding the missing @Override Annotations.

But i can't tell you how to find the needless @Override Annotations..

With maven you can try to add these lines to the maven compiler plugin config (didn't try this at all..):

<compilerArgs>
   <arg>-Xlint:rawtypes</arg>
   <arg>-Xlint:overrides</arg>
</compilerArgs>

Upvotes: 1

Related Questions