24 lines
793 B
Kotlin
24 lines
793 B
Kotlin
|
package jp.juggler.subwaytooter
|
||
|
|
||
|
import org.junit.Assert.assertEquals
|
||
|
import org.junit.Test
|
||
|
|
||
|
class TestArrayListSizeBug {
|
||
|
|
||
|
@Test
|
||
|
fun testArrayListSize() {
|
||
|
val list = ArrayList(arrayOf("c", "b", "a").toList())
|
||
|
assertEquals("ArrayList size", 3, list.size)
|
||
|
}
|
||
|
|
||
|
class ArrayListDerived<E>(args: List<E>) : ArrayList<E>(args)
|
||
|
|
||
|
@Test
|
||
|
fun testArrayListDerived() {
|
||
|
val list = ArrayListDerived(arrayOf("c", "b", "a").toList())
|
||
|
assertEquals("ArrayListDerived size", 3, list.size)
|
||
|
// kotlin 1.5.31で(Javaの) size() ではなく getSize() にアクセスしようとして例外を出していた
|
||
|
// kotlin 1.5.30では大丈夫だったが、JetPack Composeは 1.5.31を要求するのだった…。
|
||
|
}
|
||
|
}
|