title: Overriding the method of a generic trait in Scala
body: <p>I defined a generic Environment trait:</p>
  <pre><code>trait Environment[T]
  </code></pre>
  <p>For which I provide this implementation:</p>
  <pre><code>class MyEnvironment extends Environment[Integer] {
   val specific: Integer = 0
  }
  </code></pre>
  <p>Furthermore, I defined a generic Event trait that has one method that accepts a generic Environment as parameter:</p>
  <pre><code>trait Event[T] {
    def exec(e: Environment[T])
  }
  </code></pre>
  <p>For this Event trait, I provided the following implementation, where the exec() method accepts a parameter of the type MyEnvironment, to enable me to access the specific value of MyEnvironment.</p>
  <pre><code>class MyEvent extends Event[Integer] {
    override def exec(e: MyEnvironment): Unit = {
      println(e.specific)
    }
  }
  </code></pre>
  <p>However, the Scala compilers outputs an error, from where it seems that
  MyEnvironment is not recognized as an Environment[Integer]:</p>
  <blockquote>
  <p>Error: method exec overrides nothing.</p>
  <p>Note: the super classes of class MyEvent contain the following, non final members named exec: def exec(t: main.vub.lidibm.test.Environment[Integer]): Unit</p>
  </blockquote>
  <p>Is it possible to make this work, or are there patterns to circumvent this problem.</p>