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

Martin Buchholz martinrb at
Fri Sep 3 23:34:23 UTC 2010

On Fri, Sep 3, 2010 at 16:13, Ulf Zibis <Ulf.Zibis at> 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: <>

More information about the core-libs-dev mailing list