1.1 --- a/src/jdk/internal/dynalink/beans/SingleDynamicMethod.java Wed Aug 20 10:25:28 2014 +0200 1.2 +++ b/src/jdk/internal/dynalink/beans/SingleDynamicMethod.java Wed Aug 20 10:26:01 2014 +0200 1.3 @@ -156,7 +156,9 @@ 1.4 /** 1.5 * Given a method handle and a call site type, adapts the method handle to the call site type. Performs type 1.6 * conversions as needed using the specified linker services, and in case that the method handle is a vararg 1.7 - * collector, matches it to the arity of the call site. 1.8 + * collector, matches it to the arity of the call site. The type of the return value is only changed if it can be 1.9 + * converted using a conversion that loses neither precision nor magnitude, see 1.10 + * {@link LinkerServices#asTypeLosslessReturn(MethodHandle, MethodType)}. 1.11 * @param target the method handle to adapt 1.12 * @param callSiteType the type of the call site 1.13 * @param linkerServices the linker services used for type conversions 1.14 @@ -286,7 +288,7 @@ 1.15 1.16 private static MethodHandle createConvertingInvocation(final MethodHandle sizedMethod, 1.17 final LinkerServices linkerServices, final MethodType callSiteType) { 1.18 - return linkerServices.asType(sizedMethod, callSiteType); 1.19 + return linkerServices.asTypeLosslessReturn(sizedMethod, callSiteType); 1.20 } 1.21 1.22 private static boolean typeMatchesDescription(final String paramTypes, final MethodType type) {