void (@NotNull PsiTryStatement statement) { super.visitTryStatement(statement); PsiElement lastPsiElement = getLastPsiElementInsideTryBlock(statement); if (lastPsiElement instanceof PsiAssertStatement) { registerError(lastPsiElement, "assert"); } else if (lastPsiElement instanceof PsiExpressionStatement) { PsiExpression psiExpr = ((PsiExpressionStatement)lastPsiElement).getExpression(); if (!(psiExpr instanceof PsiMethodCallExpression psiMethodCallExpr)) return; while (true) { PsiMethodCallExpression currQualifierCall = MethodCallUtils.getQualifierMethodCall(psiMethodCallExpr); if (currQualifierCall == null) break; psiMethodCallExpr = currQualifierCall; } String methodRefName = psiMethodCallExpr.getMethodExpression().getReferenceName(); if (methodRefName == null) return; if (methodRefName.equals("fail") || methodRefName.startsWith("assert")) { registerError(psiExpr, methodRefName + "()"); } } }