Quick actions

cmd+k|ctrl+k

Navigation

Languages

Java to Kotlin bug

Snippet info

Language

Java

Visibility

public

Author

barend

Created

2020-01-19T01:56:43Z

Updated

2020-01-19T15:24:26Z

// The IntelliJ IDEA Kotlin to Java converter generates syntactically invalid
// Kotlin code for the Java code below.
//
// The `break` is not removed, which is invalid in `when`
// expressions. While the code is a bit silly, I faced this problem in the wild
// while converting https://tartarus.org/martin/PorterStemmer/java.txt.

package guide.galaxy.deepthought;

class Main {
    public static void foo(int c) {
        switch (c) {
            case 42:
                if (true) {
                    break;
                }
        }
    }
}
INFO