Versions Compared

Key

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

...

Wiki Markup
According to the _Java Language Specification_, [§4.8, "Raw Types,"|http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.8] \[[JLS 2005|AA. Bibliography#JLSReferences#JLS 05]\]:

The use of raw types is allowed only as a concession to compatibility of legacy code. The use of raw types in code written after the introduction of genericity into the Java programming language is strongly discouraged. It is possible that future versions of the Java programming language will disallow the use of raw types.

...

Wiki Markup
It is insufficient to rely on unchecked warnings alone to detect violations of this rule. According to the _Java Language Specification_, [§4.12.2.1, "Heap Pollution," |http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#111088] \[[JLS 2005|AA. Bibliography#JLSReferences#JLS 05]\]:

Wiki Markup
Note that this does not imply that heap pollution only occurs if an unchecked warning actually occurred. It is possible to run a program where some of the binaries were compiled by a compiler for an older version of the Java programming language, or by a compiler that allows the unchecked warnings to suppressed _\[sic\]_. This practice is unhealthy at best.

...

Wiki Markup
*OBJ03-EX0:* Raw types must be used in class literals. For example, because {{List<Integer>.class}} is invalid, it is permissible to use the raw type {{List.class}} \[[Bloch 2008|AA. Bibliography#BlochReferences#Bloch 08]\].

Wiki Markup
*OBJ03-EX1:* 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#BlochReferences#Bloch 08]\].

Code Block
if(o instanceof Set) { // Raw type
  Set<?> m = (Set<?>) o; // Wildcard type
  // ...
}

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="cd4cb6489165509f-846ce06a-4e884a50-949aa018-c47ef377b413f6d55b194047"><ac:plain-text-body><![CDATA[

[[Bloch 2008

AA. Bibliography#Bloch References#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="53a510851708f38a-6a4fb37d-4e504cb5-9f19889b-19b8e3b118b66d7756ecd882"><ac:plain-text-body><![CDATA[

[[Bloch 2007

AA. Bibliography#Bloch References#Bloch 07]] ]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="548c7f2c47a971a2-8407749c-40a4417a-b857827a-31c5de2eb9e70aa8551e28cf"><ac:plain-text-body><![CDATA[

[[Bloch 2005

AA. Bibliography#Bloch References#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="65fd7f18d2d5692f-f59bbb4a-4b0543ac-be4ca489-76d32235f074f51ace64262e"><ac:plain-text-body><![CDATA[

[[Darwin 2004

AA. Bibliography#Darwin References#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="f945a1af808a31ca-8dfc82f7-41f34474-8bf6b6b1-e48247f897f7b3d8afe815d2"><ac:plain-text-body><![CDATA[

[[JavaGenerics 2004

AA. Bibliography#JavaGenerics References#JavaGenerics 04]]

 

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="99d8c7c32a9a7b01-327b1c92-444b463b-bd20a4d6-b2d295e90019f494c93d43dd"><ac:plain-text-body><![CDATA[

[[JLS 2005

AA. Bibliography#JLS References#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>

 

§4.8, Raw Types

 

§5.1.9, Unchecked Conversion

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="d69dfde61116b327-8997d1ea-4fec4928-9a21ae02-2e8decb8219726cb512d7a15"><ac:plain-text-body><![CDATA[

[[Langer 2008

AA. Bibliography#Langer References#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="9097002e280ea95d-deedc27c-44e5403e-bb7c8e92-1f46e6f366993098aaf4b84f"><ac:plain-text-body><![CDATA[

[[Naftalin 2006

AA. Bibliography#Naftalin References#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="35203c8e63570001-72d254fe-41254463-b9ceb359-a3e7d4699a0b00caac27bbf0"><ac:plain-text-body><![CDATA[

[[Naftalin 2006b

AA. Bibliography#Naftalin References#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="635d00d9f8659d74-6eb841f0-4ee04897-845393f4-bc2450b7aaa984d762f54edd"><ac:plain-text-body><![CDATA[

[[Schildt 2007

AA. Bibliography#Schildt References#Schildt 07]]

Create a checked collection

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

...