void (PsiSwitchBlock statement) { startElement(statement); PsiExpression expr = statement.getExpression(); if (expr != null) { expr.accept(this); } PsiCodeBlock body = statement.getBody(); if (body != null) { PsiStatement[] statements = body.getStatements(); //16.2.9 (for statements) and 16.1.6 (for expressions) boolean needToCreateDefault = JavaPsiSwitchUtil.isEnhancedSwitch(statement); PsiType exprType = expr == null ? null : expr.getType(); for (PsiStatement aStatement : statements) { ProgressManager.checkCanceled(); if (!(aStatement instanceof PsiSwitchLabelStatementBase)) continue; PsiSwitchLabelStatementBase labelStatement = (PsiSwitchLabelStatementBase)aStatement; if (labelStatement.isDefaultCase()) { needToCreateDefault = true; } PsiCaseLabelElementList labelElementList = labelStatement.getCaseLabelElementList(); if (!needToCreateDefault && labelElementList != null) { for (PsiCaseLabelElement element : labelElementList.getElements()) { if (element instanceof PsiDefaultCaseLabelElement || exprType != null && JavaPsiPatternUtil.isUnconditionalForType(element, exprType)) { needToCreateDefault = true; break; } } } Instruction instruction = new ConditionalGoToInstruction(0, expr); myCurrentFlow.addInstruction(instruction); addElementOffsetLater(aStatement, true); } if (!needToCreateDefault) { Instruction instruction = new GoToInstruction(0); myCurrentFlow.addInstruction(instruction); addElementOffsetLater(body, false); } body.accept(this); } finishElement(statement); }