title: Java getMethod with superclass parameters in method
body: <p>Given:</p>
  
  <pre><code>class A
  {
      public void m(List l) { ... }
  }
  </code></pre>
  
  <p>Let's say I want to invoke method <code>m</code> with reflection, passing an ArrayList as the parameter to <code>m</code>:</p>
  
  <pre><code>List myList = new ArrayList();
  A a = new A();
  Method method = A.class.getMethod("m", new Class[] { myList.getClass() });
  method.invoke(a, Object[] { myList });
  </code></pre>
  
  <p>The <code>getMethod</code> on line 3 will throw <code>NoSuchMethodException</code> because the runtime type of myList is ArrayList, not List.</p>
  
  <p>Is there a good generic way around this that doesn't require knowledge of class A's parameter types?</p>