why is kotlin not inferring the Supplier properly?...
# announcements
s
why is kotlin not inferring the Supplier properly? I’ve tried several ways, including anonymous function, casting null, plain declaration…
t
Copy code
ResultValidatorImpl(actualEvents(), 
  MatchAllFieldFilter(listOf<FieldFilter>),
  Supplier { null }
)
s
no that doesn’t work as well. It can’t infer the type properly
and I’ve seen that sam conversion page, that was the first thing I tried.
specifying
Supplier<Aggregate<Any>>
or
Supplier<Aggregate<*>>
also do not work
oh
Supplier<Aggregate<Any?>>
does work. I thought I tried that.
t
I think
Supplier {}
would take the type for the return of the closure, if you return
null
you need a nullable receiver, like
Supplier<Aggregate?>
that is why
Supplier<Any?>
works while
Supplier<Any>
does not