Github user dawidwys commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4039#discussion_r119868212
  
    --- Diff: 
flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java 
---
    @@ -422,37 +521,52 @@ private static void registerFactory(Type t, Class<? 
extends TypeInfoFactory> fac
                                throw new InvalidTypesException("Internal error 
occurred.", e);
                        }
                        if (exec != null) {
    +                           Preconditions.checkArgument(
    +                                   lambdaInputTypeArgumentIndices != null 
&& lambdaInputTypeArgumentIndices.length >= 1,
    +                                   "Indices for input type arguments 
within lambda not provided");
    +                           Preconditions.checkArgument(
    +                                   lambdaOutputTypeArgumentIndices != null,
    +                                   "Indices for output type arguments 
within lambda not provided");
                                // check for lambda type erasure
                                validateLambdaGenericParameters(exec);
     
                                // parameters must be accessed from behind, 
since JVM can add additional parameters e.g. when using local variables inside 
lambda function
    -                           final int paramLen = 
exec.getParameterTypes().length - 1;
    +                           final int paramLen = 
exec.getParameterTypes().length;
    +
    +                           final Method sam = 
getSingleAbstractMethod(baseClass);
    +                           final int baseParametersLen = 
sam.getParameterTypes().length;
    --- End diff --
    
    Kind of. baseParametersLen is the number of arguments that the method of 
interface has. So this is the "array" that the indices point to.
    
    paramLen is the number of parameters of the lambda, which can have some 
additional parameters e.g. from the closure. So we need both of those lengths 
to index the argument correctly. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to