Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix for Kotlin 1.7 breaking changes #214

Merged
merged 3 commits into from
Aug 6, 2022

Conversation

big-andy-coates
Copy link
Collaborator

@big-andy-coates big-andy-coates commented Jul 21, 2022

fixes: #212

The gradle plugin for Kotlin 1.7 included breaking changes, including making KotlinCompile no longer derive from AbstractCompile, breaking this plugin. (See https://kotlinlang.org/docs/whatsnew17.html#changes-in-compile-tasks).

The fix is to factor out the information required from compile tasks into a CompileTaskWrapper interface and provide different impls for tasks derived from AbstractCompile vs those that are not (like KotlinCompile). The latter uses reflection to access the needed methods. (I've gone with reflection as it means we don't need to bring in Kotlin plugin dependencies).

@big-andy-coates big-andy-coates marked this pull request as draft July 22, 2022 09:10
fixes: java9-modularity#212

The gradle plugin for Kotlin 1.7 included breaking changes, including making `KotlinCompile` no longer derive from `AbstractCompile`, breaking this plugin. (See https://kotlinlang.org/docs/whatsnew17.html#changes-in-compile-tasks).

The fix is to factor out the information required from compile tasks into a `CompileTaskWrapper` interface and provide different impls for tasks derived from `AbstractCompile` vs those that are not (like `KotlinCompile`). The latter uses reflection to access the needed methods.
@big-andy-coates
Copy link
Collaborator Author

@siordache, this change should get us close to a solution to the breaking change in the Kotlin Gradle plugin v1.7. However, I'm seeing a test failure in ModulePluginSmokeTest.smokeTesstRun which fails when using the new version of the Kotlin plugin.

The failure is due to the following extra output at the start:

WARNING: Unknown module: java.annotation specified to --patch-module

At this time I'm not sure if this is due to an issue with my changes, or another change to do with the Kotlin plugin. Though my debugging suggests the new code is resulting in the same functionality.

It may be this line just needs ignoring, but I don't feel happy doing that without a more thorough understanding of what's causing it.

Any help / pointers appreciated. :)

@big-andy-coates big-andy-coates marked this pull request as ready for review July 22, 2022 09:54
Issue was that nothing was actually using the `javax.annotation` module in the project, i.e. a bug in the test project.  For some reason updating the Kotlin jars caused the issue to be displayed.  Fixed by having a module depend on the module. Also added a use of one of the types from one of the patched jars to ensure it working.
@big-andy-coates
Copy link
Collaborator Author

Never mind @siordache, I found and fixed the issue. The PR is really for review.

@siordache siordache merged commit 6f339bb into java9-modularity:master Aug 6, 2022
@siordache
Copy link
Collaborator

Thanks for this PR!

@big-andy-coates big-andy-coates deleted the issue-212 branch August 8, 2022 14:15
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Breaks with Kotlin 1.7.0
2 participants