@@ -529,7 +529,7 @@ public static BiFunction createBiFunction(Method method) {
529
529
method .getName (),
530
530
MethodType .methodType (objectClass , param0 )
531
531
);
532
- methodType = MethodType .methodType (objectClass , declaringClass , param0 );
532
+ methodType = MethodType .methodType (objectClass , declaringClass , box ( param0 ) );
533
533
}
534
534
535
535
CallSite callSite = LambdaMetafactory .metafactory (
@@ -567,7 +567,7 @@ public static BiFunction createBiFunction(Constructor constructor) {
567
567
METHOD_TYPE_BI_FUNCTION ,
568
568
METHOD_TYPE_OBJECT_OBJECT_OBJECT ,
569
569
methodHandle ,
570
- MethodType .methodType (declaringClass , param0 , param1 )
570
+ MethodType .methodType (declaringClass , box ( param0 ), box ( param1 ) )
571
571
);
572
572
return (BiFunction ) callSite .getTarget ().invokeExact ();
573
573
} catch (Throwable ignored ) {
@@ -577,6 +577,34 @@ public static BiFunction createBiFunction(Constructor constructor) {
577
577
return new ConstructorBiFunction (constructor );
578
578
}
579
579
580
+ static Class <?> box (Class cls ) {
581
+ if (cls == int .class ) {
582
+ return Integer .class ;
583
+ }
584
+ if (cls == long .class ) {
585
+ return Long .class ;
586
+ }
587
+ if (cls == boolean .class ) {
588
+ return Boolean .class ;
589
+ }
590
+ if (cls == short .class ) {
591
+ return Short .class ;
592
+ }
593
+ if (cls == byte .class ) {
594
+ return Byte .class ;
595
+ }
596
+ if (cls == char .class ) {
597
+ return Character .class ;
598
+ }
599
+ if (cls == float .class ) {
600
+ return Float .class ;
601
+ }
602
+ if (cls == double .class ) {
603
+ return Double .class ;
604
+ }
605
+ return cls ;
606
+ }
607
+
580
608
static final class ConstructorSupplier
581
609
implements Supplier {
582
610
final Constructor constructor ;
0 commit comments