title: Scala: Why does extending a trait break `Class.getConstructor()`?
body: <p>When a class extends a trait, an invocation of <code>getConstructor()</code> that would otherwise succeed then throws a <code>NoSuchMethodException</code>.  Why does this happen and what can be done about it?</p>
  
  <p>In the code below, the first invocation of <code>getConstructor()</code> returns without error.  The second raises the exception.</p>
  
  <pre><code>trait MyTrait
  
  class MyClass(root: String)
  
  object Main extends App {
  
    val one = new MyClass("foo")
    one.getClass.getConstructor(classOf[String])
    println("so far so good")
  
    val two = new MyClass("foo") with MyTrait
    two.getClass.getConstructor(classOf[String]) // NoSuchMethodException
  
  }
  </code></pre>