Code review request for 4881419 The type of X[].clone() should be X[]

Ulf Zibis Ulf.Zibis at gmx.de
Sat Sep 4 00:23:53 UTC 2010


  I think I still don't understand. :-(

The compile-time behaviour is well documented in JLSv3 6.4.5.

But where is the run-time behaviour documented?
Isn't the javadoc of class Object a good place?

With the term 'spec' you mean the JLS or the javadoc of class Object?

-Ulf


Am 04.09.2010 01:34, schrieb Martin Buchholz:
>
>
> On Fri, Sep 3, 2010 at 16:13, Ulf Zibis <Ulf.Zibis at gmx.de <mailto:Ulf.Zibis at gmx.de>> wrote:
>
>       ,
>
>     the whole enclosing paragraph talks about class, object and instance, so why talk about type
>     for the array case?
>
>
> Because the array types don't have their own javadoc, there is no other obvious place to document 
> the compile-time behavior of this method for the class for e.g. int[].
>
>
> To be more precise, (but still hand-waving...), it is *as if* every array type X has an override 
> for clone that looked like this:
>
> class X {
>
> @Override X clone() { return (X) super.clone(); }
>
> }
>
> There is some value putting in the pseudocode above into the spec, but it is hard to do because 
> it's not actually legal java code, and there is no 1-1 correspondence from array types to classes.
>
> Java does not have "self" types.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20100904/35ef0f97/attachment.html>


More information about the core-libs-dev mailing list