Configuration: Collapse empty nullable strings to null

This commit is contained in:
Alexey Sedunov
2018-08-03 15:40:35 +03:00
parent db556d6551
commit abbac067b8
16 changed files with 124 additions and 33 deletions
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>
@@ -0,0 +1,3 @@
<component name="CopyrightManager">
<settings default="" />
</component>
@@ -0,0 +1,10 @@
<component name="libraryTable">
<library name="KotlinJavaRuntime">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/kotlin-runtime.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
</SOURCES>
</library>
</component>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
@@ -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,11 @@
<?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" />
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
</component>
</module>
@@ -22,6 +22,7 @@ import com.intellij.openapi.util.io.FileUtil
import org.jetbrains.kotlin.config.ApiVersion
import org.jetbrains.kotlin.config.KotlinFacetSettingsProvider
import org.jetbrains.kotlin.config.LanguageVersion
import org.jetbrains.kotlin.idea.compiler.configuration.Kotlin2JsCompilerArgumentsHolder
import org.jetbrains.kotlin.idea.compiler.configuration.KotlinCommonCompilerArgumentsHolder
import org.jetbrains.kotlin.idea.project.getLanguageVersionSettings
import org.jetbrains.kotlin.idea.project.languageVersionSettings
@@ -112,6 +113,17 @@ open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinInTempDirTest()
Assert.assertEquals(ApiVersion.KOTLIN_1_1, settings.apiVersion)
}
fun testNoKotlincExistsNoSettingsLatestRuntimeNullizeEmptyStrings() {
val application = ApplicationManager.getApplication() as ApplicationImpl
application.isSaveAllowed = true
Kotlin2JsCompilerArgumentsHolder.getInstance(project).update {
sourceMapPrefix = ""
sourceMapEmbedSources = ""
}
application.saveAll()
Assert.assertTrue(project.baseDir.findFileByRelativePath(".idea/kotlinc.xml") == null)
}
//todo[Sedunov]: wait for fix in platform to avoid misunderstood from Java newbies (also PluginStartupComponent)
/*fun testKotlinSdkAdded() {
Assert.assertTrue(ProjectJdkTable.getInstance().allJdks.any { it.sdkType is KotlinSdkType })
@@ -109,6 +109,17 @@ open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinInTempDirTest()
Assert.assertEquals(ApiVersion.KOTLIN_1_1, settings.apiVersion)
}
fun testNoKotlincExistsNoSettingsLatestRuntimeNullizeEmptyStrings() {
val application = ApplicationManager.getApplication() as ApplicationImpl
application.doNotSave(false)
Kotlin2JsCompilerArgumentsHolder.getInstance(project).update {
sourceMapPrefix = ""
sourceMapEmbedSources = ""
}
application.saveAll()
Assert.assertTrue(project.baseDir.findFileByRelativePath(".idea/kotlinc.xml") == null)
}
//todo[Sedunov]: wait for fix in platform to avoid misunderstood from Java newbies (also PluginStartupComponent)
/*fun testKotlinSdkAdded() {
Assert.assertTrue(ProjectJdkTable.getInstance().allJdks.any { it.sdkType is KotlinSdkType })