Skip to content

Commit f4edff9

Browse files
Merge pull request #21216 from github/andersfugmann/kotlin_extractor_load_last
Kotlin: Load kotlin extractor last
2 parents 2214a94 + 73850f1 commit f4edff9

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

java/kotlin-extractor/src/main/kotlin/KotlinExtractorComponentRegistrar.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package com.github.codeql
55

66
import com.intellij.mock.MockProject
7+
import com.intellij.openapi.extensions.LoadingOrder
78
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
89
import org.jetbrains.kotlin.config.CompilerConfiguration
910

@@ -16,14 +17,18 @@ class KotlinExtractorComponentRegistrar : Kotlin2ComponentRegistrar() {
1617
if (invocationTrapFile == null) {
1718
throw Exception("Required argument for TRAP invocation file not given")
1819
}
19-
IrGenerationExtension.registerExtension(
20-
project,
20+
// Register with LoadingOrder.LAST to ensure the extractor runs after other
21+
// IR generation plugins (like kotlinx.serialization) have generated their code.
22+
val extensionPoint = project.extensionArea.getExtensionPoint(IrGenerationExtension.extensionPointName)
23+
extensionPoint.registerExtension(
2124
KotlinExtractorExtension(
2225
invocationTrapFile,
2326
configuration[KEY_CHECK_TRAP_IDENTICAL] ?: false,
2427
configuration[KEY_COMPILATION_STARTTIME],
2528
configuration[KEY_EXIT_AFTER_EXTRACTION] ?: false
26-
)
29+
),
30+
LoadingOrder.LAST,
31+
project
2732
)
2833
}
2934
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: fix
3+
---
4+
* Kotlin: The Kotlin extractor now registers as the last IR generation extension, ensuring that code generated by other compiler plugins (such as kotlinx.serialization) is correctly captured.

0 commit comments

Comments
 (0)