| 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="2cb50ea87f811faf-4ce920f4-4b3a4f85-86afbbdb-8ab3cf633979c85d1231c0ad"><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="74b0a8c32c4d9ffd-c23f4d05-40d34446-914eac3a-be2d34cd393a452262579d03"><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="b536c153ebc34555-f57e7acc-45eb45ae-8a1e845f-206b26e1b1423eee3e04a35c"><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> |
...