Last active
October 27, 2021 22:38
-
-
Save tateisu/cbda451135d2b5c9b69f7ac4599f9833 to your computer and use it in GitHub Desktop.
can't invoke `size` on some class that derived from ArrayList
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jp.juggler.subwaytooter | |
import org.junit.Assert.assertEquals | |
import org.junit.Test | |
class TestArrayListSort { | |
@Test | |
fun testArrayListSize() { | |
val list = ArrayList(arrayOf("c", "b", "a").toList()) | |
assertEquals("ArrayList size", 3, list.size); | |
// passed | |
} | |
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); | |
// raise error | |
} | |
} | |
'int jp.juggler.subwaytooter.TestArrayListSort$ArrayListDerived.getSize()' | |
java.lang.NoSuchMethodError: 'int jp.juggler.subwaytooter.TestArrayListSort$ArrayListDerived.getSize()' | |
at jp.juggler.subwaytooter.TestArrayListSort$ArrayListDerived.size(TestArrayListSort.kt:14) | |
at jp.juggler.subwaytooter.TestArrayListSort.testArrayListDerived(TestArrayListSort.kt:19) | |
(snip...) | |
ext.kotlin_version = '1.5.31' | |
java 14 (zulu 14.28.21 win64) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
kotlin 1.5.30 では問題なかった。