Wiki Markup |
---|
The Java compiler type checks the arguments to each varargs method to ensure that the arguments are of the same type or object reference. However, the compile-time checking is ineffective when {{Object}} or generic {{T}} parameter types are used \[java:[Bloch 2008|AA. Bibliography#BlochReferences#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. For example, given a method that does not accept an argument of a particular type, it could be possible to override the compile-time checking --- through the use of generic varargs parameters --- so that the method would compile cleanly rather than correctly, causing a compile-time error \[java:[Bloch 2008|AA. Bibliography#BlochReferences#Bloch 08]\]. |
Also, note that autoboxing does not allow strong compile-time type checking of primitive types and their corresponding wrapper classes.
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="adc4abc78b4ff59f-606d0e52-433f4dac-a0f1ac6d-24d3ab8335ea9c98290a1c21"><ac:plain-text-body><![CDATA[ | [java:[Bloch 2008 | AA. Bibliography#Bloch References#Bloch 08]] | Item 42: "Use Varargs Judiciously" | ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="39f2a7d21e64ccd8-bb6b308c-49e24da4-aec199cc-8011d2caa42002579d19581f"><ac:plain-text-body><![CDATA[ | [java:[Steinberg 2005 | AA. Bibliography#Steinberg References#Steinberg 05]] | "Using the Varargs Language Feature" | ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="8868371524090073-19a00205-41e94390-8dfcbb0a-603e38e9ece36de296d2c7c0"><ac:plain-text-body><![CDATA[ | [java:[Sun 2006 | AA. Bibliography#Sun References#Sun 06]] | [varargs | http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html] | ]]></ac:plain-text-body></ac:structured-macro> |
...