eclipse-jdt / eclipse.jdt.core

Eclipse Public License 2.0
166 stars 131 forks source link

JEP 443: lists of patterns as a case label #1643

Closed datho7561 closed 8 months ago

datho7561 commented 11 months ago

i.e.

record Box<T extends Ball>(T content) { }

sealed abstract class Ball permits RedBall, BlueBall, GreenBall { }
final  class RedBall   extends Ball { }
final  class BlueBall  extends Ball { }
final  class GreenBall extends Ball { }

public class A {
    public static void main(String... args) {
        Box box = null;
        switch (box) {
        case Box(RedBall _), Box(BlueBall _) when args.length == 4:
            System.out.println("hello");
            break;
        default:
            System.out.println("goodbye");
        }
    }
}

see the discussion here: https://github.com/eclipse-jdt/eclipse.jdt.core/pull/1517#issuecomment-1829038759

datho7561 commented 11 months ago

I started work on this as a part of https://github.com/eclipse-jdt/eclipse.jdt.core/pull/1517

srikanth-sankaran commented 9 months ago

@datho7561 I have made us joint owners of this. I would like to include this as part of the comprehensive cleaup to pattern code generation rather than rush through this. Hope that is fine with you