Versions Compared

Key

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

...

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

MET10-J

medium

unlikely

medium

P4

L3

Automated Detection

Some static analysis tools can detect cases where the compareTo() method reads from a nonconstant field. If the nonconstant field were modified, the value of compareTo() might change, which would break program invariants.Automated detections of violations of this rule is infeasible in the general case.

Related Guidelines

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="a09c77aae8f8ee6c-832ccdfb-47c34c1c-8348b313-233fd861486988d5c43b575e"><ac:plain-text-body><![CDATA[

[[API 2006

AA. Bibliography#API 06]]

[Method compareTo()

http://java.sun.com/javase/6/docs/api/java/lang/Comparable.html#compareTo(java.lang.Object)]

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="6617b0493b56bfb8-94ad2194-4e7e42fc-a2928df8-688c9eca125b922f46533ef8"><ac:plain-text-body><![CDATA[

[[JLS 2005

AA. Bibliography#JLS 05]]

 

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

...