RFR: 8306698: Add overloads to MethodTypeDesc::of
Chen Liang
liach at openjdk.org
Sun Apr 23 23:10:43 UTC 2023
On Sun, 23 Apr 2023 21:09:32 GMT, ExE Boss <duke at openjdk.org> wrote:
>> Alternatively, we can switch to SequencedCollection when it's integrated.
>
> [`MethodType.methodType(…)`] also doesn’t allow plain `Collection`s for the same reason, even though `List.copyOf` supports creation from a `Collection`.
>
> [`MethodType.methodType(…)`]: https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/lang/invoke/MethodType.html#methodType(java.lang.Class,java.util.List)
After thinking, users who want to pass in a `Collection` can just do `MethodTypeDesc.of(returnDesc, List.copyOf(paramDescCollection))` so using a `List` is good.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13599#discussion_r1174667653
More information about the core-libs-dev
mailing list