rspec/rules/S923/java/rule.adoc

23 lines
578 B
Plaintext
Raw Normal View History

== Why is this an issue?
2020-06-30 12:50:59 +02:00
As stated per effective java :
2021-02-02 15:02:10 +01:00
2021-01-06 17:38:34 +01:00
____
2020-06-30 12:50:59 +02:00
Varargs methods are a convenient way to define methods that require a variable number of arguments, but they should not be overused. They can produce confusing results if used inappropriately.
2021-01-06 17:38:34 +01:00
____
2020-06-30 12:50:59 +02:00
=== Noncompliant code example
2020-06-30 12:50:59 +02:00
2022-02-04 17:28:24 +01:00
[source,java]
2020-06-30 12:50:59 +02:00
----
void fun ( String... strings ) // Noncompliant
{
// ...
}
----
2023-04-21 14:07:17 +02:00
== Resources
2023-04-21 14:07:17 +02:00
* https://wiki.sei.cmu.edu/confluence/display/java/DCL57-J.+Avoid+ambiguous+overloading+of+variable+arity+methods[CERT, DCL57J] - Avoid ambiguous overloading of variable arity methods