rspec/rules/S3681/java/rule.adoc
2022-02-04 16:28:24 +00:00

40 lines
624 B
Plaintext

Using a type parameter when you don't have to simply obfuscates the code. Inserting an unnecessary type parameter in an unparameterized method call will compile, but confuse maintainers.
== Noncompliant Code Example
[source,java]
----
void doTheThing() {
// ...
}
//...
this.<String>doTheThing(); // Noncompliant
----
== Compliant Solution
[source,java]
----
void doTheThing() {
// ...
}
//...
this.doTheThing();
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
include::highlighting.adoc[]
endif::env-github,rspecator-view[]