...
If the method addToList()
is externally defined (such as in a library or as an upcall method) and cannot be changed, the same compliant method printOne()
can be used, but no warnings result if addToList(1)
is used instead of addToList(1.0)
. Great care must be taken to ensure type safety when generics are mixed with non-generic code.
Exceptions
Wiki Markup |
---|
*OBJ10OBJ14-EX1* Raw types must be used in class literals. For example, because {{List<Integer>.class}} is illegal, it is permissible to use the raw type {{List.class}} \[[Bloch 2008|AA. Bibliography#Bloch 08]\]. |
Wiki Markup |
---|
*OBJ10OBJ14-EX2* The {{instanceof}} operator cannot be used with generic types. It is permissible to mix generic and raw code in such cases \[[Bloch 2008|AA. Bibliography#Bloch 08]\]. |
...
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
OBJ10 OBJ14-J | low | probable | medium | P4 | L3 |
Bibliography
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="77be3e86fa88dafe-ecfd3efe-43f6428f-bd6bbd41-62f0713ceb8cf373852718a7"><ac:plain-text-body><![CDATA[ | [[Bloch 2008 | AA. Bibliography#Bloch 08]] | Item 23: "Don't use raw types in new code" | ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="747dd16f9fe34b7c-82056e2f-489a48da-8db3b2d9-7bcfb54a81d1e8b2ac8ab2c1"><ac:plain-text-body><![CDATA[ | [[Bloch 2007 | AA. Bibliography#Bloch 07]] | Generics, 1. "Avoid Raw Types in New Code" | ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="0ac97b8db813a6e8-229844f8-49e448a0-8344a8d1-4f126269f87563c597851530"><ac:plain-text-body><![CDATA[ | [[Bloch 2005 | AA. Bibliography#Bloch 05]] | Puzzle 88: Raw Deal | ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="a65e0c87c7996d69-83ed5d08-4aa14d0b-b058afcf-f5f0ee87b5e5fb9c10290ce1"><ac:plain-text-body><![CDATA[ | [[Darwin 2004 | AA. Bibliography#Darwin 04]] | 8.3 Avoid Casting by Using Generics | ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="569b4540ab28e636-4419c765-4d3c4a2c-b3bfaf37-62584ee9a1a4e87a946f6da5"><ac:plain-text-body><![CDATA[ | [[JavaGenerics 2004 | AA. Bibliography#JavaGenerics 04]] |
| ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="65d398fdfbc80e8b-304ad254-43204332-9483b969-680b9f07cf42b8ba5fd18f85"><ac:plain-text-body><![CDATA[ | [[JLS 2005 | AA. Bibliography#JLS 05]] | [Chapter 5 "Conversions and Promotions" | http://java.sun.com/docs/books/jls/third_edition/html/conversions.html] | ]]></ac:plain-text-body></ac:structured-macro> |
| |||||
| |||||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="838058ad5b077db4-33e2b3de-425d41e6-80b09b4b-dd8f804bfa05fa5837692996"><ac:plain-text-body><![CDATA[ | [[Langer 2008 | AA. Bibliography#Langer 08]] | Topic 3, "[Coping with Legacy | http://www.angelikalanger.com/GenericsFAQ/FAQSections/ProgrammingIdioms.html#Topic3]" | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="7962964b9a802bfc-135f9d57-4c304405-b949a727-6b4e0c83f3b9d095f3aea3c4"><ac:plain-text-body><![CDATA[ | [[Naftalin 2006 | AA. Bibliography#Naftalin 06]] | Chapter 8, "Effective Generics" | ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="b80b644ed151b267-9281f29d-477f4d1e-a3a1a281-8645b8d17aceb2311a962ef9"><ac:plain-text-body><![CDATA[ | [[Naftalin 2006b | AA. Bibliography#Naftalin 06b]] | "Principle of Indecent Exposure" | ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="013972a7625335fb-317cf24a-4fb144a4-a7a9a175-eb409bc7e2b0ff08e4d5dcb7"><ac:plain-text-body><![CDATA[ | [[Schildt 2007 | AA. Bibliography#Schildt 07]] | "Create a checked collection" | ]]></ac:plain-text-body></ac:structured-macro> |
...