I have identified a common feature of the environment:
trait Environment[T]
Why do I provide this implementation:
class MyEnvironment extends Environment[Integer] {
val specific: Integer = 0
}
In addition, I defined a common attribute of an event that has one method that takes a general environment parameter as a parameter:
trait Event[T] {
def exec(e: Environment[T])
}
For this event property, I presented the following implementation, where the exec () method takes a parameter of type MyEnvironment so that I can access the specific value of MyEnvironment.
class MyEvent extends Event[Integer] {
override def exec(e: MyEnvironment): Unit = {
println(e.specific)
}
}
However, Scala compilers throws an error, from where it seems that MyEnvironment is not recognized as an environment [Integer]:
Error: The exec method does not cancel anything.
Note: superclasses of the MyEvent class contain the following non-finite members named exec: def exec (t: main.vub.lidibm.test.Environment [Integer]): Unit
Is it possible to do this work or are there templates to work around this problem.