Skip to content

Bump kotlin 2.2 - #1555

Open
Flórián Garaba (fgaraba) wants to merge 2 commits into
masterfrom
bump-kotlin-2.2
Open

Bump kotlin 2.2#1555
Flórián Garaba (fgaraba) wants to merge 2 commits into
masterfrom
bump-kotlin-2.2

Conversation

@fgaraba

@fgaraba Flórián Garaba (fgaraba) commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Bumps the Kotlin compiler from 2.0.21 to 2.4.10 across all five sub-builds. This unblocks the use of com.jetbrains.intellij.platform:plugin-system-parser-impl (compiled with Kotlin 2.4 metadata), which is being added to the structure-intellij version catalog as groundwork for a future parser migration, as well as some other issues (MP-7810 Correctly handle 403 error from Marketplace in verifier service)
  • Replaces the bytecode-shape heuristic in KotlinMethods.isKotlinDefaultMethod() with a semantically correct check against @kotlin.Metadata (via kotlinx-metadata-jvm). The old approach pattern-matched a specific INVOKESTATIC → $DefaultImpls instruction sequence that the Kotlin 2.x compiler no longer emits when -Xjvm-default=all-compatibility is active — causing the check that all internal API violating usages are found test to report four false-positive NoInternalTypeUsage findings after the compiler bump. The new approach asks whether the method appears in the class's own declared functions list in Kotlin metadata; if it doesn't, the compiler synthesized it - regardless of which lowering strategy produced the bytecode.
  • Pins apiVersion/languageVersion in the five verifier-test fixture modules (mock-plugin, before-idea, after-idea, additional-before-idea, additional-after-idea) independently from the project's own language level, so the fixture bytecode shape doesn't drift with future toolchain bumps.

Mechanical fixes required by the version bump

  • ide-diff-builder: updated kotlinx-serialization-runtime:1.0-M1-1.4.0-rc (incompatible with the 2.4.x plugin) to kotlinx-serialization-json:1.11.0; removed dead import kotlinx.serialization.stringify.
  • plugins-verifier-service ValueType<T>: added : Any upper bound — Kotlin 2.2 promotes to an error the case where a Kotlin class with a nullable T overrides a Java generic member that expects non-null T.
  • KtClassResolver: replaced cache.get(key) { nullable } (rejected under Kotlin 2.2's stricter Caffeine overload resolution) with getIfPresent + conditional put.
  • CachingPluginDependencyResolverProvider: replaced cache.put(this.pluginId, r) (String?) with cache.put(this.id, r) (String).
  • Various toLowerCase()/toUpperCase() calls replaced with lowercase()/uppercase() (three files).

import kotlinx.metadata.jvm.Metadata
import kotlinx.metadata.jvm.signature
import org.objectweb.asm.tree.AnnotationNode

@fgaraba Flórián Garaba (fgaraba) Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This file is the only "non-mechanic" change in this PR, this should warrant a more thorough review.

It's necessary in order to make the test case pass (we test classes that are compiled by the project's kotlin compiler, so bumping the compiler version changes the test subject itself).

This may be a bit close coupling though, if you say so I can split it into a separate PR.

@fgaraba
Flórián Garaba (fgaraba) marked this pull request as ready for review July 31, 2026 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants