Code review request for 4881419 The type of X[].clone() should be X[]
Martin Buchholz
martinrb at google.com
Fri Sep 3 22:53:28 UTC 2010
Ulf,
The spec needs to talk about *both* class (runtime) and type (compile-time).
And now it does.
Martin
On Fri, Sep 3, 2010 at 15:31, Ulf Zibis <Ulf.Zibis at gmx.de> wrote:
> Am 04.09.2010 00:05, schrieb Joe Darcy:
>
> Ulf Zibis wrote:
>>
>>> Am 03.09.2010 12:31, schrieb Ulf Zibis:
>>>
>>>>
>>>> I think the question of variable types belongs to the spec, but here in
>>>> Object class's javadoc we should speak about objects. So I now suggest:
>>>> "...and that the returned object of the {@code clone} method of an array
>>>> object of class {@code T[]} is of class {@code T[]} where T is any [raw]?
>>>> reference or primitive class. See java language specification version 3,
>>>> section 6.4.5"
>>>>
>>>>
>>> And additionally 2 cents: As T is often used for parameter type in
>>> context with generics, I think, X would leed to less misinterpretation and
>>> would match better to the according spec.
>>>
>>>
>> I think the text as suggested by Martin with the explicit definition of T
>> is sufficiently clear as-is.
>>
>> -Joe
>>
>
> I still think, it would be more clear to speak about classes here rather
> then about types.
> See:
> Number[] na = new Integer[123];
> na[0] = new Integer(456);
> Integer[] ia = (Integer[])na.clone();
>
> na is of type Number[]
> ia is of type Integer[] and too of type Number[]
> but ia contains object of class Integer[]
>
> -Ulf
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20100903/cdab24dc/attachment.html>
More information about the core-libs-dev
mailing list