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?
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
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.
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" .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With