Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 63c84100 authored by Dave Mankoff's avatar Dave Mankoff
Browse files

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
parent 1ddbe049
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -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!!)
            }
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -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!!)
            }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -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
+9 −9
Original line number Diff line number Diff line
@@ -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("}")
        }
    }
}