Tweak module exclusion filter for -Xjvm-default=all
- Remove obsolete exclusion of core & stdlib modules, since they are now compiled with JVM target 1.8, but leave `:core:descriptors` because of an issue in Proguard. - Remove binary-compatibility-validator and update test data instead. - Replace some "contains" checks with equality for clarity. - Remove modules from -Werror filter which no longer use the deprecated compatibility mode.
This commit is contained in:
@@ -158,10 +158,6 @@ fun Project.configureKotlinCompilationOptions() {
|
||||
// TODO: fix remaining warnings and remove this property.
|
||||
val tasksWithWarnings = listOf(
|
||||
":kotlin-gradle-plugin:compileCommonKotlin",
|
||||
// Temporarily disable -Werror for the following modules because of deprecation warning for `-Xjvm-default=compatibility`.
|
||||
// These modules should be removed after they are migrated to `-Xjvm-default=all/all-compatibility`.
|
||||
":compiler:frontend:compileKotlin",
|
||||
":kotlin-scripting-intellij:compileKotlin",
|
||||
)
|
||||
|
||||
val projectsWithEnabledContextReceivers: List<String> by rootProject.extra
|
||||
@@ -190,23 +186,7 @@ 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")
|
||||
) {
|
||||
if (!skipJvmDefaultAllForModule(project.path)) {
|
||||
freeCompilerArgs += "-Xjvm-default=all"
|
||||
}
|
||||
}
|
||||
@@ -268,3 +248,18 @@ fun Project.configureTests() {
|
||||
apply(from = "$rootDir/gradle/testRetry.gradle.kts")
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: migrate remaining modules to the new JVM default scheme.
|
||||
fun skipJvmDefaultAllForModule(path: String): Boolean =
|
||||
// Gradle plugin modules are disabled because different Gradle versions bundle different Kotlin compilers,
|
||||
// and not all of them support the new JVM default scheme.
|
||||
"-gradle" in path || "-runtime" in path || path == ":kotlin-project-model" ||
|
||||
// Visitor/transformer interfaces in ir.tree are very sensitive to the way interface methods are implemented.
|
||||
// Enabling default method generation results in a performance loss of several % on full pipeline test on Kotlin.
|
||||
// TODO: investigate the performance difference and enable new mode for ir.tree.
|
||||
path == ":compiler:ir.tree" ||
|
||||
// Workaround a Proguard issue:
|
||||
// java.lang.IllegalAccessError: tried to access method kotlin.reflect.jvm.internal.impl.types.checker.ClassicTypeSystemContext$substitutionSupertypePolicy$2.<init>(
|
||||
// Lkotlin/reflect/jvm/internal/impl/types/checker/ClassicTypeSystemContext;Lkotlin/reflect/jvm/internal/impl/types/TypeSubstitutor;
|
||||
// )V from class kotlin.reflect.jvm.internal.impl.resolve.OverridingUtilTypeSystemContext
|
||||
path == ":core:descriptors"
|
||||
|
||||
-8
@@ -11,7 +11,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap;
|
||||
import org.jetbrains.kotlin.descriptors.SourceElement;
|
||||
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinaryClass;
|
||||
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader;
|
||||
import org.jetbrains.kotlin.load.kotlin.header.ReadKotlinClassHeaderAnnotationVisitor;
|
||||
import org.jetbrains.kotlin.name.ClassId;
|
||||
@@ -355,11 +354,4 @@ public abstract class FileBasedKotlinClass implements KotlinJvmBinaryClass {
|
||||
|
||||
@Override
|
||||
public abstract String toString();
|
||||
|
||||
// Declared explicitly to workaround KT-18489
|
||||
@Nullable
|
||||
@Override
|
||||
public String getContainingLibrary() {
|
||||
return KotlinJvmBinaryClass.DefaultImpls.getContainingLibrary(this);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-4
@@ -7,11 +7,8 @@ public class cases/default/ClassFunctions {
|
||||
|
||||
public abstract interface class cases/default/InterfaceFunctions {
|
||||
public abstract fun withAllDefaults (ILjava/lang/String;)V
|
||||
public abstract fun withSomeDefaults (ILjava/lang/String;)V
|
||||
}
|
||||
|
||||
public final class cases/default/InterfaceFunctions$DefaultImpls {
|
||||
public static synthetic fun withAllDefaults$default (Lcases/default/InterfaceFunctions;ILjava/lang/String;ILjava/lang/Object;)V
|
||||
public abstract fun withSomeDefaults (ILjava/lang/String;)V
|
||||
public static synthetic fun withSomeDefaults$default (Lcases/default/InterfaceFunctions;ILjava/lang/String;ILjava/lang/Object;)V
|
||||
}
|
||||
|
||||
|
||||
+2
-14
@@ -1,26 +1,14 @@
|
||||
public abstract interface class cases/interfaces/BaseWithImpl {
|
||||
public abstract fun foo ()I
|
||||
}
|
||||
|
||||
public final class cases/interfaces/BaseWithImpl$DefaultImpls {
|
||||
public static fun foo (Lcases/interfaces/BaseWithImpl;)I
|
||||
public fun foo ()I
|
||||
}
|
||||
|
||||
public abstract interface class cases/interfaces/DerivedWithImpl : cases/interfaces/BaseWithImpl {
|
||||
public abstract fun foo ()I
|
||||
}
|
||||
|
||||
public final class cases/interfaces/DerivedWithImpl$DefaultImpls {
|
||||
public static fun foo (Lcases/interfaces/DerivedWithImpl;)I
|
||||
public fun foo ()I
|
||||
}
|
||||
|
||||
public abstract interface class cases/interfaces/DerivedWithoutImpl : cases/interfaces/BaseWithImpl {
|
||||
}
|
||||
|
||||
public final class cases/interfaces/DerivedWithoutImpl$DefaultImpls {
|
||||
public static fun foo (Lcases/interfaces/DerivedWithoutImpl;)I
|
||||
}
|
||||
|
||||
public abstract interface class cases/interfaces/EmptyImpls {
|
||||
public abstract fun getProperty ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user