41 lines
577 B
Plaintext
41 lines
577 B
Plaintext
The use of unnecessary types makes the eye stumble, and inhibits the smooth reading of code.
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
[source,java]
|
|
----
|
|
public void doSomething() {
|
|
|
|
<String>foo("blah"); // Noncompliant; <String> is inferred
|
|
}
|
|
public void <T> foo(T t) {
|
|
// ...
|
|
}
|
|
----
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
[source,java]
|
|
----
|
|
public void doSomething() {
|
|
|
|
foo("blah");
|
|
}
|
|
public void <T> foo(T t) {
|
|
// ...
|
|
}
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::message.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|