Disable warning in IntelliJ for one line

后端 未结 7 1122
庸人自扰
庸人自扰 2020-12-15 02:03

I have a Java code line where IntelliJ displays a warning. How do I silence the warning in that particular line, without affecting warnings displayed in other lines?

7条回答
  •  旧巷少年郎
    2020-12-15 02:41

    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.

提交回复
热议问题