void (@NotNull PsiThrowStatement statement) { if (statement.getException() == myExpr) { PsiManager manager = statement.getManager(); PsiType throwableType = JavaPsiFacade.getElementFactory(manager.getProject()).createTypeByFQClassName(CommonClassNames.JAVA_LANG_THROWABLE, myExpr.getResolveScope()); PsiElement container = PsiTreeUtil.getParentOfType(statement, PsiMethod.class, PsiLambdaExpression.class, PsiClass.class); PsiType[] throwsTypes = PsiType.EMPTY_ARRAY; if (container instanceof PsiMethod) { throwsTypes = ((PsiMethod)container).getThrowsList().getReferencedTypes(); } else if (container instanceof PsiLambdaExpression) { final PsiMethod method = LambdaUtil.getFunctionalInterfaceMethod(container); if (method != null) { throwsTypes = method.getThrowsList().getReferencedTypes(); } } if (throwsTypes.length == 0) { final PsiClassType exceptionType = JavaPsiFacade.getElementFactory(manager.getProject()).createTypeByFQClassName("java.lang.Exception", myExpr.getResolveScope()); throwsTypes = new PsiClassType[]{exceptionType}; } for (PsiType throwsType : throwsTypes) { myResult.add(createInfoImpl( myExpr instanceof PsiTypeCastExpression && myForCompletion ? throwsType : throwableType, ExpectedTypeInfo.TYPE_OR_SUBTYPE, throwsType, TailTypes.semicolonType() )); } } }