src/jdk/internal/dynalink/beans/BeanLinker.java

changeset 963
e2497b11a021
parent 962
ac62e33a99b0
child 1205
4112748288bb
child 1239
e1146c9cc758
     1.1 --- a/src/jdk/internal/dynalink/beans/BeanLinker.java	Wed Aug 20 10:25:28 2014 +0200
     1.2 +++ b/src/jdk/internal/dynalink/beans/BeanLinker.java	Wed Aug 20 10:26:01 2014 +0200
     1.3 @@ -237,8 +237,9 @@
     1.4          } else {
     1.5              checkGuard = convertArgToInt(RANGE_CHECK_ARRAY, linkerServices, callSiteDescriptor);
     1.6          }
     1.7 -        return nextComponent.compose(MethodHandles.guardWithTest(binder.bindTest(checkGuard),
     1.8 -                binder.bind(invocation), nextComponent.getGuardedInvocation().getInvocation()), gi.getGuard(),
     1.9 +        final MethodPair matchedInvocations = matchReturnTypes(binder.bind(invocation),
    1.10 +                nextComponent.getGuardedInvocation().getInvocation());
    1.11 +        return nextComponent.compose(matchedInvocations.guardWithTest(binder.bindTest(checkGuard)), gi.getGuard(),
    1.12                  gic.getValidatorClass(), gic.getValidationType());
    1.13      }
    1.14  
    1.15 @@ -308,7 +309,7 @@
    1.16          }
    1.17  
    1.18          /*private*/ MethodHandle bind(final MethodHandle handle) {
    1.19 -            return bindToFixedKey(linkerServices.asType(handle, methodType));
    1.20 +            return bindToFixedKey(linkerServices.asTypeLosslessReturn(handle, methodType));
    1.21          }
    1.22  
    1.23          /*private*/ MethodHandle bindTest(final MethodHandle handle) {
    1.24 @@ -440,8 +441,9 @@
    1.25  
    1.26          final MethodHandle checkGuard = convertArgToInt(invocation == SET_LIST_ELEMENT ? RANGE_CHECK_LIST :
    1.27              RANGE_CHECK_ARRAY, linkerServices, callSiteDescriptor);
    1.28 -        return nextComponent.compose(MethodHandles.guardWithTest(binder.bindTest(checkGuard),
    1.29 -                binder.bind(invocation), nextComponent.getGuardedInvocation().getInvocation()), gi.getGuard(),
    1.30 +        final MethodPair matchedInvocations = matchReturnTypes(binder.bind(invocation),
    1.31 +                nextComponent.getGuardedInvocation().getInvocation());
    1.32 +        return nextComponent.compose(matchedInvocations.guardWithTest(binder.bindTest(checkGuard)), gi.getGuard(),
    1.33                  gic.getValidatorClass(), gic.getValidationType());
    1.34      }
    1.35  

mercurial