On Wed, 3 Jun 2026 12:26:58 GMT, Per Minborg <[email protected]> wrote:

>> This PR proposes to add a new `default` method `List::removeAt`.
>> 
>> There are two overloads of the method `List::remove`, and if the list is of 
>> type `List<Integer>`, the overload resolution could pick a surprising 
>> variant.
>> 
>> Hence, it is better to add a separate method that removes an element based 
>> on its index.
>> 
>> It is proposed that the `E remove(int index)` method is _not_ `@Deprecated`. 
>> Instead, we add verbiage to promote the new method over the old one.
>> 
>> ---------
>> - [X] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Per Minborg has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains eight additional 
> commits since the last revision:
> 
>  - Fix typo
>  - Merge branch 'master' into rfe-list-remove-at-index
>  - Rename removeAtIndex to removeAt
>  - Merge branch 'master' into rfe-list-remove-at-index
>  - Merge branch 'master' into rfe-list-remove-at-index
>  - Merge branch 'master' into rfe-list-remove-at-index
>  - Add @apiNote
>  - Add List::removeAtIndex

test/jdk/java/util/List/ListDefaults.java line 319:

> 317:         } catch (UnsupportedOperationException _) {}
> 318:     }
> 319: 

Not sure this test is necessary. I'm pretty certain that `remove(int)` and 
`remove(Object)` are tested already by MOAT. I don't think we need tests for 
overload selection, as that's handled by the compiler. It's probably sufficient 
to add a simple case to MOAT that calls removeAt on some list with known 
contents and checks for the right result.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31064#discussion_r3692709984

Reply via email to