Strumenta / antlr-kotlin

Support for Kotlin as a target for ANTLR 4
Apache License 2.0
221 stars 47 forks source link

Moving to Kotlin 2 (once 2.0.20 is released) #153

Open ftomassetti opened 7 months ago

ftomassetti commented 7 months ago

Kotlin 2 is coming, bringing benefits to the multi-platform projects.

Current versions of Kotlin 2 (Kotlin 2.0.0-Beta3 as of now) cannot be used in production, but we may start running experiments to see if there are issues with the Kotlin 2 compiler. In my experience with other projects the migration was rather smooth, but this is a project supporting many platforms and perhaps there could be more suprises.

lppedd commented 7 months ago

Probably in 3/4 months? Left is Beta4, and a couple of RCs at least.

We can already try out K2 tho.

lppedd commented 7 months ago

Just compiled/tested with K2, all good!

ftomassetti commented 7 months ago

Just compiled/tested with K2, all good!

Great!

ftomassetti commented 7 months ago

I guess with Kotlin 2, the K2 compiler is enabled by default, right?

lppedd commented 7 months ago

Yes, exactly.

K1 will be available for some minor versions IIRC (e.g., 2.2), so there is no rush in case of issues (which we don't have anyway).

sschuberth commented 7 months ago

Will the generated code improve with K2? This comment seems to hint at it.

lppedd commented 7 months ago

@sschuberth in this specific case we might benefit of future language capabilities, but the main improvement is a bit of speed up when building.

No changes for generated code, but in case you can be more specific and I can try to answer.

lppedd commented 6 months ago

I've tested Beta4 today with the K2 IDE.
Still not ready imo, especially the IDE plugin (you can't work in non-JVM or non-Common source sets). We can definitely update to Kotlin 2.0, but we will need to keep the API version at the 1.9 level, as that's where most users will be at for quite some time.

ftomassetti commented 3 months ago

Now Kotlin 2.0.0 has been released, so we could check the situation and decide if we want to move to K2 using API 1.9

lppedd commented 3 months ago

I've been observing the situation since beta versions. My advice is to wait until 2.0.20. That's what most issues, and they are a lot, are targeting.

ftomassetti commented 3 months ago

Noted, thank you

lppedd commented 2 months ago

Like, stuff like KT-68538 needs to be fixed before considering an update to 2.0+.
It's too risky.

lppedd commented 2 months ago

2.0.20-Beta1 should be out mid next week.

JesusMcCloud commented 11 hours ago

2.0.20 stable is here

lppedd commented 11 hours ago

@JesusMcCloud I'm going to verify the project compiled on 2.0.20 will be consumable by 1.9.24 without issues on Monday, and then I'll open a PR.

lppedd commented 11 hours ago

Note that I want to deliver one last potentially breaking change before releasing 1.0.0 on Kotlin 2.0.20.

JesusMcCloud commented 11 hours ago

thanks! I just stumbled upon this issue here, because the dependency on an incompatible kotlin-reflect messes with one of our (rather complex) projects on kotlin 2.0.0

lppedd commented 10 hours ago

@JesusMcCloud I guess the dependency you're mentioning is this one:

https://github.com/Strumenta/antlr-kotlin/blob/7951a3f4745a527bdd02adac2dc448af38311bfc/antlr-kotlin-runtime/build.gradle.kts#L32

I'm not sure why it was added, but given we don't depend on reflect features, I'll get rid of it.
Good catch.