boolean (@NotNull PsiElement element) { if (!(element instanceof PsiIdentifier)) return false; PsiReferenceExpression parent = ObjectUtils.tryCast(element.getParent(), PsiReferenceExpression.class); if (parent == null) return false; if (DumbService.isDumb(parent.getProject())) return false; PsiType type = ExpectedTypeUtils.findExpectedType(parent, false); if (type == null) return false; PsiMethod sam = LambdaUtil.getFunctionalInterfaceMethod(type); return sam != null && sam.getParameterList().getParametersCount() == 1 && PsiTypes.voidType().equals(sam.getReturnType()); }