Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
The problem is 'Why the thing happen like this?'. I think the generic array creation is look quite right in my view.
When I compile with the below code (the worked version) the compile is warn me about 'unsafe and uncheck condition' but if I use the first code (the doesn't worked version) the compiler is block me from working. I don't know how to make the code both compile and don't be warn. [ May 12, 2007: Message edited by: Tanakorn Numrubporn ]
10.3 Array Creation An array is created by an array creation expression (�15.10) or an array initializer (�10.6). An array creation expression specifies the element type, the number of levels of nested arrays, and the length of the array for at least one of the levels of nesting. The array�s length is available as a final instance variable length. It is a compiletime error if the element type is not a reifiable type (�4.7) An array initializer creates an array and provides initial values for all its components.
4.7 Reifiable Types Because some type information is erased during compilation, not all types are available at run time. Types that are completely available at run time are known as reifiable types. A type is reifiable if and only if one of the following holds: � It refers to a non-generic type declaration. � It is a parameterized type in which all type arguments are unbounded wildcards (�4.5.1). � It is a raw type (�4.8). � It is a primitive type (�4.2). � It is an array type (�10.1) whose component type is reifiable.
This is the discussion after section 10.10.
If the element type of an array were not reifiable (�4.7), the virtual machine could not perform the store check described in the preceding paragraph. This is why creation of arrays of non-reifiable types is forbidden. One may declare variables of array types whose element type is not reifiable, but any attempt to assign them a value will give rise to an unchecked warning (�5.1.9).