I would much prefer to have MatchException than
IncompatibleClassChangeError, but you might be right about
SwitchBootstraps. AI is telling me with reference to the current
GEP-19 spec and reference implementation:

"Emitting java.lang.runtime.SwitchBootstraps.typeSwitch invokedynamic
dispatch — on parity with how Java compiles pattern switch — remains
future work for when a JDK 21+ bytecode target is available; the
nested-instanceof shape above is what that bootstrap degenerates to
for small label counts."

But I haven't tried to implement it for real yet, so whether it
actually works for us is not a given.

Of course, this should still be a discussion. There might be other
reasons we should consider (or rule out as not needed) that might be
on the cards for Groovy 7.

Cheers, Paul.


On Fri, Sep 18, 2026 at 4:30 PM Jochen Theodorou <[email protected]> wrote:
>
>
>
> On 9/18/26 02:27, Paul King wrote:
> [...]
> > In Groovy 7, we plan to look at
> > GEP-19 (more advanced switch pattern matching), so some of the JDK21
> > work in that space (like having MatchException and SwitchBootstraps)
> > would be really beneficial. I propose bumping the minimum to 21 for
> > that reason. I don't know of any JDK 25 features we need just yet, but
> > if we find any, we can always bump the minimum again later.
> I struggle with the purpose of MatchException. And does it have to be
> MatchException? The use cases are unclear to me right now.
>
> The SwitchBootstraps are also questionable from my point of view. Their
> idea is good, I do not question that part. But can we use exactly these
> bootstrap methods? As far as I understood it they are specific to the
> Java defined semantics on how a switch is supposed to operate. We have
> "isCase" for this. And while they basically try to solve a slightly
> different problem, I see a potential clash with Groovy semantics here
> even in static compilation. And we probably have to rework some things
> here.
>
> So frankly bumping to 21 seems to be too early for me.
>
> bye Jochen

Reply via email to