Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Don't show warning for unused Getters/Setters

When a method is never used, IntelliJ shows a warning Method xxx() is never used

But for POJOs, I create Getters/Setters for every attributes and I do not want IntelliJ to warn me for unused Getters/Setters.

Is there a way to automatically suppress those warnings?

like image 239
Arnaud Denoyelle Avatar asked Oct 14 '14 08:10

Arnaud Denoyelle


3 Answers

Since IDEA 2016.3, there is now a setting to do this. Using IntelliJ on a Mac, it is under Settings | Editor | Inspections | Java | Declaration redundancy | Unused Declarations | Methods | Getters/setters

Disable unused getter/setter method warnings

like image 142
TerekC Avatar answered Oct 19 '22 22:10

TerekC


I believe you can annotate your methods with //noinspection.

You can navigate to Settings | Inspections | Declaration redundancy | Unused Declarations and define a scope for your methods but I do believe you cannot disable it for getters/setters only an leave other methods out of inspection.

like image 39
tmarwen Avatar answered Oct 19 '22 23:10

tmarwen


I'd recommend lowering the severity for unused methods in general. Simply go to Settings | Inspections | Declaration redundancy | Unused Declarations, and change the severity to "Info" or "Weak Warning" .

like image 43
BZapper Avatar answered Oct 19 '22 22:10

BZapper