groostav
01/04/2017, 9:48 AMremoveEldestEntry
in java-covariant way with Any
as the argument type?
eg:
val thingy : LinkedHashMap<AnnoyingKeyType, ValueType> = object: LinkedHashMap<AnnoyingKeyType, ValueType>{
override fun removeEldestEntry(eldest: MutableMap.MutableEntry<AnnoyingKeyType, ValueType>?) = ...
}
is the default signature, and it is legal to override it with:
val thingy : LinkedHashMap<AnnoyingKeyType, ValueType> = object: LinkedHashMap<AnnoyingKeyType, ValueType>{
override fun removeEldestEntry(eldest: Map.Entry<AnnoyingKeyType, ValueType>?) = ...
}
but it is not legal to override it with
val thingy : LinkedHashMap<AnnoyingKeyType, ValueType> = object: LinkedHashMap<AnnoyingKeyType, ValueType>{
override fun removeEldestEntry(eldest: Any?) = ...
}
why?