boolean (PsiElement element, String logMethodName) { while (true) { final PsiIfStatement ifStatement = PsiTreeUtil.getParentOfType(element, PsiIfStatement.class); if (ifStatement == null) { return false; } final PsiExpression condition = ifStatement.getCondition(); if (isLogGuardCheck(condition, logMethodName)) { return true; } element = ifStatement; } }