Replace DATA_CLASS_COPY_VISIBILITY_WILL_BE_CHANGED_WARNING suppress with -Xconsistent-data-class-copy-visibility
Review: https://jetbrains.team/p/kt/reviews/15461/timeline
The bootstrap has happened. Now the compiler flag is available
diff --git a/compiler/cli/cli-common/build.gradle.kts b/compiler/cli/cli-common/build.gradle.kts
index 665f7ce..4777b195 100644
--- a/compiler/cli/cli-common/build.gradle.kts
+++ b/compiler/cli/cli-common/build.gradle.kts
@@ -1,3 +1,5 @@
+import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
+
plugins {
kotlin("jvm")
id("jps-compatible")
@@ -31,3 +33,7 @@
//excludes unused bunch files
exclude("META-INF/extensions/*.xml.**")
}
+
+tasks.withType<KotlinJvmCompile>().configureEach {
+ compilerOptions.freeCompilerArgs.add("-Xconsistent-data-class-copy-visibility")
+}
diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/messages/CompilerMessageLocation.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/messages/CompilerMessageLocation.kt
index 96663ec..6763f1e 100644
--- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/messages/CompilerMessageLocation.kt
+++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/messages/CompilerMessageLocation.kt
@@ -29,8 +29,6 @@
val lineContent: String? // related to the (start) line/column only, used to show start position in the console output
}
-// todo: replace suppress with @ConsistentCopyVisibility annotation after bootstrap
-@Suppress("DATA_CLASS_COPY_VISIBILITY_WILL_BE_CHANGED_WARNING")
data class CompilerMessageLocation private constructor(
override val path: String,
override val line: Int,
@@ -53,8 +51,6 @@
}
}
-// todo: replace suppress with @ConsistentCopyVisibility annotation after bootstrap
-@Suppress("DATA_CLASS_COPY_VISIBILITY_WILL_BE_CHANGED_WARNING")
data class CompilerMessageLocationWithRange private constructor(
override val path: String,
override val line: Int,
diff --git a/compiler/frontend/build.gradle.kts b/compiler/frontend/build.gradle.kts
index 1e82e36..f967af1 100644
--- a/compiler/frontend/build.gradle.kts
+++ b/compiler/frontend/build.gradle.kts
@@ -1,3 +1,5 @@
+import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
+
plugins {
kotlin("jvm")
id("jps-compatible")
@@ -24,4 +26,8 @@
sourceSets {
"main" { projectDefault() }
"test" {}
-}
\ No newline at end of file
+}
+
+tasks.withType<KotlinJvmCompile>().configureEach {
+ compilerOptions.freeCompilerArgs.add("-Xconsistent-data-class-copy-visibility")
+}
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallExpressionUnroller.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallExpressionUnroller.kt
index 314cb46..4de054c 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallExpressionUnroller.kt
+++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallExpressionUnroller.kt
@@ -38,8 +38,6 @@
return unrolled.asReversed()
}
-// todo: replace suppress with @ConsistentCopyVisibility annotation after bootstrap
-@Suppress("DATA_CLASS_COPY_VISIBILITY_WILL_BE_CHANGED_WARNING")
data class CallExpressionElement internal constructor(val qualified: KtQualifiedExpression) {
val receiver: KtExpression
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/ExplicitSmartCasts.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/ExplicitSmartCasts.kt
index 497dd23..e17639c 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/ExplicitSmartCasts.kt
+++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/ExplicitSmartCasts.kt
@@ -37,8 +37,6 @@
else MultipleSmartCasts(mapOf(call to type, smartCast.call to smartCast.type))
}
-// todo: replace suppress with @ConsistentCopyVisibility annotation after bootstrap
-@Suppress("DATA_CLASS_COPY_VISIBILITY_WILL_BE_CHANGED_WARNING")
data class MultipleSmartCasts internal constructor(val map: Map<Call?, KotlinType>) : ExplicitSmartCasts {
override fun type(call: Call?) = map[call]
diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/ImplicitSmartCasts.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/ImplicitSmartCasts.kt
index b50db1d..3ecea14 100644
--- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/ImplicitSmartCasts.kt
+++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/ImplicitSmartCasts.kt
@@ -19,8 +19,6 @@
import org.jetbrains.kotlin.resolve.scopes.receivers.ImplicitReceiver
import org.jetbrains.kotlin.types.KotlinType
-// todo: replace suppress with @ConsistentCopyVisibility annotation after bootstrap
-@Suppress("DATA_CLASS_COPY_VISIBILITY_WILL_BE_CHANGED_WARNING")
data class ImplicitSmartCasts private constructor(val receiverTypes: Map<ImplicitReceiver, KotlinType>) {
operator fun plus(other: ImplicitSmartCasts) = ImplicitSmartCasts(receiverTypes + other.receiverTypes)
diff --git a/compiler/ir/ir.tree/build.gradle.kts b/compiler/ir/ir.tree/build.gradle.kts
index f53f216..8ec7fee 100644
--- a/compiler/ir/ir.tree/build.gradle.kts
+++ b/compiler/ir/ir.tree/build.gradle.kts
@@ -57,6 +57,7 @@
tasks.withType<KotlinJvmCompile> {
compilerOptions.freeCompilerArgs.add("-Xinline-classes")
+ compilerOptions.freeCompilerArgs.add("-Xconsistent-data-class-copy-visibility")
}
if (kotlinBuildProperties.isInJpsBuildIdeaSync) {
diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrStatementOrigin.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrStatementOrigin.kt
index e45b706..6173482 100644
--- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrStatementOrigin.kt
+++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/IrStatementOrigin.kt
@@ -113,8 +113,6 @@
val PARTIAL_LINKAGE_RUNTIME_ERROR by IrStatementOriginImpl
}
- // todo: replace suppress with @ConsistentCopyVisibility annotation after bootstrap
- @Suppress("DATA_CLASS_COPY_VISIBILITY_WILL_BE_CHANGED_WARNING")
data class COMPONENT_N private constructor(val index: Int) : IrStatementOrigin {
override val debugName: String = "COMPONENT_$index"
diff --git a/native/analysis-api-klib-reader/build.gradle.kts b/native/analysis-api-klib-reader/build.gradle.kts
index 7619f08..7e608e7 100644
--- a/native/analysis-api-klib-reader/build.gradle.kts
+++ b/native/analysis-api-klib-reader/build.gradle.kts
@@ -1,6 +1,7 @@
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinUsages
+import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
import org.jetbrains.kotlin.konan.target.HostManager
plugins {
@@ -65,3 +66,7 @@
testImplementation(project(":compiler:tests-common", "tests-jar"))
testImplementation(project(":analysis:analysis-api-standalone"))
}
+
+tasks.withType<KotlinJvmCompile>().configureEach {
+ compilerOptions.freeCompilerArgs.add("-Xconsistent-data-class-copy-visibility")
+}
diff --git a/native/analysis-api-klib-reader/src/org/jetbrains/kotlin/native/analysis/api/KlibDeclarationAddress.kt b/native/analysis-api-klib-reader/src/org/jetbrains/kotlin/native/analysis/api/KlibDeclarationAddress.kt
index bd510e2..92d0259 100644
--- a/native/analysis-api-klib-reader/src/org/jetbrains/kotlin/native/analysis/api/KlibDeclarationAddress.kt
+++ b/native/analysis-api-klib-reader/src/org/jetbrains/kotlin/native/analysis/api/KlibDeclarationAddress.kt
@@ -20,8 +20,6 @@
public abstract val classId: ClassId
}
-// todo: replace suppress with @ConsistentCopyVisibility annotation after bootstrap
-@Suppress("DATA_CLASS_COPY_VISIBILITY_WILL_BE_CHANGED_WARNING")
public data class KlibClassAddress internal constructor(
override val libraryPath: Path,
public override val sourceFileName: String?,
@@ -29,8 +27,6 @@
public override val classId: ClassId,
) : KlibClassifierAddress()
-// todo: replace suppress with @ConsistentCopyVisibility annotation after bootstrap
-@Suppress("DATA_CLASS_COPY_VISIBILITY_WILL_BE_CHANGED_WARNING")
public data class KlibTypeAliasAddress internal constructor(
override val libraryPath: Path,
override val packageFqName: FqName,
@@ -46,8 +42,6 @@
public abstract val callableName: Name
}
-// todo: replace suppress with @ConsistentCopyVisibility annotation after bootstrap
-@Suppress("DATA_CLASS_COPY_VISIBILITY_WILL_BE_CHANGED_WARNING")
public data class KlibPropertyAddress internal constructor(
override val libraryPath: Path,
override val sourceFileName: String?,
@@ -55,8 +49,6 @@
override val callableName: Name,
) : KlibCallableAddress()
-// todo: replace suppress with @ConsistentCopyVisibility annotation after bootstrap
-@Suppress("DATA_CLASS_COPY_VISIBILITY_WILL_BE_CHANGED_WARNING")
public data class KlibFunctionAddress internal constructor(
override val libraryPath: Path,
override val sourceFileName: String?,