26 lines
384 B
Plaintext
26 lines
384 B
Plaintext
The use of unnecessary types makes the eye stumble, and inhibits the smooth reading of code.
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
public void doSomething() {
|
|
|
|
<String>foo("blah"); // Noncompliant; <String> is inferred
|
|
}
|
|
public void <T> foo(T t) {
|
|
// ...
|
|
}
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
public void doSomething() {
|
|
|
|
foo("blah");
|
|
}
|
|
public void <T> foo(T t) {
|
|
// ...
|
|
}
|
|
----
|