kotlin: use new reflection-less functions to work with compiler arguments

see 7480befe32

GitOrigin-RevId: 2f2bd2ef343ff92d1df8f44c5ccda6994f97e554
This commit is contained in:
Leonid Shalupov
2023-04-05 16:53:13 +02:00
committed by intellij-monorepo-bot
parent 216d5ed19e
commit a16b24fc6d
3 changed files with 24 additions and 10 deletions

View File

@@ -13,6 +13,8 @@ import com.intellij.util.containers.ContainerUtil
import org.jetbrains.kotlin.assignment.plugin.AssignmentPluginNames.ANNOTATION_OPTION_NAME
import org.jetbrains.kotlin.assignment.plugin.AssignmentPluginNames.PLUGIN_ID
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
import org.jetbrains.kotlin.cli.common.arguments.Freezable
import org.jetbrains.kotlin.cli.common.arguments.copyCommonCompilerArguments
import org.jetbrains.kotlin.cli.common.arguments.parseCommandLineArguments
import org.jetbrains.kotlin.idea.compilerPlugin.CachedAnnotationNames
import org.jetbrains.kotlin.psi.KtFile
@@ -73,7 +75,11 @@ internal class AssignmentAnnotationNamesCache(project: Project) {
}
private fun ScriptDefinition.getSpecialAnnotations(annotationPrefix: String): List<String> {
val arguments = object : CommonCompilerArguments() {}
class CommonCompilerArgumentsHolder: CommonCompilerArguments() {
override fun copyOf(): Freezable = copyCommonCompilerArguments(this, CommonCompilerArgumentsHolder())
}
val arguments = CommonCompilerArgumentsHolder()
parseCommandLineArguments(compilerOptions.toList(), arguments)
return arguments.pluginOptions
?.filter { it.startsWith(annotationPrefix) }