Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 IntelliJ 上,我通常启用检查以查找 Java 项目中的硬编码字符串。但是,由于 logger 语句中存在硬编码字符串,它可能会产生大量误报。
IntelliJ 中是否有任何方法可以忽略此检查中的记录器语句?
您可以使用 @NonNls 注释来注释 logger 方法的 String 参数。然后,硬编码字符串检查将忽略记录器调用中存在的字符串。要进行注释,请将文本光标放在警告上,然后按Alt+Enter并选择将参数“xxx”注释为 @NonNls。