Build compiler with -Xjvm-default=all + @JvmDefaultCompatibility when needed

This commit is contained in:
Mikhael Bogdanov
2021-12-08 10:05:41 +01:00
committed by Alexander Udalov
parent 61d339e8f2
commit c168a19a58
9 changed files with 22 additions and 33 deletions
@@ -190,6 +190,25 @@ fun Project.configureKotlinCompilationOptions() {
if (project.path in projectsWithEnabledContextReceivers) {
freeCompilerArgs += "-Xcontext-receivers"
}
//TODO: migrate modules to defaults
//TODO: different gradle versions bundle different Kotlin compilers, not all of them support defaults
if (!project.path.contains("-gradle") &&
!project.path.contains("kotlin-project-model") &&
!project.path.contains(":binary-compatibility-validator") &&
!project.path.contains("runtime") &&
//TODO: tune performance in tree and tree.impl modules
!project.path.contains(":compiler:ir.tree") &&
//HACK: filter modules with JVM target 1.6
//TODO: remove after removing 1.6 target
!project.path.startsWith(":core") &&
!project.path.startsWith(":kotlin-stdlib") &&
!project.path.startsWith(":kotlinx-metadata") &&
!project.path.startsWith(":kotlin-scripting") &&
!project.path.startsWith(":compiler:tests-common-jvm6")
) {
freeCompilerArgs += "-Xjvm-default=all"
}
}
}
}
-4
View File
@@ -24,8 +24,4 @@ dependencies {
sourceSets {
"main" { projectDefault() }
"test" {}
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += "-Xjvm-default=compatibility"
}
@@ -55,8 +55,6 @@ interface TypeResolutionInterceptorExtension {
@InternalNonStableExtensionPoints
interface CallResolutionInterceptorExtension {
@Suppress("DEPRECATION")
@JvmDefault
fun interceptResolvedCallAtomCandidate(
candidateDescriptor: CallableDescriptor,
completedCallAtom: ResolvedCallAtom,
@@ -65,8 +63,6 @@ interface CallResolutionInterceptorExtension {
diagnostics: Collection<KotlinCallDiagnostic>
): CallableDescriptor = candidateDescriptor
@Suppress("DEPRECATION")
@JvmDefault
fun interceptCandidates(
candidates: Collection<NewResolutionOldInference.MyCandidate>,
context: BasicCallResolutionContext,
@@ -77,8 +73,6 @@ interface CallResolutionInterceptorExtension {
tracing: TracingStrategy
): Collection<NewResolutionOldInference.MyCandidate> = candidates
@Suppress("DEPRECATION")
@JvmDefault
fun interceptFunctionCandidates(
candidates: Collection<FunctionDescriptor>,
scopeTower: ImplicitScopeTower,
@@ -89,8 +83,6 @@ interface CallResolutionInterceptorExtension {
location: LookupLocation
): Collection<FunctionDescriptor> = candidates
@Suppress("DEPRECATION")
@JvmDefault
fun interceptFunctionCandidates(
candidates: Collection<FunctionDescriptor>,
scopeTower: ImplicitScopeTower,
@@ -103,8 +95,6 @@ interface CallResolutionInterceptorExtension {
extensionReceiver: ReceiverValueWithSmartCastInfo?
): Collection<FunctionDescriptor> = candidates
@Suppress("DEPRECATION")
@JvmDefault
fun interceptVariableCandidates(
candidates: Collection<VariableDescriptor>,
scopeTower: ImplicitScopeTower,
@@ -115,8 +105,6 @@ interface CallResolutionInterceptorExtension {
location: LookupLocation
): Collection<VariableDescriptor> = candidates
@Suppress("DEPRECATION")
@JvmDefault
fun interceptVariableCandidates(
candidates: Collection<VariableDescriptor>,
scopeTower: ImplicitScopeTower,
@@ -144,8 +144,6 @@ interface SyntheticResolveExtension {
fun getSyntheticFunctionNames(thisDescriptor: ClassDescriptor): List<Name> = emptyList()
@Suppress("DEPRECATION")
@JvmDefault
fun getSyntheticPropertiesNames(thisDescriptor: ClassDescriptor): List<Name> = emptyList()
fun getSyntheticNestedClassNames(thisDescriptor: ClassDescriptor): List<Name> = emptyList()
@@ -155,8 +153,6 @@ interface SyntheticResolveExtension {
* or null in case it needs to run resolution and inference and/or it is very costly.
* Override this method if resolution started to fail with recursion.
*/
@Suppress("DEPRECATION")
@JvmDefault
fun getPossibleSyntheticNestedClassNames(thisDescriptor: ClassDescriptor): List<Name>? = getSyntheticNestedClassNames(thisDescriptor)
fun addSyntheticSupertypes(thisDescriptor: ClassDescriptor, supertypes: MutableList<KotlinType>) {}
-4
View File
@@ -15,8 +15,4 @@ sourceSets {
"test" {}
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += "-Xjvm-default=all-compatibility"
}
optInToExperimentalCompilerApi()
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.config.CompilerConfigurationKey
@ExperimentalCompilerApi
@JvmDefaultWithCompatibility
interface CommandLineProcessor {
val pluginId: String
val pluginOptions: Collection<AbstractCliOption>
@@ -83,12 +83,6 @@ public class KtImportDirective extends KtElementImplStub<KotlinImportDirectiveSt
return new ImportContent.ExpressionBased(reference);
}
@Nullable
@Override
public Name getImportedName() {
return KtImportInfo.DefaultImpls.getImportedName(this);
}
@Override
@Nullable
@IfNotParsed
@@ -25,5 +25,5 @@ publish()
standardPublicJars()
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += "-Xjvm-default=compatibility"
kotlinOptions.freeCompilerArgs += "-Xjvm-default=all"
}
@@ -23,6 +23,7 @@ import kotlin.script.experimental.host.ScriptingHostConfiguration
* may also remove or add new definitions at this point.
* Processed definitions are provided to the scripting support infrastructure.
*/
@JvmDefaultWithCompatibility
interface ScriptDefinitionsProvider {
/**
* A display name used to identify particular providers
@@ -48,8 +49,6 @@ interface ScriptDefinitionsProvider {
/**
* The callback to update/add/remove script definitions after loading, if needed
*/
@Suppress("DEPRECATION") // To be replaced with -Xjvm-default=all-compatibility.
@JvmDefault
fun provideDefinitions(
baseHostConfiguration: ScriptingHostConfiguration,
loadedScriptDefinitions: List<ScriptDefinition>