On Tue, 16 Jul 2024 19:59:41 GMT, Chen Liang <li...@openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/invoke/LambdaForm.java line 1388:
>> 
>>> 1386:         Name withIndex(int i) {
>>> 1387:             if (i == this.index) return this;
>>> 1388:             return new Name(i, type, function, arguments, constraint);
>> 
>> Don't we still need to clone the arguments here?
>
> The argument array is `@Stable`, meaning it is already an immutable list. 
> Individual arguments are already immutable. Therefore the original cloning 
> was redundant as there were no content changes to the arguments array.

`@Stable` is not quite the same as immutable, but I'm assuming that no code is 
initializing the array _after_ creating a `Name` with it.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20178#discussion_r1680015033

Reply via email to