reik.schatz
09/04/2019, 3:19 PMTokenValidator
in kotlin? struggling a bit with Type mismatch, Type inference failed
for Flowable
and Publisher
Shawn A
09/04/2019, 3:23 PMreik.schatz
09/04/2019, 3:26 PMclass BouncerAuthentication: Authentication
@Singleton
@Requires(notEnv = [ Environment.TEST ])
@Replaces(JwtTokenValidator::class)
class BouncerTokenValidator(): TokenValidator {
private val logger = KotlinLogging.logger {}
override fun validateToken(token: String?): Publisher<Authentication> {
return if (token != null) {
try {
Flowable.just(BouncerAuthentication())
} catch (e: BouncerAccountFacadeException) {
logger.error(e) { "Exception using authgateway" }
Flowable.empty()
}
} else {
logger.trace { "Token is missing" }
Flowable.empty()
}
}
}
BouncerTokenValidator.kt: (24, 13): Type mismatch: inferred type is Flowable<BouncerAuthentication!> but Publisher<Authentication> was expected
BouncerTokenValidator.kt: (28, 26): Type inference failed: Not enough information to infer parameter T in fun <T : Any!> empty(): Flowable<T!>!
Flowable.empty<Authentication>()
Shawn A
09/04/2019, 3:51 PM