Skip to content

Add support for Kotlin 2.2.0; drop Kotlin 1.5.x #19402

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

smowton
Copy link
Contributor

@smowton smowton commented Apr 28, 2025

  • Adds support for Kotlin 2.2.0-Beta1
  • Drops support for Kotlin 1.5.x
  • Trivial fix to the Gradle build of the Kotlin extractor
  • Accepts test changes relating to Kotlin 2.0.0 -> 2.1.20
    • These are mostly trivial source-location changes, except:
    • The comment extractor is performing better presumably due to improvements in the underlying representation
    • *=, /= and %= operations are once again extracted correctly; presumably their origin information has been fixed
    • Reference to a static final Java field can lead to more constant propagation than before
  • Sets unit tests to execute against latest stable (2.1.20).

I have also evaluated this against 2.2.0-Beta1 and see only trivial changes (loss of source-locations for some synthetic elements) which I hope will be fixed for the 2.2.0 release.

@Copilot Copilot AI review requested due to automatic review settings April 28, 2025 15:13
@smowton smowton requested review from a team as code owners April 28, 2025 15:13
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds support for Kotlin 2.2.0 by introducing new Beta1 modules and updating existing utility functions to work with the new API patterns. Key changes include:

  • Addition of new files in the v_2_2_0-Beta1 folder exposing updated functionality (e.g., getJvmDefaultMode, createImplicitParameterDeclarationWithWrappedDescriptor).
  • Updates in legacy versions (v_1_9_0-Beta and v_1_5_0) to ensure consistency in receiver handling and parameter indexing.
  • Adjustments in the KotlinFileExtractor and comment extraction logic to correctly process dispatch versus extension receivers.

Reviewed Changes

Copilot reviewed 24 out of 30 changed files in this pull request and generated no comments.

Show a summary per file
File Description
java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_2_0-Beta1/* New functions leveraging Kotlin 2.2.0 APIs
java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_9_0-Beta/CommentExtractorLighterAST.kt Updated to use the new IrVisitorVoid type alias
java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_5_0/* Adjusted functions for parameter indexing and default mode extraction
java/kotlin-extractor/src/main/kotlin/utils/IrVisitorLookup.kt Updated to depend on the new IrVisitor alias
java/kotlin-extractor/src/main/kotlin/comments/CommentExtractor.kt Modified receiver filtering to combine dispatch and extension receivers
java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt
java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt
Replaced older API usages with new functions to support Kotlin 2.2.0
Files not reviewed (6)
  • MODULE.bazel: Language not supported
  • docs/codeql/reusables/supported-versions-compilers.rst: Language not supported
  • java/kotlin-extractor/build.gradle: Language not supported
  • java/kotlin-extractor/deps/kotlin-compiler-2.2.0-Beta1.jar: Language not supported
  • java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.2.0-Beta1.jar: Language not supported
  • java/kotlin-extractor/deps/kotlin-stdlib-2.2.0-Beta1.jar: Language not supported
Comments suppressed due to low confidence (2)

java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_9_0-Beta/CommentExtractorLighterAST.kt:45

  • Verify that subclassing via 'IrVisitorVoid()' correctly implements all required methods compared to the previous 'IrElementVisitorVoid' interface to avoid potential mismatches in visitor behavior.
            object : IrVisitorVoid() {

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt:6011

  • Confirm that restricting the check to only dispatch receivers (using isDispatchReceiver) is the intended behavior here, considering the CommentExtractor separately handles extension receivers.
                    if (owner is IrValueParameter && isDispatchReceiver(owner)) {

smowton and others added 13 commits April 29, 2025 14:00
These are mainly small changes in how source-locations are ascribed to synthetic expressions, plus three real changes:

- The comment extractor is performing better presumably due to improvements in the underlying representation
- *= /= and %= operations are once again extracted correctly; presumably their origin information has been fixed
- Reference to a static final Java field can lead to more constant propagation than before

The last one might be a minor nuisance to someone trying to find references to such a field.
@smowton smowton force-pushed the smowton/admin/kotlin-2.2.0-support branch from b981211 to 388a0e6 Compare April 29, 2025 13:02
@smowton smowton changed the title Add support for Kotlin 2.2.0 Add support for Kotlin 2.2.0; drop Kotlin 1.5.x Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant