...
Wiki Markup |
---|
*EXP03:* In general, for any two objects, it is permissible to compare their elements provided that the class is a singleton. The use of static factory methods over constructors facilitates instance control which in turn limits the effective number of instances of an immutable class to one. As a result, for two objects {{a}} and {{b}}, {{a.equals(b)}} is {{true}} when {{a == b}} \[[Bloch 2008|AA. Java References#BlochBibliography#Bloch 08]\]. The {{String}} class does not meet these requirements and consequently, does not possess these characteristics. |
...
Wiki Markup |
---|
\[[JLS 2005|AA. Java References#JLSBibliography#JLS 05]\] [Section 3.10.5, String Literals|http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.5] \[[FindBugs 2008|AA. Java References#FindBugsBibliography#FindBugs 08]\] ES: Comparison of String objects using == or \!= \[[MITRE 2009|AA. Java References#MITREBibliography#MITRE 09]\] [CWE ID 595|http://cwe.mitre.org/data/definitions/595.html] "Incorrect Syntactic Object Comparison", [CWE ID 597|http://cwe.mitre.org/data/definitions/597.html] "Use of Wrong Operator in String Comparison" |
...