rspec/rules/S3681/java/rule.adoc

48 lines
669 B
Plaintext
Raw Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
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
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,java]
2021-04-28 16:49:39 +02:00
----
void doTheThing() {
// ...
}
//...
this.<String>doTheThing(); // Noncompliant
----
=== Compliant solution
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,java]
2021-04-28 16:49:39 +02:00
----
void doTheThing() {
// ...
}
//...
this.doTheThing();
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Remove "xxx".
=== Highlighting
Unnecessary type param
endif::env-github,rspecator-view[]