diff options
author | 2025-03-03 21:48:34 +0000 | |
---|---|---|
committer | 2025-03-04 20:33:24 +0000 | |
commit | 63c841008072838c91dc2b563e947a04630f78ab (patch) | |
tree | 6143f498c611ad30f6b2e77f880143d874e4d2b0 | |
parent | 1ddbe049b32d7fd27e5d69e590ec4fa44a5c0714 (diff) |
Fixes for Kotlin 2.1
Replace appendln with appendLine to make Kotlin 2.1 happy.
This fixes the following error when compiling with 2.1.10:
```
error: 'fun Appendable.appendln(value: CharSequence?): Appendable'
is deprecated. Use appendLine instead.
```
Fix nullability in various usages of
`com.google.common.truth.Subject.Factory`:
- IgnoreableExpect
- TransitionStateSubject
- DpOffsetSubject
Bug: 399463072
Test: m intdef-annotation-processor
Change-Id: I11eadb3e26dd09bfc7b92c07ccad68f56f1ebba2
4 files changed, 20 insertions, 20 deletions
diff --git a/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/subjects/TransitionStateSubject.kt b/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/subjects/TransitionStateSubject.kt index 0bd51cd9822d..44f2353dcb75 100644 --- a/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/subjects/TransitionStateSubject.kt +++ b/packages/SystemUI/compose/scene/tests/src/com/android/compose/animation/scene/subjects/TransitionStateSubject.kt @@ -111,8 +111,8 @@ private constructor(metadata: FailureMetadata, private val actual: TransitionSta } companion object { - fun transitionStates() = Factory { metadata, actual: TransitionState -> - TransitionStateSubject(metadata, actual) + fun transitionStates() = Factory { metadata, actual: TransitionState? -> + TransitionStateSubject(metadata, actual!!) } } } @@ -181,8 +181,8 @@ private constructor(metadata: FailureMetadata, actual: TransitionState.Transitio companion object { fun sceneTransitions() = - Factory { metadata, actual: TransitionState.Transition.ChangeScene -> - SceneTransitionSubject(metadata, actual) + Factory { metadata, actual: TransitionState.Transition.ChangeScene? -> + SceneTransitionSubject(metadata, actual!!) } } } @@ -202,8 +202,8 @@ private constructor( companion object { fun showOrHideOverlayTransitions() = - Factory { metadata, actual: TransitionState.Transition.ShowOrHideOverlay -> - ShowOrHideOverlayTransitionSubject(metadata, actual) + Factory { metadata, actual: TransitionState.Transition.ShowOrHideOverlay? -> + ShowOrHideOverlayTransitionSubject(metadata, actual!!) } } } @@ -221,8 +221,8 @@ private constructor(metadata: FailureMetadata, actual: TransitionState.Transitio companion object { fun replaceOverlayTransitions() = - Factory { metadata, actual: TransitionState.Transition.ReplaceOverlay -> - ReplaceOverlayTransitionSubject(metadata, actual) + Factory { metadata, actual: TransitionState.Transition.ReplaceOverlay? -> + ReplaceOverlayTransitionSubject(metadata, actual!!) } } } diff --git a/packages/SystemUI/compose/scene/tests/src/com/android/compose/test/subjects/DpOffsetSubject.kt b/packages/SystemUI/compose/scene/tests/src/com/android/compose/test/subjects/DpOffsetSubject.kt index ab31038fac8f..368a333fbd78 100644 --- a/packages/SystemUI/compose/scene/tests/src/com/android/compose/test/subjects/DpOffsetSubject.kt +++ b/packages/SystemUI/compose/scene/tests/src/com/android/compose/test/subjects/DpOffsetSubject.kt @@ -49,8 +49,8 @@ class DpOffsetSubject(metadata: FailureMetadata, private val actual: DpOffset) : val DefaultTolerance = Dp(.5f) fun dpOffsets() = - Factory<DpOffsetSubject, DpOffset> { metadata, actual -> - DpOffsetSubject(metadata, actual) + Factory { metadata, actual: DpOffset? -> + DpOffsetSubject(metadata, actual!!) } } } diff --git a/services/tests/PackageManagerServiceTests/unit/src/com/android/server/pm/test/util/IgnoreableExpect.kt b/services/tests/PackageManagerServiceTests/unit/src/com/android/server/pm/test/util/IgnoreableExpect.kt index afb18f5be669..5c9ba401bf88 100644 --- a/services/tests/PackageManagerServiceTests/unit/src/com/android/server/pm/test/util/IgnoreableExpect.kt +++ b/services/tests/PackageManagerServiceTests/unit/src/com/android/server/pm/test/util/IgnoreableExpect.kt @@ -32,7 +32,7 @@ internal class IgnoreableExpect : TestRule { private var ignore = false - override fun apply(base: Statement?, description: Description?): Statement { + override fun apply(base: Statement, description: Description): Statement { return object : Statement() { override fun evaluate() { ignore = false diff --git a/tools/processors/intdef_mappings/src/android/processor/IntDefProcessor.kt b/tools/processors/intdef_mappings/src/android/processor/IntDefProcessor.kt index 4995eebdd79e..fe72dae9ff34 100644 --- a/tools/processors/intdef_mappings/src/android/processor/IntDefProcessor.kt +++ b/tools/processors/intdef_mappings/src/android/processor/IntDefProcessor.kt @@ -155,35 +155,35 @@ class IntDefProcessor : AbstractProcessor() { ) { val indent = " " - writer.appendln("{") + writer.appendLine("{") val intDefTypesCount = annotationTypeToIntDefMapping.size var currentIntDefTypesCount = 0 for ((field, intDefMapping) in annotationTypeToIntDefMapping) { - writer.appendln("""$indent"$field": {""") + writer.appendLine("""$indent"$field": {""") // Start IntDef - writer.appendln("""$indent$indent"flag": ${intDefMapping.flag},""") + writer.appendLine("""$indent$indent"flag": ${intDefMapping.flag},""") - writer.appendln("""$indent$indent"values": {""") + writer.appendLine("""$indent$indent"values": {""") intDefMapping.entries.joinTo(writer, separator = ",\n") { (value, identifier) -> """$indent$indent$indent"$value": "$identifier"""" } - writer.appendln() - writer.appendln("$indent$indent}") + writer.appendLine() + writer.appendLine("$indent$indent}") // End IntDef writer.append("$indent}") if (++currentIntDefTypesCount < intDefTypesCount) { - writer.appendln(",") + writer.appendLine(",") } else { - writer.appendln("") + writer.appendLine("") } } - writer.appendln("}") + writer.appendLine("}") } } } |