Ignore string strings in log statements - IntelliJ

In IntelliJ, I usually allow inspection to find hard-coded strings in Java projects. However, it can generate many false positives due to the hard-coded strings present in the log statements.

Is there any way in IntelliJ to ignore registrar statements from this check?

+4
source share
1 answer

You can annotate the String parameter of the logger method with the @NonNls annotation. Hard-coded string verification then ignores the lines present in the log calls. To add a comment, place the text cursor on the warning and press Alt+ Enterand select the Annotate option "xxx" as @NonNls.

+1
source

Source: https://habr.com/ru/post/1619252/


All Articles