It can since Java 7, the instruction invokedynamic was added for this kind of stuff.
The implementation for Pattern Matching (the project Amber) [1] will use the very same instruction.
[1] https://cr.openjdk.java.net/~briangoetz/amber/pattern-match-...
The language that was supposed to replace Java in JEE and Spring.
Had it not been for Gradle, and there would be hardly a reason to learn it in 2021, other than historical interest.
I see a pretty active community around it and lots of new releases (from the libraries and the language itself) coming up all the time. Your picture of Groovy being dead couldn't be more wrong in my experience.
As mentioned, Gradle is still around.
I keep waiting for a good solution for SQL in Java (or another language) that isn't a builder or a string with templating. I don't like what React does architecturally, but JSX shows how mixing languages in an elegant-ish way can be huge.
Also among various other tech stacks I've never seen something that hits the sweet spot between "plain sql" and "advantages of ORM-stuff" as well as jooq
[0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... [1] https://github.com/appliedblockchain/tsql
Groovy DSLs are much better than Kotlin's.
Kotlin is a much better Java, and these days if I need to use the JVM, I will use Kotlin.
However, I do feel that there is a huge missed opportunity in making something that is not just a better Java, but a better language. Kotlin has a lot of annoying limitations, almost all of which are there because the JVM doesn't allow better implementations using first-class JVM functionality.
One of my favourite examples is multimethods which would be an amazing improvement. However, the JVM can't do dynamic dispatch on multiple arguments, so Kotlin will never get it. Sure, if they implement it, calling Kotlin from Java would be more complicated, but that really shouldn't restrict how the language evolves.
Another thing I'd like to see changed is better support for DSL's. Some nice stuff has been done with the limited facilities that are available, but it always seems like I'm fighting the language when making DSL's. As someone who writes a lot of Lisp, I'd really like to see a macro system.