Guice annotatedWith() binding doesn't work when using a Kotlin annotation


I have a strange problem. I am trying to follow an example at - more specifically the @PayPal equivalent (not the @Named one).

So the binding in Kotlin looks like this:

The problem I’m facing is that if the @PayPal annotation comes from Java, it works just fine. But I’m not able to make it work with a PayPal annotation created in Kotlin.
Do you have any thoughts about what’s wrong and how to make the Kotlin annotations work with guice .annotatedWith() API?


If you want to use annotation processing in Kotlin you will have to enable kapt (there is a plugin for that in gradle) and make sure to make your processor a dependency of the kapt configuration.