The PR could be a bit annoying. When we modify a builder using a veneer, in Java, we need to cast some values in the nil_check step. At the same time, if we need to add this cast here, we should skip the casting in the assignment step.
I tried to reuse formatCastValue function but it doesn't work because for nil checks, the Object is detected as a ref, while in the assignment is detected as an any. Its why I created shouldCastNilCheck, that it's similar but only used for the nil checks.
Also I found that some paths aren't well set, since it was setting the whole path for the casting/nil checks. So the change return's the latest path until it reaches a generic to avoid to set an invalid value.
Closes https://github.com/grafana/cog/issues/395
The PR could be a bit annoying. When we modify a builder using a veneer, in Java, we need to cast some values in the
nil_check
step. At the same time, if we need to add this cast here, we should skip the casting in the assignment step.I tried to reuse
formatCastValue
function but it doesn't work because fornil checks
, the Object is detected as aref
, while in the assignment is detected as anany
. Its why I createdshouldCastNilCheck
, that it's similar but only used for the nil checks.Also I found that some paths aren't well set, since it was setting the whole path for the casting/nil checks. So the change return's the latest path until it reaches a generic to avoid to set an invalid value.