Disable "not used" warning for public methods of a class

You can disable it for a single method like this

@SuppressWarnings("unused")
public void myMethod(){...}

IDEA 2016.3

In the upcoming version IDEA 2016.3 (preview version already available) it is now possible to adjust the inspection scope:

enter image description here

< IDEA 14.0

If you want to highlight unused public methods, please enable the "Settings|Inspections|Declaration redundancy|Unused declaration" global inspection.

If you want to highlight unused private methods, please enable the "Settings|Inspections|Declaration redundancy|Unused symbol" local inspection.

So, if you want to highlight unused private members, but do not highlight unused public members, turn off "Unused declaration" and turn on "Unused symbol".

Source

I've just tested it using IDEA 13.1.4, and it worked exactly as described.

IDEA 14.x

In IntelliJ IDEA 14.0.x the settings are under:

Settings | Editor | Inspections | Declaration redundancy | Unused symbol/declaration

In IntelliJ IDEA 14.1 the option appears to be gone..


Disable Settings | Inspections | Declaration redundancy | Unused Declaration code inspection. As an option you can create a custom scope for your API classes and disable this inspection only per API scope so that it still works in the rest parts of your project.