Set<PsiClass> (PsiConditionalExpression expression, int maxDepth) { PsiExpression thenBranch = expression.getThenExpression(); PsiExpression elseBranch = expression.getElseExpression(); if (thenBranch != null && elseBranch != null) { PsiClass thenType = ContainerUtil.getOnlyItem(getPossibleTypes(thenBranch, maxDepth / 2)); PsiClass elseType = ContainerUtil.getOnlyItem(getPossibleTypes(elseBranch, maxDepth / 2)); if (thenType != null && thenType.equals(elseType)) { return Collections.singleton(thenType); } } return null; }