-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Currently, the implementations of OpTransformer are not type safe. Transformation is done the following way: In order to discern whether a Transformer is able to transform a certain object, each OpTransformer has a method getRefTransformingTo(OpRef targetRef) which tries to do the backwards transformation of the target OpRef. The contract is that if this is possible, the transform method will be able to transform an Op that matches the backwards transformed OpRef. Hence, if no exception occurs during the Op transformation (which may be the case if depending Ops can't be found), the resulting Op's apply/compute/mutate should work as intended. However, if there are bugs in the implementation of the backwards transform method or in the transform method itself, an Op may be returned that is not able to execute. E.g.
- The
LiftFunctionToArrayTransformerneeds the class of the component type (i.e. the type of the first type argument of the function to transform) in order to lift this generic type to an array using the methodFunction<I[], O[]> liftBoth(final Function<I, O> function, Class<O> cls). As there is no type information about the generics of the functional type available, which should be transformed, theliftBothutility will not fail as it gets called with a raw type function (actually, it may be called using any class in this case).
Thus, it would be nice if the transformation fails in these cases instead of the functional method afterwards.