Collection.toArray(IntFunction)

Martin Buchholz martinrb at google.com
Thu May 30 09:16:15 PDT 2013


Cleaning up all of those unclear "runtime type" specs in the libraries and
jls can be a bit of work.
Probably could link to
http://docs.oracle.com/javase/specs/jls/se7/html/jls-10.html#jls-10.5 and
use the terminology from there

"""
If the type of the value being assigned is not assignment-compatible (§5.2)
with the component type, an ArrayStoreException is thrown.
"""

but there will always be confusion about "compile-time type" and "runtime
type".

"""Variables have type; objects have class"""

On Thu, May 30, 2013 at 1:34 AM, Paul Sandoz <paul.sandoz at oracle.com> wrote:

>
>
> > I also noticed an error in the javadoc of the other
> > Collection.toArray(T[]) method (line 240). Instead of the following:
> >
> >      * @throws ArrayStoreException if the *runtime*type of the
> > specified array
> >      *         is not a supertype of the runtime type of every element in
> >      *         this collection
> >
> > I think it should be:
> >
> >      * @throws ArrayStoreException if the *component*type of the
> > specified array
> >      *         is not a supertype of the runtime type of every element in
> >      *         this collection
> >
> >
>
> Bug logged.
>
> Thanks,
> Paul.
>
>


More information about the lambda-dev mailing list