Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: grammar fixes

Wiki Markup
The Java compiler type-checks the arguments to aeach varargs method to ensure that theythe arguments are of the same type or object reference. However, the compile-time checking is ineffective when two methodspecific parameter signaturestypes are used: in particular—{{Object}} and the generic type {{T}} \[[Bloch 2008|AA. Bibliography#Bloch 08]\]. Another requirement for providing strong compile-time type checking of variable argument methods is to be as specific as possible when declaring the type of the method parameter.

...

Wiki Markup
Retrofitting old methods containing final array parameters with generically-typed varargs is not always a good idea. ThisFor is becauseexample, ifgiven somea method didthat does not accept an argument of a particular type, it could be possible to override the compile-time checking so that, with--- through the use of generic varargs, it now compiles cleanly  parameters --- so that the method would compile cleanly rather than correctly causing a compile-time error.\[[Bloch 2008|AA. Bibliography#Bloch 08]\]. 

...

DCL09-EX1: Varargs signatures using Object and imprecise generic types are only acceptable when the body of the method both uses no casts or auto-boxing, and also compiles without error. Consider the following example, which operates correctly for all object types and type-checks successfully.

...