Olaf Gottschalk
04/25/2025, 5:41 AM@TransformationDsl
infix fun <D : Any, VO> SetOperation<S, D>.by(valueMapper: ValueMapper<Any?, VO>) =
apply { source = source.map(valueMapper) }
When this function is used in "normal IntelliJ" contexts, a call like this compiles and works just fine:
set optional "overallWeightTransportation" from "GrossWeightTransportationQuantity" by unitCodeMapper
If you look very closely to my generics, the generic type VO
is not really relevant to this function, it has not bounds, the usage of the parameter valueMapper
when passed to the map
function does not care about this generic type, as map
accepts everything.
I did not realize this was over-engineered until when compiled with the script compiler I got this error:
set optional "overallWeightTransportation" from "GrossWeightTransportationQuantity" by unitCodeMapper //later mandatory
^^ Cannot infer type for this parameter. Specify it explicitly.
^^ Not enough information to infer type argument for 'VO'.
The key question is now: why does it work just fine in IntelliJ, but not in scripting compilation?
Solution for my immediate problem was to replace VO
with *
of course... but the question remains... ;-)CLOVIS
04/25/2025, 8:02 AMOlaf Gottschalk
04/25/2025, 9:56 AM