Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added "for defensive programming"

...

The Java Language Specification, §8.9, "Enums" [JLS 2011], does not specify the use of ordinal() in programs. However, attaching external significance to the ordinal() value of an enum constant is error prone and should be avoided for defensive programming.

Noncompliant Code Example

...