`asScala` does not work for strange Java List type

Can anyone tell me what this strange type of events is and why asScala does not work on it?
In Java the signature of this method is not special in any way I could think of:

List<WatchEvent<?>> pollEvents();


What do you mean doesn’t work?
This java-code

protected List<WatchEvent<?>> fisk() {
	return  Collections.emptyList();

is perfectly asScala-able:

val flesk: List[WatchEvent[_]] = fisk.asScala.toList

What errors are you getting?

1 Like

Sorry, my bad; my import was scala.jdk.CollectionConverters and not scala.jdk.CollectionConverters._.

But to the second part of my question: What kind of type is (util.List[WatchEvent[_$1]]) forSome {type _$1}? I have never seen anything like that before.


1 Like