boolean (PsiElement element) { final PsiElement parent = element.getParent(); if (!(parent instanceof PsiCatchSection)) { return false; } if (element instanceof PsiCodeBlock) { return false; } final PsiElement owner = PsiTreeUtil.getParentOfType(parent, PsiMethod.class, PsiClass.class, PsiLambdaExpression.class); if (owner instanceof PsiLambdaExpression) { final PsiMethod method = LambdaUtil.getFunctionalInterfaceMethod(owner); return !(method instanceof PsiCompiledElement); } return owner instanceof PsiMethod; }