I want to setup Guice bindings so I created a module in Java that works perfectly:
public class CrashLoggerModule extends AbstractModule {
@Override
public void configure() {
bind(CrashLogger.class).to(ConcreteCrashLogger.class);
}
}
Then I converted this code to Kotlin:
public class CrashLoggerModule : AbstractModule() {
override fun configure() {
bind(javaClass<CrashLogger>()).to(javaClass<ConcreteCrashLogger>())
}
}
Unfortunately, the Kotlin version of this class doesn't work anymore. This happens because Kotlin calls its internal method public fun <A, B> A.to(that: B): Pair<A, B>
instead of LinkedBindingBuilder<T>.to(Class<? extends T> c)
which results in Guice binding not being set up correctly.
How can I specify explicitly that I want to use the class method and not the extension function?