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

Aleksey Shipilev shade at openjdk.org
Mon Jul 15 16:12:52 UTC 2024


On Mon, 15 Jul 2024 15:47:50 GMT, Chen Liang <liach at openjdk.org> wrote:

>> 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.

All right.

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

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


More information about the core-libs-dev mailing list