[foreign-memaccess+abi] RFR: Micro optimizations and tidy

Per Minborg duke at openjdk.org
Fri Aug 19 08:32:57 UTC 2022


On Thu, 18 Aug 2022 15:27:55 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:

>> This small PR adds some optimizations and tidies up some imports.
>
> src/java.base/share/classes/java/lang/foreign/FunctionDescriptor.java line 108:
> 
>> 106:     public FunctionDescriptor asVariadic(MemoryLayout... variadicLayouts) {
>> 107:         assertVarargsNonNull(variadicLayouts);
>> 108:         return variadicLayouts.length == 0 ? this : new VariadicFunction(this, variadicLayouts);
> 
> We could change the VariadicFunction constructor to accept a List of non-null elements.

It already throws an NPE if any of the args or variadicLayouts elements are `null`. So, the check is redundant also here.

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

PR: https://git.openjdk.org/panama-foreign/pull/708


More information about the panama-dev mailing list