> On 21 Aug 2017, at 07:48, Claes Redestad <[email protected]> wrote:
>
> Hi,
>
> a trivial test[1] invoking the StringConcatFactory.makeConcatWithConstants
> fails
> when providing an Integer as a constant, which appears to be due to failure to
> coerce boxed types to the corresponding primitive types when looking up
> various
> methods in StringConcatHelper:
>
> Webrev: http://cr.openjdk.java.net/~redestad/8186500/jdk.00/
> Bug: https://bugs.openjdk.java.net/browse/JDK-8186500
>
> Simply using Wrapper.asPrimitiveType coerces boxed types to their primitive
> counterpart, and is a (semantical) no-op for other types, e.g., String.
>
Looks good. Perhaps a token test would be useful (maybe hard to test all code
paths here without some combinator test).
Paul.
> Thanks!
>
> /Claes
>
> [1]
>
> import java.lang.invoke.*;
>
> public class Test {
> public static void main(String ... args) throws Exception {
> StringConcatFactory.makeConcatWithConstants(MethodHandles.lookup(), "name",
> MethodType.methodType(String.class, String.class, String.class),
> "\1\2\1", (Integer)1);
> }
> }
>