I think we've done a remarkable job at rehabilitating this monster.

I believe the only pending issue on that matter is the position of default inside the switch, With the legacy switch, default can be in the middle, with a switch on types that default has to be the last case.

I think we should try to emit a warning if "default" is not at last position, both Eclipse and IntelliJ already have that warning.



In an earlier round, we pended this issue because there were corner cases such as default falling into another case, such as:

    switch (n) {
        case 1: println("one"); break;
        case 2: println("two"); break;
        default: print("more than ");
        case 3: println("three"); break;
    }

which prints "one", "two", "three", or "more than three".

This is legal, if silly.  We pended this issue until the rest of the story shook out; now that it has, I think we are still kind of in the same place here.  A warning is OK here but it feels more like a style hint than  a real warning.

Reply via email to