
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
52 lines
963 B
Plaintext
52 lines
963 B
Plaintext
== Why is this an issue?
|
|
|
|
Generic types shouldn't be used raw (without type parameters) in variable declarations or return values. Doing so bypasses generic type checking, and defers the catch of unsafe code to runtime.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,java]
|
|
----
|
|
List myList; // Noncompliant
|
|
Set mySet; // Noncompliant
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,java]
|
|
----
|
|
List<String> myList;
|
|
Set<? extends Number> mySet;
|
|
----
|
|
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Provide the parametrised type for this generic.
|
|
|
|
|
|
=== Highlighting
|
|
|
|
type name
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 31 Oct 2018, 09:35:37 Nicolas Peru wrote:
|
|
\[~alexandre.gigleux] I would suggest title to be reworked to : Don't use raw types. The wording seems dodgy.
|
|
|
|
=== on 31 Oct 2018, 12:31:09 Ann Campbell wrote:
|
|
"Raw types should not be used"?
|
|
|
|
endif::env-github,rspecator-view[]
|