java - 忽略记录器语句上的硬编码字符串-IntelliJ

标签 java intellij-idea code-inspection

在 IntelliJ 上,我通常启用检查以查找 Java 项目中的硬编码字符串。但是,由于记录器语句中存在硬编码字符串,它可能会产生大量误报。

IntelliJ 中是否有任何方法可以忽略此检查中的记录器语句?

最佳答案

您可以使用@NonNls 注释来注释记录器方法的String 参数。然后,硬编码字符串 检查将忽略记录器调用中存在的字符串。要注释,请将文本光标放在警告上,然后按 Alt+Enter 并选择 Annotate parameter 'xxx' as @NonNls

关于java - 忽略记录器语句上的硬编码字符串-IntelliJ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34188030/

相关文章:

java - GridView 中使用 Glide 加载图像太慢

node.js - intellij idea 中的多个 ECMA-Script 版本

Python 输入 : Retrieve required keys from TypedDict definition

java - WildFly 14 - java.lang.ClassCastException : org. dom4j.DocumentFactory 无法转换为 org.dom4j.DocumentFactory

java - 如何设计基于微服务的应用程序,每个微服务都有自己的数据源?

java - 累积所有 float

intellij-idea - Intellij IDEA : Breakpoint not being hit, 并且显示为灰色

android - 带有 Android Studio 的 SonarQube 插件

android-studio - 安卓工作室 : Change inspection profile for one specific module in project

python - 确定函数是否包含特定方法