Allow nullable variable types from Kotlin
Closed this issue · 0 comments
Steps to reproduce
- camunda-bpm-data version: 1.4.0
- Camunda BPM version: 7.20.0
- JDK version: 17
- Operating system: MacOs
Expected behaviour
When the library was implemented in Java, it was possible to set a variable to null
, due to somewhat relaxed interoperability rules.
Actual behaviour
Now I can't find a way to do that. The boundary for the type parameter T
of a variable factory is Any
, not Any?
, so I can't create a Variable Factory for a nullable type. The set
methods take a T
argument, not T?
, so I can't put null
in there. The best I can do is to remove the variable if the value is null
, but that is cumbersome. Also it's not the same thing if a variable doesn't exist at all as when the variable exists with value null
.
It would also be nice to have some convenience functions like setIfNotNull
or setOrRemove
to not interrupt the flow of fluent variable writing.
I'm posting this as a bug because it's a regression and major breaking change compared to the Java implementation.