Add type parameters to ExplorationTargets and SuperSets
Current status.
The ExplorationTarget defines the expected return type of its evaluation
based on a generic parameter. While this mechanism allows to verify the
returned values from a DSE w.r.t. the expected return value if
ExplorationTargets are statically defined in an .ecore model, this
mechanism does no longer when the return value is expected to be set at
runtime.
In this case, the interface of the maps that collect the return values
would degenerate to “pretend” type safety. The same applies to
SuperSets.
Nevertheless, setting the expected return type at runtime is needed, since selected annotations in the DSE view shall determine expected return type. These are used when defining exploration targets via the DSE expression language (DSML). Note, that the generics will still be kept to avoid unneeded casting in the client code.
Proposed Modification.
- In order to set the expected return type during runtime, introduce a type parameter for ExplorationTargets and SuperSets. The type parameter shall be queried when checking return types first, but a reflection-based fallback shall exist for the above mentioned static definition of ExplorationTargets.
- The method implementation of the ExplorationSolution and SuperSetMap shall be modified to include type checking via the type parameter. This allows to forbid “dirty” casts that work around the described type equivalence mechanism. Thus, the DSE interface is more type safe and robust (since the DSE I/Os are “more” well-defined.)
(from redmine: issue id 3289, created on 2018-02-27, closed on 2019-01-25)