private static @NotNull PsiSubstitutor getPartialSubstitutor(final @NotNull PsiMethodReferenceExpression expression,
                                                      final @NotNull PsiMethod method) {
    final PsiType[] typeArguments = expression.getTypeParameters();

    if (typeArguments.length > 0) {
      final PsiTypeParameter[] typeParameters = method.getTypeParameters();
      if (typeParameters.length == typeArguments.length) {
        final List<PsiTypeParameter> arguments = Arrays.asList(typeParameters);
        final List<PsiType> values = Arrays.asList(typeArguments);

        final Map<PsiTypeParameter, PsiType> substitutorMap = ContainerUtil.newHashMap(arguments, values);

        return PsiSubstitutor.createSubstitutor(substitutorMap);
      }
    }
    return PsiSubstitutor.EMPTY;
  }
private static @NotNull PsiSubstitutor getPartialSubstitutor(final @NotNull PsiMethodReferenceExpression expression,
                                                      final @NotNull PsiMethod method)