mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-11 08:31:30 +00:00
Take into account irrelevant implementation of special builtins
This commit is contained in:
5
compiler/testData/codegen/boxWithJava/collections/irrelevantSizeOverrideInJava/J.java
vendored
Normal file
5
compiler/testData/codegen/boxWithJava/collections/irrelevantSizeOverrideInJava/J.java
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import java.util.*;
|
||||
|
||||
public class J implements Sized {
|
||||
final public int getSize() { return 123; }
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
interface Sized {
|
||||
val size: Int
|
||||
}
|
||||
|
||||
class A<T> : J(), Collection<T> {
|
||||
override fun isEmpty(): Boolean {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun contains(element: T): Boolean {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun iterator(): Iterator<T> {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun containsAll(elements: Collection<T>): Boolean {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val a = A<String>()
|
||||
if (a.size != 123) return "fail 1"
|
||||
|
||||
val c: Collection<String> = a
|
||||
if (c.size != 123) return "fail 2"
|
||||
|
||||
val sized: Sized = a
|
||||
if (sized.size != 123) return "fail 3"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user