Hi guys, why this happens? And what is the right w...
# announcements
s
Hi guys, why this happens? And what is the right way to fix it?
d
Your method signature says it will return a
Class<C>
, whatever
C
might be. The compiler cannot prove that e.g.
NioServerSocketChannel
will be a
C
, so it provides an error.
You probably want
Class<out ServerSocketChannel>
as your return type.
👍 1
1
m
You can do this:
Copy code
fun pickBestChannel(): Class<out ServerSocketChannel> {
  // ...
}
👍 1
l
guys -> folks (because guys in androcentric while Kotlin is not)
1