示例 1:
// 使用了裸文字“2”,警告: Font font = new Font("Arial", 2)
示例 2:
// 使用了预定义常量,良好: Font font = new Font("Arial", Font.ITALIC)
如果可能,快速修复将插入相应的预定义常量。
该检查的行为由 org.intellij.lang.annotations.MagicConstant
注解进行控制。
有些标准的 Java 库方法进行了预先批注,但您也可以在代码中使用该注解。