Check (@NotNull PsiIfStatement ifStatement) { PsiExpression condition = ifStatement.getCondition(); if (condition == null) return null; PsiStatement thenBranch = ifStatement.getThenBranch(); if (thenBranch == null) return null; List<Instruction> instructions = OptionalToIfInspection.createInstructions(ControlFlowUtils.unwrapBlock(thenBranch)); if (instructions == null) return null; PsiStatement elseBranch = ifStatement.getElseBranch(); List<Instruction> elseInstructions = null; if (elseBranch != null) { elseInstructions = OptionalToIfInspection.createInstructions(ControlFlowUtils.unwrapBlock(elseBranch)); if (elseInstructions == null) return null; } return new Check(condition, instructions, elseInstructions); }