RFR: 8335922: Incorrect @Stable usage of LambdaForm$Name.index [v5]

Chen Liang liach at openjdk.org
Tue Jul 16 20:01:52 UTC 2024


On Tue, 16 Jul 2024 19:39:16 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> Chen Liang has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update src/java.base/share/classes/java/lang/invoke/LambdaForm.java
>>   
>>   Co-authored-by: ExE Boss <3889017+ExE-Boss at users.noreply.github.com>
>
> 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.

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

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


More information about the core-libs-dev mailing list