Skip to content

Commit 6c2d163

Browse files
committed
Kotlin 1.6.20
1 parent ba1b10f commit 6c2d163

File tree

9 files changed

+47
-31
lines changed

9 files changed

+47
-31
lines changed

.idea/.gitignore

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/codeStyles/Project.xml

+1-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

-6
This file was deleted.

build.gradle

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
buildscript {
22
ext.kotlin_version = '1.6.10'
3+
ext.embedded_kotlin_version = '1.6.20-dev-7317'//'1.6.20-M1-1.0.2'
34

45
repositories {
56
mavenCentral()
@@ -41,13 +42,14 @@ allprojects {
4142
mavenCentral()
4243
maven { url "https://plugins.gradle.org/m2/" }
4344
google()
45+
maven { url 'https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap' }
4446
}
4547
}
4648

4749
repositories {
4850
mavenCentral()
4951
google()
50-
jcenter()
52+
maven { url 'https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap' }
5153
}
5254

5355
apply plugin: 'kotlin'

core/build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ buildConfig {
1010
packageName = "com.tschuchort.compiletesting"
1111
sourceSets {
1212
test {
13-
buildConfigField 'String', 'KOTLIN_VERSION', "\"$kotlin_version\""
13+
buildConfigField 'String', 'KOTLIN_VERSION', "\"$embedded_kotlin_version\""
1414
}
1515
}
1616
}
@@ -28,15 +28,15 @@ dependencies {
2828

2929
// This dependency is only needed as a "sample" compiler plugin to test that
3030
// running compiler plugins passed via the pluginClasspath CLI option works
31-
testRuntimeOnly "org.jetbrains.kotlin:kotlin-scripting-compiler:$kotlin_version"
31+
testRuntimeOnly "org.jetbrains.kotlin:kotlin-scripting-compiler:$embedded_kotlin_version"
3232

3333
// Include Kotlin/JS standard library in test classpath for auto loading
3434
testRuntimeOnly "org.jetbrains.kotlin:kotlin-stdlib-js"
3535

3636
// The Kotlin compiler should be near the end of the list because its .jar file includes
3737
// an obsolete version of Guava
38-
api "org.jetbrains.kotlin:kotlin-compiler-embeddable:$kotlin_version"
39-
implementation "org.jetbrains.kotlin:kotlin-annotation-processing-embeddable:$kotlin_version"
38+
api "org.jetbrains.kotlin:kotlin-compiler-embeddable:$embedded_kotlin_version"
39+
implementation "org.jetbrains.kotlin:kotlin-annotation-processing-embeddable:$embedded_kotlin_version"
4040
}
4141

4242
compileKotlin {

core/src/main/kotlin/com/tschuchort/compiletesting/AbstractKotlinCompilation.kt

+14
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ import org.jetbrains.kotlin.cli.jvm.plugins.ServiceLoaderLite
1414
import org.jetbrains.kotlin.compiler.plugin.CommandLineProcessor
1515
import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar
1616
import org.jetbrains.kotlin.config.Services
17+
import org.jetbrains.kotlin.load.java.JvmAbi
1718
import java.io.File
1819
import java.io.OutputStream
1920
import java.io.PrintStream
21+
import java.lang.reflect.InvocationTargetException
22+
import java.lang.reflect.ReflectPermission
2023
import java.net.URI
2124
import java.nio.file.Files
2225
import java.nio.file.Paths
@@ -103,6 +106,17 @@ abstract class AbstractKotlinCompilation<A : CommonCompilerArguments> internal c
103106
// Directory for input source files
104107
protected val sourcesDir get() = workingDir.resolve("sources")
105108

109+
protected inline fun <reified T> CommonCompilerArguments.trySetDeprecatedOption(optionSimpleName: String, value: T) {
110+
try {
111+
this.javaClass.getMethod(JvmAbi.setterName(optionSimpleName), T::class.java).invoke(this, value)
112+
} catch (e: ReflectiveOperationException) {
113+
throw IllegalArgumentException(
114+
"The deprecated option $optionSimpleName is no longer available in the kotlin version you are using",
115+
e
116+
)
117+
}
118+
}
119+
106120
protected fun commonArguments(args: A, configuration: (args: A) -> Unit): A {
107121
args.pluginClasspaths = pluginClasspaths.map(File::getAbsolutePath).toTypedArray()
108122

core/src/main/kotlin/com/tschuchort/compiletesting/KotlinCompilation.kt

+22-8
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ class KotlinCompilation : AbstractKotlinCompilation<K2JVMCompilerArguments>() {
9292
var noParamAssertions: Boolean = false
9393

9494
/** Generate nullability assertions for non-null Java expressions */
95+
@Deprecated("Removed in latest Kotlin version")
9596
var strictJavaNullabilityAssertions: Boolean? = null
9697

9798
/** Disable optimizations */
@@ -103,6 +104,7 @@ class KotlinCompilation : AbstractKotlinCompilation<K2JVMCompilerArguments>() {
103104
*
104105
* {disable|enable}
105106
*/
107+
@Deprecated("Removed in latest Kotlin version")
106108
var constructorCallNormalizationMode: String? = null
107109

108110
/** Assert calls behaviour {always-enable|always-disable|jvm|legacy} */
@@ -118,7 +120,8 @@ class KotlinCompilation : AbstractKotlinCompilation<K2JVMCompilerArguments>() {
118120
var useTypeTable: Boolean = false
119121

120122
/** Allow Kotlin runtime libraries of incompatible versions in the classpath */
121-
var skipRuntimeVersionCheck: Boolean = false
123+
@Deprecated("Removed in latest Kotlin version")
124+
var skipRuntimeVersionCheck: Boolean? = null
122125

123126
/** Path to JSON file to dump Java to Kotlin declaration mappings */
124127
var declarationsOutputPath: File? = null
@@ -145,7 +148,8 @@ class KotlinCompilation : AbstractKotlinCompilation<K2JVMCompilerArguments>() {
145148
var supportCompatqualCheckerFrameworkAnnotations: String? = null
146149

147150
/** Do not throw NPE on explicit 'equals' call for null receiver of platform boxed primitive type */
148-
var noExceptionOnExplicitEqualsForBoxedNull: Boolean = false
151+
@Deprecated("Removed in latest Kotlin version")
152+
var noExceptionOnExplicitEqualsForBoxedNull: Boolean? = null
149153

150154
/** Allow to use '@JvmDefault' annotation for JVM default method support.
151155
* {disable|enable|compatibility}
@@ -328,13 +332,17 @@ class KotlinCompilation : AbstractKotlinCompilation<K2JVMCompilerArguments>() {
328332
args.noCallAssertions = noCallAssertions
329333
args.noParamAssertions = noParamAssertions
330334
args.noReceiverAssertions = noReceiverAssertions
331-
strictJavaNullabilityAssertions?.let {
332-
args.strictJavaNullabilityAssertions = it
333-
}
335+
336+
// TODO: Remove after kotlin 1.6.30
337+
if(strictJavaNullabilityAssertions != null)
338+
args.trySetDeprecatedOption("strictJavaNullabilityAssertions", strictJavaNullabilityAssertions)
339+
334340
args.noOptimize = noOptimize
335341

342+
// TODO: Remove after kotlin 1.6.30
336343
if(constructorCallNormalizationMode != null)
337-
args.constructorCallNormalizationMode = constructorCallNormalizationMode
344+
args.trySetDeprecatedOption("constructorCallNormalizationMode", constructorCallNormalizationMode)
345+
338346

339347
if(assertionsMode != null)
340348
args.assertionsMode = assertionsMode
@@ -366,8 +374,14 @@ class KotlinCompilation : AbstractKotlinCompilation<K2JVMCompilerArguments>() {
366374
if(scriptResolverEnvironment.isNotEmpty())
367375
args.scriptResolverEnvironment = scriptResolverEnvironment.map { (key, value) -> "$key=\"$value\"" }.toTypedArray()
368376

369-
args.noExceptionOnExplicitEqualsForBoxedNull = noExceptionOnExplicitEqualsForBoxedNull
370-
args.skipRuntimeVersionCheck = skipRuntimeVersionCheck
377+
// TODO: Remove after kotlin 1.6.30
378+
if(noExceptionOnExplicitEqualsForBoxedNull != null)
379+
args.trySetDeprecatedOption("noExceptionOnExplicitEqualsForBoxedNull", noExceptionOnExplicitEqualsForBoxedNull)
380+
381+
// TODO: Remove after kotlin 1.6.30
382+
if(skipRuntimeVersionCheck != null)
383+
args.trySetDeprecatedOption("skipRuntimeVersionCheck", skipRuntimeVersionCheck)
384+
371385
args.javaPackagePrefix = javaPackagePrefix
372386
args.suppressMissingBuiltinsError = suppressMissingBuiltinsError
373387
}

core/src/test/kotlin/com/tschuchort/compiletesting/TestUtils.kt

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import java.io.File
77
fun defaultCompilerConfig(): KotlinCompilation {
88
return KotlinCompilation( ).apply {
99
inheritClassPath = false
10-
skipRuntimeVersionCheck = true
1110
correctErrorTypes = true
1211
verbose = true
1312
reportOutputFiles = false

ksp/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
buildscript {
2-
ext.ksp_version='1.6.10-1.0.2'
2+
ext.ksp_version='1.6.20-M1-1.0.2'
33
}
44

55
dependencies {

0 commit comments

Comments
 (0)