RFR: 8310405: Linker.Option.firstVariadicArg should specify which index values are valid

Maurizio Cimadamore mcimadamore at openjdk.org
Wed Jun 21 00:06:05 UTC 2023


On Tue, 20 Jun 2023 23:57:05 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/foreign/Linker.java line 652:
>> 
>>> 650:          * The {@code index} value must be greater than zero, and less than or equal to the number of argument layouts
>>> 651:          * of the function descriptor that is used in the same linkage request as this option. When the {@code index} is
>>> 652:          * equal to the number of argument layouts in the descriptor, it indicates a variadic function to which zero
>> 
>> This sentence is not clear. If index == num layouts then it means *all* arguments are variadic?
>
> index == 0 would mean all arguments are variadic. index == num layouts means none. (just like `"abcd".substring(4)` returns an empty string).

Yes, that's what I meant and got confused. But I missed the all-important `zero` in the javadoc - so I think that this bit of text is ok as it is. Apologize for the confusion.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14565#discussion_r1236019482


More information about the core-libs-dev mailing list