toSet // Will bind this as Resource&lt;*&gt; instead of Resource&lt;SomeThing&gt;<br>class SomeResource @Inject constructor() : Resource&lt;SomeThing&gt; {<br>  ...<br>  override fun close() { ... }<br>}<br><br>class ResourceCloser @Inject constructor(<br>  val resources: Set&lt;@JvmSuppressWildcards Resource&lt;*&gt;&gt;<br>) {<br>  fun closeAllResources() {<br>    resources.forEach { it.close() }<br>  }<br>}</code></pre><span class="top-right-position"><span class="copy-icon"></span><div class="copy-popup