Skip to content

fix(compiler): Fix compatibility with Kotlin 2.3.0#1046

Merged
romtsn merged 2 commits intomainfrom
rz/fix/kotlin-230-compat
Dec 23, 2025
Merged

fix(compiler): Fix compatibility with Kotlin 2.3.0#1046
romtsn merged 2 commits intomainfrom
rz/fix/kotlin-230-compat

Conversation

@romtsn
Copy link
Copy Markdown
Member

@romtsn romtsn commented Dec 22, 2025

📜 Description

Specifies pluginId introduced in Kotlin 2.3.0 for CompilerPluginRegistrar

💡 Motivation and Context

Fixes #1042

💚 How did you test it?

Manually

📝 Checklist

  • I reviewed the submitted code
  • I added tests to verify the changes
  • I updated the docs if needed
  • No breaking changes

🔮 Next steps

override fun ExtensionStorage.registerExtensions(configuration: CompilerConfiguration) {
val messageCollector =
configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, MessageCollector.NONE)
val pluginId: String = PLUGIN_ID
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The SentryKotlinCompilerPlugin class is missing the override keyword for the pluginId property, which is required to implement the abstract property from CompilerPluginRegistrar in Kotlin 2.3.0.
Severity: CRITICAL | Confidence: High

🔍 Detailed Analysis

The SentryKotlinCompilerPlugin class implements CompilerPluginRegistrar, which in Kotlin 2.3.0 introduced a new abstract property pluginId. The implementation in SentryKotlinCompilerPlugin.kt defines pluginId but is missing the required override keyword. This will cause a compilation error, such as "Unimplemented abstract member," for any user compiling their project with Kotlin 2.3.0 or later. This prevents the compiler plugin from loading and breaks the build, despite the PR's goal of adding compatibility for this Kotlin version.

💡 Suggested Fix

Add the override keyword to the pluginId property in the SentryKotlinCompilerPlugin class. The line should be changed from val pluginId: String = PLUGIN_ID to override val pluginId: String = PLUGIN_ID to correctly implement the abstract property from the superclass.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location:
sentry-kotlin-compiler-plugin/src/main/kotlin/io/sentry/SentryKotlinCompilerPlugin.kt#L23

Potential issue: The `SentryKotlinCompilerPlugin` class implements
`CompilerPluginRegistrar`, which in Kotlin 2.3.0 introduced a new abstract property
`pluginId`. The implementation in `SentryKotlinCompilerPlugin.kt` defines `pluginId` but
is missing the required `override` keyword. This will cause a compilation error, such as
"Unimplemented abstract member," for any user compiling their project with Kotlin 2.3.0
or later. This prevents the compiler plugin from loading and breaks the build, despite
the PR's goal of adding compatibility for this Kotlin version.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 7832056

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Weird that this isn't a compile error if true.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah, this is true, but we have to compile against 2.3.0 for that and currently we're not doing that 😅 So we're tricking the compilation process here a bit, but at the "runtime" of the plugin it's present and not throwing.

I'm thinking compiling against 2.3.0 might break compatibility with older versions, so I decided to go for this middle-ground until we bump it later on.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ahh that makes sense!

Copy link
Copy Markdown
Contributor

@runningcode runningcode left a comment

Choose a reason for hiding this comment

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

Very nice!

Copy link
Copy Markdown
Member

@markushi markushi left a comment

Choose a reason for hiding this comment

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

🙏 thank you!

@romtsn romtsn merged commit 242dcbb into main Dec 23, 2025
18 checks passed
@romtsn romtsn deleted the rz/fix/kotlin-230-compat branch December 23, 2025 09:44
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.

Sentry Kotlin Compiler Plugin is incompatible with Kotlin 2.3.0

3 participants