Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Wiki Markup
The _Java Language Specification_ \[java:[JLS 2005|AA. Bibliography#JLS 05]\]  [§8.9, "Enums"|http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.9] does not specify the use of {{ordinal()}} in programs. However, using the {{ordinal()}} method to derive the value associated with an enum constant is error-prone and should be avoided. 

Wiki Markup
According to the Java API \[java:[API 2006|AA. Bibliography#API 06]\], {{public final int ordinal()}}:

...

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

DCL04-J

low

probable

medium

P4

L3

Related Guidelines

The CERT C Secure Coding Standard

"INT09-C. Ensure enumeration constants map to unique values"

The CERT C++ Secure Coding Standard

"INT09-CPP. Ensure enumeration constants map to unique values"

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="a8e5421903aa1c84-fccbfeb1-443f472b-a6e2938d-8dd3b6dd8758e96c029884f7"><ac:plain-text-body><![CDATA[

[ISO/IEC TR 24772:2010

http://www.aitcnet.org/isai/]

"Enumerator Issues [java:CCB]"

]]></ac:plain-text-body></ac:structured-macro>

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="2fca617027b7b727-39b88143-44084641-b4f59482-a1bc3aecf1625e93cdd490ea"><ac:plain-text-body><![CDATA[

[java:[JLS 2005

AA. Bibliography#JLS 05]]

[§8.9, "Enums"

http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.9]

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="cac657720ccd073d-d354c0a3-4ffa4c11-842c968b-d5ca8765de629404e7d2960e"><ac:plain-text-body><![CDATA[

[java:[API 2006

AA. Bibliography#API 06]]

[Enum

http://download.oracle.com/javase/6/docs/api/java/lang/Enum.html]

]]></ac:plain-text-body></ac:structured-macro>

...