title: Kotlin reflection + generics
body: <p><strong>EDIT 1:</strong> Changed title, my bad.</p>
  
  <p>I have an interface <strong>Event</strong>:</p>
  
  <pre><code>interface Event
  </code></pre>
  
  <p>And some classes that implement it, like <strong>CustomEvent</strong>:</p>
  
  <pre><code>class CustomEvent : Event { ... }
  </code></pre>
  
  <p>What I've been trying to do now is: given a method that has an event as a parameter (so, any class that implements the <strong>Event</strong> interface), like this</p>
  
  <pre><code>fun onCustomEvent(event: CustomEvent) {
      ...
  }
  </code></pre>
  
  <p>, I want to add that event to a list. Thus, this list will end up holding a bunch of different events.</p>
  
  <hr>
  
  <p>In <strong>Java</strong> I belive it would be something like this (might not be 100% accurate):</p>
  
  <pre><code>List&lt;Class&lt;? extends Event&gt;&gt; eventsList;
  
  ....
  
  Class&lt;?&gt; param = methodThatHasSomeEventAsParam.parameterTypes[0];
  
  if (Event.class.isAssignableFrom(param)) {
      Class&lt;? extends Event&gt; actualParam = (Class&lt;? extends Event&gt;) param;
      eventsList.add(actualParam); // Adds CustomEvent to the events list.
  }
  </code></pre>
  
  <hr>
  
  <p>But as for Kotlin, I'm really not sure how to use the generics properly, specifically what would be the correct way to translate </p>
  
  <pre><code>Class&lt;? extends Event&gt; 
  </code></pre>
  
  <p>to Kotlin, keeping the same behaviour as the Java code above.</p>
  
  <p>Thanks in advance.</p>