Have a class that implements Java interface and ha...
# android
m
Have a class that implements Java interface and have it as method return type while calling android api, but getting error
Type mismatch. Required: AppKey Found: PublicKey!
. Any clues?
not kotlin but kotlin colored 2
@kenkyee Any reason why you think this is not Kotlin?
c
``Appkey`` extends
Key
and not
PublicKey
And it’s not kotlin but kotlin colored because you would have the same issue in Java
☝️ 1
m
Sorry, should've been clearer -
Key
is from
java.security
so
PublicKey
does extend
Key
k
Still also happens in Java
c
Yes, but you do not extend PublicKey so the return types do not match.
☝️ 1
👀 1
m
Huh, did not know that, but changing
AppKey
to extend
PublicKey
still requires to cast the return to
AppKey
. Interesting, thanks for the help!