Disable warning in IntelliJ for one line Disable warning in IntelliJ for one line java java

Disable warning in IntelliJ for one line


Mostly in IntelliJ, you can click on the line and Alt+Enter, and it will have options for suppressing the warning, among other things.


Expanding upon Ryan Stewart's answer, in IntelliJ, use Alt+Enter, then select the first sub-menu, then the last item: Suppress for statement.

enter image description here

Update

Using IntelliJ IDEA 13, I noticed an additional menu item: "Suppress for statement with comment". This will use the IntelliJ style //noinspection unchecked. If you select "Suppress for statement", IntelliJ will insert this text: @SuppressWarnings("unchecked").


Depending on the warning you can use @SuppressWarnings. Eg:

@SuppressWarnings("deprecation")yourLineWhichIsDeprecated;

Take a look at this answer for a pretty long list of warnings you can suppress. Check the other posts on that topic for more details.