Introduce Kotlin language version 1.2
Wherein DEFAULT version is still 1.1, which means that version 1.2 should be configured manually
This commit is contained in:
@@ -61,8 +61,8 @@ data class JvmBuildMetaInfo(
|
|||||||
fun JvmBuildMetaInfo(args: CommonCompilerArguments): JvmBuildMetaInfo =
|
fun JvmBuildMetaInfo(args: CommonCompilerArguments): JvmBuildMetaInfo =
|
||||||
JvmBuildMetaInfo(isEAP = KotlinCompilerVersion.isPreRelease(),
|
JvmBuildMetaInfo(isEAP = KotlinCompilerVersion.isPreRelease(),
|
||||||
compilerBuildVersion = KotlinCompilerVersion.VERSION,
|
compilerBuildVersion = KotlinCompilerVersion.VERSION,
|
||||||
languageVersionString = args.languageVersion ?: LanguageVersion.LATEST.versionString,
|
languageVersionString = args.languageVersion ?: LanguageVersion.LATEST_STABLE.versionString,
|
||||||
apiVersionString = args.apiVersion ?: ApiVersion.LATEST.versionString,
|
apiVersionString = args.apiVersion ?: ApiVersion.LATEST_STABLE.versionString,
|
||||||
coroutinesEnable = args.coroutinesEnable,
|
coroutinesEnable = args.coroutinesEnable,
|
||||||
coroutinesWarn = args.coroutinesWarn,
|
coroutinesWarn = args.coroutinesWarn,
|
||||||
coroutinesError = args.coroutinesError,
|
coroutinesError = args.coroutinesError,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2015 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -37,7 +37,7 @@ fun writeKotlinMetadata(
|
|||||||
av.visit(JvmAnnotationNames.BYTECODE_VERSION_FIELD_NAME, JvmBytecodeBinaryVersion.INSTANCE.toArray())
|
av.visit(JvmAnnotationNames.BYTECODE_VERSION_FIELD_NAME, JvmBytecodeBinaryVersion.INSTANCE.toArray())
|
||||||
av.visit(JvmAnnotationNames.KIND_FIELD_NAME, kind.id)
|
av.visit(JvmAnnotationNames.KIND_FIELD_NAME, kind.id)
|
||||||
var flags = extraFlags
|
var flags = extraFlags
|
||||||
if (KotlinCompilerVersion.isPreRelease() && state.languageVersionSettings.languageVersion == LanguageVersion.LATEST) {
|
if (KotlinCompilerVersion.isPreRelease() && state.languageVersionSettings.languageVersion == LanguageVersion.LATEST_STABLE) {
|
||||||
flags = flags or JvmAnnotationNames.METADATA_PRE_RELEASE_FLAG
|
flags = flags or JvmAnnotationNames.METADATA_PRE_RELEASE_FLAG
|
||||||
}
|
}
|
||||||
if (flags != 0) {
|
if (flags != 0) {
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2016 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -29,7 +29,7 @@ open class DefaultValues(val defaultValue: String, val possibleValues: List<Stri
|
|||||||
object StringNullDefault : DefaultValues("null")
|
object StringNullDefault : DefaultValues("null")
|
||||||
|
|
||||||
object LanguageVersions : DefaultValues(
|
object LanguageVersions : DefaultValues(
|
||||||
"\"" + LanguageVersion.LATEST.versionString + "\"",
|
"\"" + LanguageVersion.LATEST_STABLE.versionString + "\"",
|
||||||
LanguageVersion.values().map { "\"${it.versionString}\"" }
|
LanguageVersion.values().map { "\"${it.versionString}\"" }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2016 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -231,8 +231,8 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> {
|
|||||||
LanguageVersion apiVersion = parseVersion(configuration, arguments.apiVersion, "API");
|
LanguageVersion apiVersion = parseVersion(configuration, arguments.apiVersion, "API");
|
||||||
|
|
||||||
if (languageVersion == null) {
|
if (languageVersion == null) {
|
||||||
// If only "-api-version" is specified, language version is assumed to be the latest
|
// If only "-api-version" is specified, language version is assumed to be the latest stable
|
||||||
languageVersion = LanguageVersion.LATEST;
|
languageVersion = LanguageVersion.LATEST_STABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (apiVersion == null) {
|
if (apiVersion == null) {
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2016 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -199,10 +199,10 @@ object JvmRuntimeVersionsConsistencyChecker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun checkNotNewerThanCompiler(messageCollector: MessageCollector, jar: KotlinLibraryFile): Boolean {
|
private fun checkNotNewerThanCompiler(messageCollector: MessageCollector, jar: KotlinLibraryFile): Boolean {
|
||||||
if (jar.version > ApiVersion.LATEST.version) {
|
if (jar.version > ApiVersion.LATEST_STABLE.version) {
|
||||||
messageCollector.issue(
|
messageCollector.issue(
|
||||||
jar.file,
|
jar.file,
|
||||||
"Runtime JAR file has version ${jar.version} which is newer than compiler version ${ApiVersion.LATEST.version}",
|
"Runtime JAR file has version ${jar.version} which is newer than compiler version ${ApiVersion.LATEST_STABLE.version}",
|
||||||
CompilerMessageSeverity.ERROR
|
CompilerMessageSeverity.ERROR
|
||||||
)
|
)
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2016 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -52,7 +52,7 @@ open class KotlinJvmReplService(
|
|||||||
addJvmClasspathRoots(PathUtil.getKotlinPathsForCompiler().let { listOf(it.runtimePath, it.reflectPath, it.scriptRuntimePath) })
|
addJvmClasspathRoots(PathUtil.getKotlinPathsForCompiler().let { listOf(it.runtimePath, it.reflectPath, it.scriptRuntimePath) })
|
||||||
addJvmClasspathRoots(templateClasspath)
|
addJvmClasspathRoots(templateClasspath)
|
||||||
put(CommonConfigurationKeys.MODULE_NAME, "kotlin-script")
|
put(CommonConfigurationKeys.MODULE_NAME, "kotlin-script")
|
||||||
languageVersionSettings = LanguageVersionSettingsImpl(LanguageVersion.LATEST, ApiVersion.LATEST).apply {
|
languageVersionSettings = LanguageVersionSettingsImpl(LanguageVersion.LATEST_STABLE, ApiVersion.LATEST_STABLE).apply {
|
||||||
switchFlag(AnalysisFlags.skipMetadataVersionCheck, true)
|
switchFlag(AnalysisFlags.skipMetadataVersionCheck, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2016 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -49,7 +49,7 @@ import org.jetbrains.kotlin.serialization.deserialization.MetadataPackageFragmen
|
|||||||
*/
|
*/
|
||||||
object DefaultAnalyzerFacade : AnalyzerFacade<PlatformAnalysisParameters>() {
|
object DefaultAnalyzerFacade : AnalyzerFacade<PlatformAnalysisParameters>() {
|
||||||
private val languageVersionSettings = LanguageVersionSettingsImpl(
|
private val languageVersionSettings = LanguageVersionSettingsImpl(
|
||||||
LanguageVersion.LATEST, ApiVersion.LATEST,
|
LanguageVersion.LATEST_STABLE, ApiVersion.LATEST_STABLE,
|
||||||
specificFeatures = mapOf(LanguageFeature.MultiPlatformProjects to LanguageFeature.State.ENABLED)
|
specificFeatures = mapOf(LanguageFeature.MultiPlatformProjects to LanguageFeature.State.ENABLED)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
error: unknown API version: 239.42
|
error: unknown API version: 239.42
|
||||||
Supported API versions: 1.0, 1.1
|
Supported API versions: 1.0, 1.1, 1.2
|
||||||
COMPILATION_ERROR
|
COMPILATION_ERROR
|
||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
error: unknown language version: 239.42
|
error: unknown language version: 239.42
|
||||||
Supported language versions: 1.0, 1.1
|
Supported language versions: 1.0, 1.1, 1.2
|
||||||
COMPILATION_ERROR
|
COMPILATION_ERROR
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2016 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -314,12 +314,12 @@ abstract class BaseDiagnosticsTest : KotlinMultiFileTestWithJava<TestModule, Tes
|
|||||||
val languageVersionDirective = directiveMap[LANGUAGE_VERSION]
|
val languageVersionDirective = directiveMap[LANGUAGE_VERSION]
|
||||||
if (apiVersionString == null && directives == null && languageVersionDirective == null) return null
|
if (apiVersionString == null && directives == null && languageVersionDirective == null) return null
|
||||||
|
|
||||||
val apiVersion = (if (apiVersionString != null) ApiVersion.parse(apiVersionString) else ApiVersion.LATEST)
|
val apiVersion = (if (apiVersionString != null) ApiVersion.parse(apiVersionString) else ApiVersion.LATEST_STABLE)
|
||||||
?: error("Unknown API version: $apiVersionString")
|
?: error("Unknown API version: $apiVersionString")
|
||||||
|
|
||||||
val languageFeatures = directives?.let(this::collectLanguageFeatureMap).orEmpty()
|
val languageFeatures = directives?.let(this::collectLanguageFeatureMap).orEmpty()
|
||||||
|
|
||||||
val languageVersion: LanguageVersion = languageVersionDirective?.let { LanguageVersion.fromVersionString(it) } ?: LanguageVersion.LATEST
|
val languageVersion: LanguageVersion = languageVersionDirective?.let { LanguageVersion.fromVersionString(it) } ?: LanguageVersion.LATEST_STABLE
|
||||||
|
|
||||||
return DiagnosticTestLanguageVersionSettings(languageFeatures, apiVersion, languageVersion)
|
return DiagnosticTestLanguageVersionSettings(languageFeatures, apiVersion, languageVersion)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2015 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class KotlinVersionsTest : KtUsefulTestCase() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
versions.add(
|
versions.add(
|
||||||
LanguageVersion.LATEST.versionString.toVersion("LanguageVersion.LATEST")
|
LanguageVersion.LATEST_STABLE.versionString.toVersion("LanguageVersion.LATEST_STABLE")
|
||||||
)
|
)
|
||||||
|
|
||||||
if (versions.any { v1 -> versions.any { v2 -> !v1.isConsistentWith(v2) } }) {
|
if (versions.any { v1 -> versions.any { v2 -> !v1.isConsistentWith(v2) } }) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2016 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -41,7 +41,10 @@ class ApiVersion private constructor(
|
|||||||
val KOTLIN_1_1 = createByLanguageVersion(LanguageVersion.KOTLIN_1_1)
|
val KOTLIN_1_1 = createByLanguageVersion(LanguageVersion.KOTLIN_1_1)
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
val LATEST: ApiVersion = createByLanguageVersion(LanguageVersion.LATEST)
|
val KOTLIN_1_2 = createByLanguageVersion(LanguageVersion.KOTLIN_1_2)
|
||||||
|
|
||||||
|
@JvmField
|
||||||
|
val LATEST_STABLE: ApiVersion = createByLanguageVersion(LanguageVersion.LATEST_STABLE)
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun createByLanguageVersion(version: LanguageVersion): ApiVersion = parse(version.versionString)!!
|
fun createByLanguageVersion(version: LanguageVersion): ApiVersion = parse(version.versionString)!!
|
||||||
|
|||||||
@@ -79,13 +79,14 @@ enum class LanguageFeature(
|
|||||||
|
|
||||||
enum class LanguageVersion(val major: Int, val minor: Int) : DescriptionAware {
|
enum class LanguageVersion(val major: Int, val minor: Int) : DescriptionAware {
|
||||||
KOTLIN_1_0(1, 0),
|
KOTLIN_1_0(1, 0),
|
||||||
KOTLIN_1_1(1, 1);
|
KOTLIN_1_1(1, 1),
|
||||||
|
KOTLIN_1_2(1, 2);
|
||||||
|
|
||||||
val versionString: String
|
val versionString: String
|
||||||
get() = "$major.$minor"
|
get() = "$major.$minor"
|
||||||
|
|
||||||
override val description: String
|
override val description: String
|
||||||
get() = versionString
|
get() = if (this > LATEST_STABLE) "$versionString (EXPERIMENTAL)" else versionString
|
||||||
|
|
||||||
override fun toString() = versionString
|
override fun toString() = versionString
|
||||||
|
|
||||||
@@ -97,7 +98,7 @@ enum class LanguageVersion(val major: Int, val minor: Int) : DescriptionAware {
|
|||||||
fun fromFullVersionString(str: String) = str.split(".", "-").let { if (it.size >= 2) fromVersionString("${it[0]}.${it[1]}") else null }
|
fun fromFullVersionString(str: String) = str.split(".", "-").let { if (it.size >= 2) fromVersionString("${it[0]}.${it[1]}") else null }
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
val LATEST = values().last()
|
val LATEST_STABLE = KOTLIN_1_1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,6 +159,6 @@ class LanguageVersionSettingsImpl @JvmOverloads constructor(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@JvmField
|
@JvmField
|
||||||
val DEFAULT = LanguageVersionSettingsImpl(LanguageVersion.LATEST, ApiVersion.LATEST)
|
val DEFAULT = LanguageVersionSettingsImpl(LanguageVersion.LATEST_STABLE, ApiVersion.LATEST_STABLE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2016 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2016 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -58,7 +58,7 @@ class KotlinCommonCompilerArgumentsHolder : BaseKotlinCompilerSettings<CommonCom
|
|||||||
override fun createSettings() = CommonCompilerArguments.createDefaultInstance()
|
override fun createSettings() = CommonCompilerArguments.createDefaultInstance()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val DEFAULT_LANGUAGE_VERSION = LanguageVersion.LATEST.versionString
|
private val DEFAULT_LANGUAGE_VERSION = LanguageVersion.LATEST_STABLE.versionString
|
||||||
|
|
||||||
fun getInstance(project: Project) =
|
fun getInstance(project: Project) =
|
||||||
ServiceManager.getService<KotlinCommonCompilerArgumentsHolder>(project, KotlinCommonCompilerArgumentsHolder::class.java)!!
|
ServiceManager.getService<KotlinCommonCompilerArgumentsHolder>(project, KotlinCommonCompilerArgumentsHolder::class.java)!!
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import com.intellij.openapi.extensions.ExtensionPointName
|
|||||||
import com.intellij.openapi.module.Module
|
import com.intellij.openapi.module.Module
|
||||||
import com.intellij.openapi.roots.ModuleRootModel
|
import com.intellij.openapi.roots.ModuleRootModel
|
||||||
import com.intellij.util.text.VersionComparatorUtil
|
import com.intellij.util.text.VersionComparatorUtil
|
||||||
import org.jetbrains.kotlin.config.JvmTarget
|
|
||||||
import org.jetbrains.kotlin.config.KotlinFacetSettingsProvider
|
import org.jetbrains.kotlin.config.KotlinFacetSettingsProvider
|
||||||
import org.jetbrains.kotlin.config.LanguageVersion
|
import org.jetbrains.kotlin.config.LanguageVersion
|
||||||
import org.jetbrains.kotlin.config.TargetPlatformKind
|
import org.jetbrains.kotlin.config.TargetPlatformKind
|
||||||
@@ -67,10 +66,12 @@ fun getDefaultLanguageLevel(
|
|||||||
?: KotlinVersionInfoProvider.EP_NAME.extensions
|
?: KotlinVersionInfoProvider.EP_NAME.extensions
|
||||||
.mapNotNull { it.getCompilerVersion(module) }
|
.mapNotNull { it.getCompilerVersion(module) }
|
||||||
.minWith(VersionComparatorUtil.COMPARATOR)
|
.minWith(VersionComparatorUtil.COMPARATOR)
|
||||||
?: return LanguageVersion.LATEST
|
?: return LanguageVersion.LATEST_STABLE
|
||||||
return when {
|
return when {
|
||||||
|
libVersion.startsWith("1.2") -> LanguageVersion.KOTLIN_1_2
|
||||||
|
libVersion.startsWith("1.1") -> LanguageVersion.KOTLIN_1_1
|
||||||
libVersion.startsWith("1.0") -> LanguageVersion.KOTLIN_1_0
|
libVersion.startsWith("1.0") -> LanguageVersion.KOTLIN_1_0
|
||||||
else -> LanguageVersion.KOTLIN_1_1
|
else -> LanguageVersion.LATEST_STABLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2016 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -77,7 +77,7 @@ fun Project.getLanguageVersionSettings(contextModule: Module? = null): LanguageV
|
|||||||
val languageVersion =
|
val languageVersion =
|
||||||
LanguageVersion.fromVersionString(arguments.languageVersion)
|
LanguageVersion.fromVersionString(arguments.languageVersion)
|
||||||
?: contextModule?.getAndCacheLanguageLevelByDependencies()
|
?: contextModule?.getAndCacheLanguageLevelByDependencies()
|
||||||
?: LanguageVersion.LATEST
|
?: LanguageVersion.LATEST_STABLE
|
||||||
val apiVersion = ApiVersion.createByLanguageVersion(LanguageVersion.fromVersionString(arguments.apiVersion) ?: languageVersion)
|
val apiVersion = ApiVersion.createByLanguageVersion(LanguageVersion.fromVersionString(arguments.apiVersion) ?: languageVersion)
|
||||||
val compilerSettings = KotlinCompilerSettings.getInstance(this).settings
|
val compilerSettings = KotlinCompilerSettings.getInstance(this).settings
|
||||||
val extraLanguageFeatures = getExtraLanguageFeatures(
|
val extraLanguageFeatures = getExtraLanguageFeatures(
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2016 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -146,7 +146,7 @@ class KotlinMavenImporter : MavenImporter(KOTLIN_PLUGIN_GROUP_ID, KOTLIN_PLUGIN_
|
|||||||
|
|
||||||
private fun configureFacet(mavenProject: MavenProject, modifiableModelsProvider: IdeModifiableModelsProvider, module: Module) {
|
private fun configureFacet(mavenProject: MavenProject, modifiableModelsProvider: IdeModifiableModelsProvider, module: Module) {
|
||||||
val mavenPlugin = mavenProject.findPlugin(KotlinMavenConfigurator.GROUP_ID, KotlinMavenConfigurator.MAVEN_PLUGIN_ID) ?: return
|
val mavenPlugin = mavenProject.findPlugin(KotlinMavenConfigurator.GROUP_ID, KotlinMavenConfigurator.MAVEN_PLUGIN_ID) ?: return
|
||||||
val compilerVersion = mavenPlugin.version ?: LanguageVersion.LATEST.versionString
|
val compilerVersion = mavenPlugin.version ?: LanguageVersion.LATEST_STABLE.versionString
|
||||||
val kotlinFacet = module.getOrCreateFacet(modifiableModelsProvider, false)
|
val kotlinFacet = module.getOrCreateFacet(modifiableModelsProvider, false)
|
||||||
val platform = detectPlatformByExecutions(mavenProject) ?: detectPlatformByLibraries(mavenProject)
|
val platform = detectPlatformByExecutions(mavenProject) ?: detectPlatformByLibraries(mavenProject)
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2016 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -272,7 +272,7 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String getLanguageVersionOrDefault(@Nullable String languageVersion) {
|
private static String getLanguageVersionOrDefault(@Nullable String languageVersion) {
|
||||||
return languageVersion != null ? languageVersion : LanguageVersion.LATEST.getVersionString();
|
return languageVersion != null ? languageVersion : LanguageVersion.LATEST_STABLE.getVersionString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setupFileChooser(
|
private static void setupFileChooser(
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ fun KotlinFacet.configureFacet(
|
|||||||
compilerArguments = null
|
compilerArguments = null
|
||||||
compilerSettings = null
|
compilerSettings = null
|
||||||
initializeIfNeeded(module, modelsProvider.getModifiableRootModel(module), platformKind)
|
initializeIfNeeded(module, modelsProvider.getModifiableRootModel(module), platformKind)
|
||||||
languageLevel = LanguageVersion.fromFullVersionString(compilerVersion) ?: LanguageVersion.LATEST
|
languageLevel = LanguageVersion.fromFullVersionString(compilerVersion) ?: LanguageVersion.LATEST_STABLE
|
||||||
// Both apiLevel and languageLevel should be initialized in the lines above
|
// Both apiLevel and languageLevel should be initialized in the lines above
|
||||||
if (apiLevel!! > languageLevel!!) {
|
if (apiLevel!! > languageLevel!!) {
|
||||||
apiLevel = languageLevel
|
apiLevel = languageLevel
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2016 JetBrains s.r.o.
|
* Copyright 2010-2017 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -55,7 +55,7 @@ sealed class EnableUnsupportedFeatureFix(
|
|||||||
override fun getText() = if (apiVersionOnly)
|
override fun getText() = if (apiVersionOnly)
|
||||||
"Set module API version to ${feature.sinceApiVersion.versionString}"
|
"Set module API version to ${feature.sinceApiVersion.versionString}"
|
||||||
else
|
else
|
||||||
"Set module language version to ${feature.sinceVersion!!.versionString}"
|
"Set module language version to ${feature.sinceVersion!!.description}"
|
||||||
|
|
||||||
override fun invoke(project: Project, editor: Editor?, file: KtFile) {
|
override fun invoke(project: Project, editor: Editor?, file: KtFile) {
|
||||||
val module = ModuleUtilCore.findModuleForPsiElement(file) ?: return
|
val module = ModuleUtilCore.findModuleForPsiElement(file) ?: return
|
||||||
|
|||||||
+2
-2
@@ -6,14 +6,14 @@ interface KotlinCommonOptions {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow to use declarations only from the specified version of bundled libraries
|
* Allow to use declarations only from the specified version of bundled libraries
|
||||||
* Possible values: "1.0", "1.1"
|
* Possible values: "1.0", "1.1", "1.2"
|
||||||
* Default value: "1.1"
|
* Default value: "1.1"
|
||||||
*/
|
*/
|
||||||
var apiVersion: kotlin.String
|
var apiVersion: kotlin.String
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide source compatibility with specified language version
|
* Provide source compatibility with specified language version
|
||||||
* Possible values: "1.0", "1.1"
|
* Possible values: "1.0", "1.1", "1.2"
|
||||||
* Default value: "1.1"
|
* Default value: "1.1"
|
||||||
*/
|
*/
|
||||||
var languageVersion: kotlin.String
|
var languageVersion: kotlin.String
|
||||||
|
|||||||
Reference in New Issue
Block a user