Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The varargs feature was introduced in the Java Development Kit (JDK) v1.5.0 to support methods that accept a variable numbers of arguments.

...

because the non-varargs definition is more specific and, and consequently, a better fit for the arguments given. However, this complexity is best avoided.

...

Wiki Markup
*DCL08-EX1:* It may be desirable to violate this guideline for performance reasons. One such reason would be to avoid the cost of creationcreating of an array instance and its initializationinitializing it on every invocation of a method \[[Bloch 2008|AA. Bibliography#Bloch 08]\].

...

Automated detection is straightforward.

Related Vulnerabilities

Search for vulnerabilities resulting from the violation of this guideline on the CERT website.

Bibliography

Wiki Markup
\[[Bloch 2008|AA. Bibliography#Bloch 08]\] Item 42: "Use varargsVarargs judiciouslyJudiciously"
\[[Steinberg 2005|AA. Bibliography#Steinberg 05]\] "Using the Varargs Language Feature"
\[[Sun 2006|AA. Bibliography#Sun 06]\] [varargs|http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html] 

...