mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[kotlin] invalidate LanguageVersionSettings on facet changes
^KTIJ-23779 Fixed GitOrigin-RevId: ff784bd7e196ef25247d8061a98d4d3b486be00d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d8271ffe8c
commit
9df0a18d3f
+2
@@ -35,6 +35,7 @@ import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
import org.jetbrains.kotlin.util.merge
|
||||
import java.util.*
|
||||
import org.jetbrains.kotlin.idea.compiler.configuration.KotlinCompilerSettingsListener
|
||||
import org.jetbrains.kotlin.idea.facet.KotlinFacetModificationTracker
|
||||
|
||||
private typealias LanguageFeatureMap = Map<LanguageFeature, LanguageFeature.State>
|
||||
private typealias AnalysisFlagMap = Map<AnalysisFlag<*>, Any>
|
||||
@@ -107,6 +108,7 @@ class LanguageVersionSettingsProvider(private val project: Project) : Disposable
|
||||
computeModuleLanguageVersionSettings(module),
|
||||
KotlinCompilerSettingsTracker.getInstance(project),
|
||||
ProjectRootModificationTracker.getInstance(project),
|
||||
KotlinFacetModificationTracker.getInstance(project),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+15
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.idea.compiler.configuration.Kotlin2JsCompilerArgumen
|
||||
import org.jetbrains.kotlin.idea.compiler.configuration.KotlinCommonCompilerArgumentsHolder
|
||||
import org.jetbrains.kotlin.idea.compiler.configuration.KotlinJpsPluginSettings
|
||||
import org.jetbrains.kotlin.idea.compiler.configuration.KotlinPluginLayout
|
||||
import org.jetbrains.kotlin.idea.facet.KotlinFacet
|
||||
import org.jetbrains.kotlin.idea.macros.KotlinBundledUsageDetector
|
||||
import org.jetbrains.kotlin.idea.macros.KotlinBundledUsageDetectorListener
|
||||
import org.jetbrains.kotlin.idea.notification.catchNotificationText
|
||||
@@ -146,6 +147,20 @@ class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinInTempDirTest() {
|
||||
assertEmpty(getCanBeConfiguredModules(myProject, jvmConfigurator))
|
||||
}
|
||||
|
||||
fun testModuleFacetChange() {
|
||||
val kotlinFacet = KotlinFacet.get(module)!!
|
||||
val languageVersionSettings = module.languageVersionSettings
|
||||
assertEquals(languageVersionSettings, module.languageVersionSettings)
|
||||
|
||||
runWriteAction {
|
||||
val model = FacetManager.getInstance(module).createModifiableModel()
|
||||
model.removeFacet(kotlinFacet)
|
||||
model.commit()
|
||||
}
|
||||
|
||||
assertFalse(languageVersionSettings == module.languageVersionSettings)
|
||||
}
|
||||
|
||||
fun testSimple() {
|
||||
assertNotConfigured(module, jvmConfigurator)
|
||||
jvmConfigurator.configure(myProject, emptyList())
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/module.iml" filepath="$PROJECT_DIR$/module.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="FacetManager">
|
||||
<facet type="kotlin-language" name="Kotlin">
|
||||
<configuration version="5" platform="JVM 17" allPlatforms="JVM [17]" useProjectSettings="false">
|
||||
<compilerSettings>
|
||||
<option name="additionalArguments" value="-Xjvm-default=all" />
|
||||
</compilerSettings>
|
||||
<compilerArguments>
|
||||
<stringArguments>
|
||||
<stringArg name="jvmTarget" arg="17" />
|
||||
<stringArg name="apiVersion" arg="1.7" />
|
||||
<stringArg name="languageVersion" arg="1.7" />
|
||||
</stringArguments>
|
||||
</compilerArguments>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
</module>
|
||||
Reference in New Issue
Block a user