title: help with reflection + constructors
body: <p>I have code I'm working on to instantiate a CRC algorithm dependent on a polynomial passed in, and a string <code>s</code> that contains "crc8" or "crc16" or "crc32".</p>
  
  <p>The classes <code>CRC8</code>, <code>CRC16</code>, and <code>CRC32</code> all extend a class <code>CRC</code> and implement an interface <code>HashAlgorithm</code>. Each of them has a constructor <code>CRCx(int polynomial)</code>.</p>
  
  <p>My problem is, I get this error on all 3 of the getConstructor() lines:</p>
  
  <pre><code>Type mismatch: 
    cannot convert from Constructor&lt;HashFactory.CRC16&gt; 
    to Constructor&lt;HashFactory.CRC&gt;
  </code></pre>
  
  <p>Can anyone help explain why and help me fix this?</p>
  
  <pre><code>    int polynomial; // assign from somewhere
      Constructor&lt;CRC&gt; crc = null;
      if ("crc8".equals(s))
      {
          crc = CRC8.class.getConstructor(Integer.TYPE);
      }
      if ("crc16".equals(s))
      {
          crc = CRC16.class.getConstructor(Integer.TYPE);
      }
      if ("crc32".equals(s))
      {
          crc = CRC32.class.getConstructor(Integer.TYPE);
      }
      if (crc != null)
      {
          CRC crcInstance = crc.newInstance(polynomial);
          return (HashAlgorithm) crcInstance;
      }
  </code></pre>