Class HexLiteralCaseCheck

All Implemented Interfaces:
Configurable, Contextualizable

public class HexLiteralCaseCheck extends AbstractCheck
Checks that hexadecimal literals are defined using uppercase letters (A-F) rather than lowercase (a-f). This improves readability and avoids confusion with suffixes like f(float) and d(double). For example, use 0xFF instead of 0xff. All other numerical prefixes, infixes, and suffixes (such as 0x, 0b, f, d) should remain lowercase. This convention follows the OpenJDK Style Guide.

For example, 0xAF is valid, but 0xaf is not.

Parent is com.puppycrawl.tools.checkstyle.TreeWalker

Violation Message Keys:

  • hex.Literal
Since:
11.1.0
  • Field Details

    • MSG_KEY

      public static final String MSG_KEY
      A key is pointing to the warning message text in "messages.properties" file.
      See Also:
    • hexChars

      private final Set<Character> hexChars
      Lowercase hexadecimal characters that are considered violations when used in hexadecimal literals (e.g., 0x1a). Hex digits should be uppercase.
  • Constructor Details

  • Method Details