Resolve warnings introduced in Kotlin 1.9
- Kotlin does not support @JvmName on property getters in interfaces (see KT-20068).
- `getOrElse` method is incorrectly identified as non-nullable.
- Addressed deprecation warnings in Compose compiler plugin.
- kotlin.jvm.Volatile is deprecated.
- cinterop APIs now require OptIn.
- kotlin.native.internal.createCleaner is deprecated.
- ArrayIndexOutOfBoundsException is deprecated in native.
- Ignore test for @JvmDefault in KSP
Bug: 284452502
Change-Id: Ie8033b8fb42e17e3b0f5d056f1bf5a9204c05086
diff --git a/collection/collection/src/nativeMain/kotlin/androidx/collection/CollectionPlatformUtils.native.kt b/collection/collection/src/nativeMain/kotlin/androidx/collection/CollectionPlatformUtils.native.kt
index 20777ea..fdacbb6 100644
--- a/collection/collection/src/nativeMain/kotlin/androidx/collection/CollectionPlatformUtils.native.kt
+++ b/collection/collection/src/nativeMain/kotlin/androidx/collection/CollectionPlatformUtils.native.kt
@@ -21,6 +21,6 @@
internal actual object CollectionPlatformUtils {
internal actual inline fun createIndexOutOfBoundsException(): IndexOutOfBoundsException {
- return ArrayIndexOutOfBoundsException()
+ return IndexOutOfBoundsException()
}
}
diff --git a/collection/collection/src/nativeMain/kotlin/androidx/collection/internal/Lock.native.kt b/collection/collection/src/nativeMain/kotlin/androidx/collection/internal/Lock.native.kt
index 558b8dc..70af07f 100644
--- a/collection/collection/src/nativeMain/kotlin/androidx/collection/internal/Lock.native.kt
+++ b/collection/collection/src/nativeMain/kotlin/androidx/collection/internal/Lock.native.kt
@@ -18,6 +18,7 @@
import kotlin.native.internal.createCleaner
import kotlinx.cinterop.Arena
+import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.alloc
import kotlinx.cinterop.ptr
import platform.posix.pthread_mutex_destroy
@@ -38,6 +39,7 @@
internal expect val PTHREAD_MUTEX_RECURSIVE: Int
@Suppress("ACTUAL_WITHOUT_EXPECT") // https://youtrack.jetbrains.com/issue/KT-37316
+@OptIn(ExperimentalForeignApi::class)
internal actual class Lock actual constructor() {
private val resources = Resources()
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/facade/KotlinCompilerFacade.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/facade/KotlinCompilerFacade.kt
index 8b2807e..491a1b5 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/facade/KotlinCompilerFacade.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/facade/KotlinCompilerFacade.kt
@@ -22,10 +22,10 @@
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.TextRange
import com.intellij.openapi.util.text.StringUtilRt
-import com.intellij.openapi.vfs.CharsetToolkit
import com.intellij.psi.PsiFileFactory
import com.intellij.psi.impl.PsiFileFactoryImpl
import com.intellij.testFramework.LightVirtualFile
+import java.nio.charset.StandardCharsets
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
@@ -62,7 +62,7 @@
override fun getPath(): String = "/$name"
}
- virtualFile.charset = CharsetToolkit.UTF8_CHARSET
+ virtualFile.charset = StandardCharsets.UTF_8
val factory = PsiFileFactory.getInstance(project) as PsiFileFactoryImpl
val ktFile = factory.trySetupPsiForFile(
virtualFile, KotlinLanguage.INSTANCE, true, false
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XTypeElementTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XTypeElementTest.kt
index ad83341..42465dc 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XTypeElementTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XTypeElementTest.kt
@@ -41,6 +41,7 @@
import com.squareup.kotlinpoet.javapoet.JTypeVariableName
import com.squareup.kotlinpoet.javapoet.KClassName
import com.squareup.kotlinpoet.javapoet.KTypeVariableName
+import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
@@ -1631,6 +1632,7 @@
}
}
+ @Ignore("b/284452502")
@Test
fun jvmDefault() {
val src = Source.kotlin(
diff --git a/stableaidl/stableaidl-gradle-plugin/src/test/java/com/android/build/gradle/internal/fixtures/FakeGradleProperty.kt b/stableaidl/stableaidl-gradle-plugin/src/test/java/com/android/build/gradle/internal/fixtures/FakeGradleProperty.kt
index bd198da..1d18803 100644
--- a/stableaidl/stableaidl-gradle-plugin/src/test/java/com/android/build/gradle/internal/fixtures/FakeGradleProperty.kt
+++ b/stableaidl/stableaidl-gradle-plugin/src/test/java/com/android/build/gradle/internal/fixtures/FakeGradleProperty.kt
@@ -34,6 +34,7 @@
override fun isPresent() = value != null || valueProvider != null
+ @Suppress("WRONG_NULLABILITY_FOR_JAVA_OVERRIDE") // KT-36770
override fun getOrElse(defaultValue: T) =
value ?: valueProvider?.get() ?: convention ?: defaultValue
diff --git a/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/HeadlessWatchFaceClient.kt b/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/HeadlessWatchFaceClient.kt
index 3847531..81d5f0c 100644
--- a/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/HeadlessWatchFaceClient.kt
+++ b/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/HeadlessWatchFaceClient.kt
@@ -117,8 +117,7 @@
): Bitmap
/** Whether or not the watch face supports [renderWatchFaceToSurface]. */
- public val isRenderWatchFaceToSurfaceSupported: Boolean
- @get:JvmName("isRenderWatchFaceToSurfaceSupported") get() = false
+ public val isRenderWatchFaceToSurfaceSupported: Boolean get() = false
/**
* Renders the [androidx.wear.watchface.ComplicationSlot] to a shared memory backed [Bitmap]
diff --git a/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/InteractiveWatchFaceClient.kt b/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/InteractiveWatchFaceClient.kt
index 0dc3321..7602cd2 100644
--- a/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/InteractiveWatchFaceClient.kt
+++ b/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/InteractiveWatchFaceClient.kt
@@ -161,8 +161,7 @@
): Bitmap
/** Whether or not the watch face supports [RemoteWatchFaceViewHost]. */
- public val isRemoteWatchFaceViewHostSupported: Boolean
- @get:JvmName("isRemoteWatchFaceViewHostSupported") get() = false
+ public val isRemoteWatchFaceViewHostSupported: Boolean get() = false
/**
* Constructs a [RemoteWatchFaceViewHost] whose [RemoteWatchFaceViewHost.surfacePackage] can be