RFR: 8322477: order of subclasses in the permits clause can differ between compilations [v4]
Vicente Romero
vromero at openjdk.org
Wed Jan 10 17:55:31 UTC 2024
On Wed, 10 Jan 2024 17:32:17 GMT, Chen Liang <liach at openjdk.org> wrote:
>> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision:
>>
>> addressing review comments
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java line 1360:
>
>> 1358: permitted.clear();
>> 1359: for (Symbol csym : permittedSubs) {
>> 1360: permitted.add(new PermittedClassWithPos(csym, 0));
>
> If we have multiple `0` positions in the list, a future `addPermittedSubclass` call may not produce a deterministic list if it's called with pos `0`, as that's how `Arrays.binarySearch` behaves.
right but as Jan mentioned we will be calling either `addPermittedSubclass` or `setPermittedSubclasses` not both. We need to set a default position value if none is provided, `0` is a good option or `-1`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17284#discussion_r1447730402
More information about the compiler-dev
mailing list