RFR: 8335922: Incorrect @Stable usage of LambdaForm$Name.index [v2]
Chen Liang
liach at openjdk.org
Mon Jul 15 15:50:51 UTC 2024
On Mon, 15 Jul 2024 14:29:29 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> Chen Liang has updated the pull request incrementally with one additional commit since the last revision:
>>
>> We have sufficient space in short, use +1 offset
>
> src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java line 778:
>
>> 776: var newParameters = new TreeMap<Name, Integer>(new Comparator<>() {
>> 777: public int compare(Name n1, Name n2) {
>> 778: return n1.index() - n2.index();
>
> We don't have to call the method here and do the translation to "proper" index here, or do we?
Using `n1.offsetIndex - n2.offsetIndex` feels weird in an encapsulation POV. I will mark `offsetIndex` private to better indicate this being an implementation detail not to be relied on.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20178#discussion_r1678050485
More information about the core-libs-dev
mailing list