File: ConstantField.md

package info (click to toggle)
error-prone-java 2.18.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 23,204 kB
  • sloc: java: 222,992; xml: 1,319; sh: 25; makefile: 7
file content (12 lines) | stat: -rw-r--r-- 520 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
The [Google Java Style Guide ยง5.2.4][style] requires constant names to use
`CONSTANT_CASE`.

[style]: https://google.github.io/styleguide/javaguide.html#s5.2.4-constant-names

When naming a field with `CONSTANT_CASE`, make sure the field is `static`,
`final`, and of immutable type. If the field doesn't meet those criteria, use
`lowerCamelCase` instead.

The check recognizes all primitive, `String`, and `enum` fields as deeply
immutable. It is possible to create mutable enums, but doing so is
strongly discouraged.