21 lines
367 B
Plaintext
21 lines
367 B
Plaintext
Using a type parameter when you don't have to simply obfuscates the code. Qualifying an inner type with a type parameter will compile, but confuse maintainers.
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
<T extends Map> T doTheThing(T.Entry type) { // Noncompliant
|
|
//...
|
|
}
|
|
----
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
<T extends Map> T doTheThing(Map.Entry type) {
|
|
//...
|
|
}
|
|
----
|
|
|