Index: j2k/src/org/jetbrains/kotlin/j2k/SwitchConverter.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- j2k/src/org/jetbrains/kotlin/j2k/SwitchConverter.kt	(revision 34ef391571231536408380acd90fc8366b743c45)
+++ j2k/src/org/jetbrains/kotlin/j2k/SwitchConverter.kt	(revision )
@@ -39,10 +39,7 @@
                 continue
             }
             pendingSelectors.add(codeConverter.convertStatement(case.label) as WhenEntrySelector)
-            if (!case.label.isDefaultCase && case.statements.isEmpty() && cases[i + 1]?.label!!.isDefaultCase){
-                result.add(WhenEntry(pendingSelectors, convertCaseStatementsToBody(cases, i + 1)).assignNoPrototype())
-                pendingSelectors = ArrayList()
-            }else if (case.statements.isNotEmpty()) {
+            if (case.statements.isNotEmpty()) {
                 result.add(WhenEntry(pendingSelectors, convertCaseStatementsToBody(cases, i)).assignNoPrototype())
                 pendingSelectors = ArrayList()
             }
@@ -55,25 +52,87 @@
         if (body != null) {
             var currentLabel: PsiSwitchLabelStatement? = null
             var currentCaseStatements = ArrayList<PsiStatement>()
-
+            var k = 0
             fun flushCurrentCase() {
                 if (currentLabel != null || currentCaseStatements.isNotEmpty()) {
                     cases.add(Case(currentLabel, currentCaseStatements))
                 }
             }
-
-            for (statement in body.statements) {
+            // #here
+            for ((i, statement) in body.statements.withIndex()) {
                 if (statement is PsiSwitchLabelStatement) {
-                    flushCurrentCase()
-                    currentLabel = statement
                     currentCaseStatements = ArrayList()
+
+                    fun getReturnStatement(): PsiReturnStatement?{
+                        for(j in body.statements.indices.filter { it >= i }){
+                            body.statements.iterator().next()
+                            val currStatement = body.statements[j]
+                            if (currStatement is PsiReturnStatement){
+                                return currStatement as PsiReturnStatement
-                }
+                            }
-                else {
+                            else{
-                    currentCaseStatements.add(statement)
+                                continue;
-                }
-            }
+                            }
+                        }
+                        return null
+                    }
 
+
+
+                    fun compoudConsecutiveNonDefaultLabelStatements(){
+                        k = i
+                        for (j in body.statements.indices.filter { it >= i }){
+                            val currStatement = body.statements[j]
+                            if(currStatement !is PsiReturnStatement){
+                                currStatement as PsiSwitchLabelStatement
+                                if(!currStatement.isDefaultCase){
+                                    currentCaseStatements.add(currStatement)
+                                }
+                                else{
+                                    continue
+                                }
+                            }
+                            else{
+                                break;
+                            }
+                            k = j
+                        }
+                    }
+
+                    fun processPsiNonDefaultCase(){
+                        //flushCurrentCase()
+                        currentLabel = statement
+                        compoudConsecutiveNonDefaultLabelStatements()
+                        // --> need to update index i in the name for loop #here
+                        val retStatement = getReturnStatement()
+                        retStatement as PsiStatement
+                        currentCaseStatements.add(retStatement)
-            flushCurrentCase()
+                        flushCurrentCase()
+                        currentCaseStatements = ArrayList()
+
+                    }
+                    fun processPsiDefaultCase(){
+                        currentLabel = statement
+                        val retStatement = getReturnStatement()
+                        retStatement as PsiStatement
+                        currentCaseStatements.add(retStatement)
+                        flushCurrentCase()
+                        currentCaseStatements = ArrayList()
+
+                    }
+                    if(!statement.isDefaultCase){
+                        processPsiNonDefaultCase()
+                    }
+                    else if(statement.isDefaultCase){
+                        processPsiDefaultCase()
+                    }
+
+
+                }
+                else {
+                    continue
+                }
+            }
         }
 
         return cases
