Make JVM backend work with Collection.size as val
0. Such properties are called special because their accessor JVM name differs from usual one
1. When making call to such property, always choose special name
2. When generating Kotlin class inheriting such property generate `final bridge int size() { return this.getSize(); }`
3. If there is no `size` declaration in current class generate `bridge int getSize() { // super-call }`
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
public class Test extends java.util.ArrayList<String> {
|
||||
public final int size() {
|
||||
return 56;
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
|
||||
class OurTest : Test()
|
||||
|
||||
fun box(): String {
|
||||
val t = OurTest()
|
||||
val x: MutableCollection<String> = t
|
||||
|
||||
if (t.size != 56) return "fail 1: ${t.size}"
|
||||
if (x.size != 56) return "fail 1: ${x.size}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user