Instruction (@NotNull PsiStatement statement) { PsiDeclarationStatement declaration = tryCast(statement, PsiDeclarationStatement.class); if (declaration != null) return Declaration.create(declaration); PsiReturnStatement returnStatement = tryCast(statement, PsiReturnStatement.class); if (returnStatement != null) return Return.create(returnStatement); PsiThrowStatement throwStatement = tryCast(statement, PsiThrowStatement.class); if (throwStatement != null) return Throw.create(throwStatement); PsiIfStatement ifStatement = tryCast(statement, PsiIfStatement.class); if (ifStatement != null) return Check.create(ifStatement); PsiBlockStatement block = tryCast(statement, PsiBlockStatement.class); if (block != null) return new CodeBlock(block); PsiExpressionStatement expressionStatement = tryCast(statement, PsiExpressionStatement.class); if (expressionStatement != null) { PsiAssignmentExpression assignment = tryCast(expressionStatement.getExpression(), PsiAssignmentExpression.class); if (assignment != null) return Assignment.create(assignment); } return new Statement(statement); }