urgh, here's a little frustrating little tidbit of...
# announcements
urgh, here's a little frustrating little tidbit of covariance in kotlin with guice: - the
interface is covariant by rites: It defines a single method that takes no arguments and returns a type of its type parameter, identical to `() -> T`(which is effectively
kotlin.Function<out R>
) - the call-site covariant marker
is preserved at runtime as
<? extends Whatever>
. When guice reflects on a constructor that has a
Provider<out Something>
it attempts to look for a method to provision an
out Something
rather than simply trying to provision a
. So you get an internal guice error "expected a class [... or other normal type], but <? extends Whatever> is a WildcardType [and therefore cannot be resolved]
👍 1
📡 1