Reports occurrences where usages of "magic" constants are preferred but other expressions are used instead.

Example:

  // Bare literal "2" used, warning:
  Font font = new Font("Arial", 2)

instead of

  // Predefined constant used, good:
  Font font = new Font("Arial", Font.ITALIC)

When possible, a quick-fix is suggested to use the appropriate predefined constant.

The behavior of this inspection is controlled by org.intellij.lang.annotations.MagicConstant annotation. Some standard Java library methods are pre-annotated but you can use this annotation in your code as well.