PsiType (PsiType functionalInterfaceType, PsiElement context) { final PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(functionalInterfaceType); final MethodSignature function = LambdaUtil.getFunction(resolveResult.getElement()); if (function != null) { final int interfaceMethodParamsLength = function.getParameterTypes().length; if (interfaceMethodParamsLength > 0) { PsiType type = resolveResult.getSubstitutor().substitute(function.getParameterTypes()[0]); return type != null ? PsiUtil.captureToplevelWildcards(type, context) : null; } } return null; }