PsiInstanceOfExpression (PsiElement element, PsiStatement statement, PsiExpression condition) { if (condition instanceof PsiInstanceOfExpression instanceOf) { if (insideEmptyBlockOrRef(statement, element, instanceOf)) { return instanceOf; } } else if (condition instanceof PsiPolyadicExpression polyadic) { final PsiExpression[] operands = polyadic.getOperands(); if (polyadic.getOperationTokenType() == JavaTokenType.ANDAND) { PsiInstanceOfExpression expr = null; for (PsiExpression operand : operands) { if (operand instanceof PsiInstanceOfExpression instanceOf) { if (expr != null) { expr = null; break; } expr = instanceOf; } } if (expr != null && insideEmptyBlockOrRef(statement, element, expr)) { return expr; } } } return null; }