Skip to content

Commit c488086

Browse files
committed
Kotlin: Ensure the kotlin extractor is loaded as the last extension to be able to capture expansions from other extensions
1 parent cabcb83 commit c488086

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-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
}

0 commit comments

Comments
 (0)