On Wed, 2 Nov 2022 17:21:11 GMT, Jorn Vernee <jver...@openjdk.org> wrote:
>> Jim Laskey has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Add @SafeVarargs declarations > > src/java.base/share/classes/java/lang/runtime/TemplateSupport.java line 184: > >> 182: MethodHandle mh = >> MethodHandles.insertArguments(DEFAULT_PROCESS_MH, 0, fragments, processor); >> 183: mh = mh.withVarargs(true); >> 184: mh = mh.asType(type); > > I suggest doing: > Suggestion: > > mh = mh.asCollector(Object[].class, type.parameterCount()); > mh = mh.asType(type); > > Instead, as it is more straightforward in terms of the code that gets called. > (the impl of `withVarargs` + `asType` does the same thing in a more > roundabout way). As a side note: I think we can add an overload to `asCollector` that takes a `MethodType`, and does the 2 lines above in one. (the array type would be the return type of the method type). ------------- PR: https://git.openjdk.org/jdk/pull/10889