diff --git a/text/text/src/androidTest/java/androidx/compose/ui/text/android/CharSequenceCharacterIteratorTest.kt b/text/text/src/androidTest/java/androidx/compose/ui/text/android/CharSequenceCharacterIteratorTest.kt new file mode 100644 index 0000000000000..52d4ab774bb16 --- /dev/null +++ b/text/text/src/androidTest/java/androidx/compose/ui/text/android/CharSequenceCharacterIteratorTest.kt @@ -0,0 +1,18 @@ +package androidx.compose.ui.text.android + +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.filters.SmallTest +import com.google.common.truth.Truth.assertThat +import org.junit.Test +import org.junit.runner.RunWith + +@SmallTest +@RunWith(AndroidJUnit4::class) +class CharSequenceCharacterIteratorTest { + @Test + fun canClone() { + val subject = CharSequenceCharacterIterator("", 0, 0) + val cloned = subject.clone() + assertThat(subject).isNotSameInstanceAs(cloned) + } +} diff --git a/text/text/src/main/java/androidx/compose/ui/text/android/CharSequenceCharacterIterator.kt b/text/text/src/main/java/androidx/compose/ui/text/android/CharSequenceCharacterIterator.kt index a46277c308ad6..d2bbc36273d2b 100644 --- a/text/text/src/main/java/androidx/compose/ui/text/android/CharSequenceCharacterIterator.kt +++ b/text/text/src/main/java/androidx/compose/ui/text/android/CharSequenceCharacterIterator.kt @@ -29,11 +29,12 @@ import java.text.CharacterIterator * @param start The index of the beginning of the range. * @param end The index of the end of the range. */ +@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") internal class CharSequenceCharacterIterator( private val charSequence: CharSequence, private val start: Int, private val end: Int -) : CharacterIterator { +) : Object() /* see b/204328129 */, CharacterIterator { private var index: Int = start /** @@ -173,7 +174,6 @@ internal class CharSequenceCharacterIterator( */ override fun clone(): Any { return try { - @Suppress("ABSTRACT_SUPER_CALL") super.clone() } catch (e: CloneNotSupportedException) { throw InternalError()