RFR: 8296935: Arrays.asList().set() with wrong types throws undocumented ArrayStoreException [v4]

David Holmes dholmes at openjdk.org
Mon Jan 23 07:24:27 UTC 2023


On Mon, 23 Jan 2023 07:08:28 GMT, Tingjun Yuan <duke at openjdk.org> wrote:

>> Document `java.util.Arrays.asList` that the list will throw an `ArrayStoreException` when attempting to set an element with a wrong type.
>
> Tingjun Yuan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix whitespace error

src/java.base/share/classes/java/util/Arrays.java line 4184:

> 4182:          *
> 4183:          * @throws ArrayStoreException if {@code element} cannot be stored into the array.
> 4184:          */

No javadoc is ever produced for this internal  implementation class, so doc comments here are not needed IMO.

src/java.base/share/classes/java/util/List.java line 591:

> 589:      * @throws ArrayStoreException if this list is backed by an array and
> 590:      *         the class of the specified element prevents it from being 
> 591:      *         stored to the array

This change to the List specification is not warranted or wanted.

-------------

PR: https://git.openjdk.org/jdk/pull/12135


More information about the core-libs-dev mailing list