Source:
<code>private ScalarImplementationChoice getScalarFunctionImplementationChoice(BoundVariables boundVariables, TypeManager typeManager, FunctionRegistry functionRegistry, PolymorphicScalarFunctionChoice choice) { List<TypeSignature> resolvedParameterTypeSignatures = applyBoundVariables(getSignature().getArgumentTypes(), boundVariables); List<Type> resolvedParameterTypes = resolveTypes(resolvedParameterTypeSignatures, typeManager); TypeSignature resolvedReturnTypeSignature = applyBoundVariables(getSignature().getReturnType(), boundVariables); Type resolvedReturnType = typeManager.getType(resolvedReturnTypeSignature); SpecializeContext context = new SpecializeContext(boundVariables, resolvedParameterTypes, resolvedReturnType, typeManager, functionRegistry); Optional<Method> matchingMethod = Optional.empty(); Optional<MethodsGroup> matchingMethodsGroup = Optional.empty(); <START> for (MethodsGroup candidateMethodsGroup : choice.methodsGroups) { <END> for (Method candidateMethod : candidateMethodsGroup.getMethods()) { if (matchesParameterAndReturnTypes(candidateMethod, resolvedParameterTypes, resolvedReturnType, choice.argumentProperties, choice.nullableResult)) { if (matchingMethod.isPresent()) { throw new IllegalStateException("two matching methods (" + matchingMethod.get().getName() + " and " + candidateMethod.getName() + ") for parameter types " + resolvedParameterTypeSignatures); } matchingMethod = Optional.of(candidateMethod); matchingMethodsGroup = Optional.of(candidateMethodsGroup); } } } checkState(matchingMethod.isPresent(), "no matching method for parameter types %s", resolvedParameterTypes); List<Object> extraParameters = computeExtraParameters(matchingMethodsGroup.get(), context); MethodHandle methodHandle = applyExtraParameters(matchingMethod.get(), extraParameters, choice.argumentProperties); return new ScalarImplementationChoice(choice.nullableResult, choice.argumentProperties, methodHandle, Optional.empty()); }</code><technical_language>choice.getMethodsGroups()</technical_language>

Target:
private ScalarImplementationChoice getScalarFunctionImplementationChoice( BoundVariables boundVariables, TypeManager typeManager, FunctionRegistry functionRegistry, PolymorphicScalarFunctionChoice choice) { List<TypeSignature> resolvedParameterTypeSignatures = applyBoundVariables(getSignature().getArgumentTypes(), boundVariables); List<Type> resolvedParameterTypes = resolveTypes(resolvedParameterTypeSignatures, typeManager); TypeSignature resolvedReturnTypeSignature = applyBoundVariables(getSignature().getReturnType(), boundVariables); Type resolvedReturnType = typeManager.getType(resolvedReturnTypeSignature); SpecializeContext context = new SpecializeContext(boundVariables, resolvedParameterTypes, resolvedReturnType, typeManager, functionRegistry); Optional<MethodAndNativeContainerTypes> matchingMethod = Optional.empty(); Optional<MethodsGroup> matchingMethodsGroup = Optional.empty(); for (MethodsGroup candidateMethodsGroup : choice.getMethodsGroups()) { for (MethodAndNativeContainerTypes candidateMethod : candidateMethodsGroup.getMethods()) { if (matchesParameterAndReturnTypes(candidateMethod, resolvedParameterTypes, resolvedReturnType, choice.getArgumentProperties(), choice.isNullableResult())) { if (matchingMethod.isPresent()) { throw new IllegalStateException("two matching methods (" + matchingMethod.get().getMethod().getName() + " and " + candidateMethod.getMethod().getName() + ") for parameter types " + resolvedParameterTypeSignatures); } matchingMethod = Optional.of(candidateMethod); matchingMethodsGroup = Optional.of(candidateMethodsGroup); } } } checkState(matchingMethod.isPresent(), "no matching method for parameter types %s", resolvedParameterTypes); List<Object> extraParameters = computeExtraParameters(matchingMethodsGroup.get(), context); MethodHandle methodHandle = applyExtraParameters(matchingMethod.get().getMethod(), extraParameters, choice.getArgumentProperties()); return new ScalarImplementationChoice(choice.isNullableResult(), choice.getArgumentProperties(), methodHandle, Optional.empty()); }