1

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

andPat
  • 4,153
  • 7
  • 24
  • 36
  • If you are looking for a Maven-based solution, I would recommend you remove the references to Netbeans in your title and question. – Duncan Jones Jul 02 '13 at 09:38

1 Answers1

1

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>
smsnheck
  • 1,563
  • 3
  • 21
  • 33
  • thank you very much, unfortunately I need also a maven compiler plugin configuration to do so :( – andPat Jul 02 '13 at 09:53
  • 1
    ` -Xlint:overrides` doesn't work because semantics of this command of javac is not to check for missing @Override annotations but on type of parameters of functions also annotated with @Override! – andPat Jul 02 '13 at 10:07