daphillips
10/13/2020, 3:22 PMdaphillips
10/13/2020, 3:22 PMprivate val cache: LoadingCache<Long, String> = Caffeine.newBuilder()
.build { it.toString() }
object Foo: LoadingCache<Long, String> by cache {
override fun get(key: Long): String {
return cache.get(key)!!
}
}
The error I get is:
Platform declaration clash: The following declarations have the same JVM signature (get(Ljava/lang/Object;)Ljava/lang/Object;):
public open fun get(key: Long): String? defined in Foo
public open fun get(key: Long): String defined in Foo
The interface is a part of the caffeine
cache library (written in Java). The relevant declaration is:
public interface LoadingCache<K, V> extends Cache<K, V> {
@Nullable
V get(@NonNull K key);
}
Is there something that I'm doing wrong?daphillips
10/13/2020, 3:24 PMString
to String?
I get the same Platform declaration clash
errorBrett Best
10/13/2020, 3:24 PMoverride fun get(key: Long): String? {
Brett Best
10/13/2020, 3:24 PMdaphillips
10/13/2020, 3:25 PMoverride
from the non-null return typeedrd
10/13/2020, 3:30 PMedrd
10/13/2020, 3:30 PMoverride
, thoughdaphillips
10/13/2020, 3:41 PM'@JvmName' annotation is not applicable to this declaration
¯\_(ツ)_/¯edrd
10/13/2020, 4:56 PMedrd
10/13/2020, 4:57 PMcache
daphillips
10/13/2020, 4:57 PMdaphillips
10/13/2020, 4:59 PMget