public void selectStrategy ( ) { LightweightTypeReference expectedType = expectation . getExpectedType ( ) ; if ( expectedType == null ) { strategy = getClosureWithoutExpectationHelper ( ) ; } else { JvmOperation operation = functionTypes . findImplementingOperation ( expectedType ) ; JvmType type = expectedType . getType ( ) ; int closureParameterSize ; if ( closure . isExplicitSyntax ( ) ) { closureParameterSize = closure . getDeclaredFormalParameters ( ) . size ( ) ; } else if ( operation != null ) { closureParameterSize = operation . getParameters ( ) . size ( ) ; } else { closureParameterSize = 1 ; } if ( operation == null || operation . getParameters ( ) . size ( ) != closureParameterSize || type == null ) { strategy = getClosureWithoutExpectationHelper ( ) ; } else { strategy = createClosureWithExpectationHelper ( operation ) ; } } }
This method is only public for testing purpose .