TypeConversionDescriptor (@NotNull PsiMethod method, @Nullable PsiExpression context) { LOG.assertTrue("filter".equals(method.getName())); final PsiParameter[] parameters = method.getParameterList().getParameters(); if (parameters.length != 1) return null; final PsiParameter parameter = parameters[0]; final PsiType type = parameter.getType(); if (!(type instanceof PsiClassType)) return null; final PsiClass resolvedClass = ((PsiClassType)type).resolve(); if (resolvedClass == null) return null; if (CommonClassNames.JAVA_LANG_CLASS.equals(resolvedClass.getQualifiedName())) { if (context == null) return null; PsiMethodCallExpression methodCall = null; if (context instanceof PsiMethodCallExpression) { methodCall = (PsiMethodCallExpression)context; } else if (context.getParent() instanceof PsiMethodCallExpression) { methodCall = (PsiMethodCallExpression)context.getParent(); } if (methodCall == null) return null; final PsiType filteredType = methodCall.getType(); if (!(filteredType instanceof PsiClassType)) return null; final PsiType[] filterParameters = ((PsiClassType)filteredType).getParameters(); if (filterParameters.length != 1) return null; final String filterClassName = getFilterClassText(filterParameters[0]); if (filterClassName == null) return null; return new GuavaFilterInstanceOfConversionDescriptor(filterClassName); } else if (GuavaLambda.PREDICATE.getClassQName().equals(resolvedClass.getQualifiedName())) { return new GuavaTypeConversionDescriptor("$it$.filter($p$)", "$it$." + StreamApiConstants.FILTER + "($p$)", context); } return null; }