-
Notifications
You must be signed in to change notification settings - Fork 428
Compatibility with Kotlin 2.x #5128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
BTW, I'm using Kotlin 1.9.22 now and it's working correctly |
Thanks for logging the issue and posting the workaround! As also indicated via Slack definitely something to look into, with help appreciated. I imagine we'll want to support both K1 and K2, so that's be interesting. |
I'm running into similar issues when using Kotlin 1.9.24 - unfortunately, it's not realistic to couple the repo's Kotlin version to the one that openrewrite-kotlin is using. I think that, probably, openrewrite-kotlin could shade its version of the embeddable Kotlin compiler, so that it can use a different one to parse Kotlin code than the one that is used when building. The concrete issue I'm seeing is
|
Thanks for the report @pettermahlen ; Surprised to see that's even an issue with the v1.9.22 we're using: Feel free to bump that up to 1.9.24 if that helps you there already; then we can tackle the v2 migration later. |
The main point I was trying to make is that it's not ideal for rewrite-kotlin to require users to use a specific version of Kotlin when building their source. Instead, since rewrite-kotlin uses internal APIs that change even with minor bumps, it should be shading those. That way, openrewrite-kotlin's upgrades of the compiler APIs it's using for parsing, and each of the projects upgrades of the version used to build with can be kept separate. It seems like it would be very awkward if the latest version of kotlin-rewrite always only worked with the latest version of Kotlin. |
Oh that I fully understand and agree with; my expectation though is that the 1.9 branch will not evolve much anymore, so for now ensuring we are compatible with the now-latest v1.9.25 would mean at least folks on 1.9 can continue to use rewrite-kotlin. v2 would be a larger effort which we can then tackle separately. |
Useful links to use for supporting Kotlin 2.x: |
Started working on openrewrite/rewrite-kotlin#627 - draft, still with compile errors |
@barbulescu I'm curious to know if there are any remaining blockers to ship 2.1.x? |
Thanks for your interest @idanakav ! As also indicated on that PR we've since moved rewrite-kotlin into this repository That means the same changes as seen there should now target this repository instead; any help there welcome! :) |
There are still few issues, but I need more time to understand both Kotlin FIR and OpenRewrite. It would be great if anyone with this know-how can help here. If not, I will continue next weekend. |
I am blocked at the part where FirSession is created in KotlinParser. I got a suggestion, but it looks like there are a lot of changes on this area. Can anybody help here? |
@greg-at-moderne would you be able to help provide some guidance here? 🙏 |
My knowledge of Kotlin is close to zero, but I am happy to help. I've just requested to join the Kotlin Lang Slack to read the context. |
I had some progress and I am trying to fix
I tried to debug but I get easily lost. Is any strategy for finding the root cause of such an issue? |
Hmm, quick answer from mobile seeing this now. The way I tend to go through is to first run the rest with coverage, and then from there set breakpoints on the paths I know are hit. In this case it looks like the type is missing on this ++ operator: rewrite/rewrite-java-test/src/test/java/org/openrewrite/java/format/WrappingAndBracesTest.java Line 56 in 2b9bc08
Is there any branch where we could maybe try to have a look as well? Not likely I'll get to it before Thursday with travel, but maybe Greg will have more ideas still. |
I am working on main branch of my fork. |
Thanks! Feel free to open up an early draft PR; that makes it easier for folks to be aware and check out your work already. I had a brief look here, but can't see much more beyond confirming that when we look up the type for rewrite/rewrite-kotlin/src/main/java/org/openrewrite/kotlin/internal/KotlinTreeParserVisitor.java Lines 3088 to 3092 in 5b5b43d
|
Cannot find |
Uh oh!
There was an error while loading. Please reload this page.
hei team
I'm trying to use
rewriteRun
https://github.com/Hyunk3l/ecommerce in this public project I've (kotlin 2.1, java 17, etc.)I'm trying with this recipe and this is the error I get
I suspect it's because of Kotlin 2.1.. so I downgraded it to 2.0.20 but
Slack Message
The text was updated successfully, but these errors were encountered: