Hey folks,
I've come over an interesting case for OPC-UA related to uninitialized
vs empty collections. Based on the docs:
https://reference.opcfoundation.org/Core/Part6/v104/docs/5.2.5
When declared array size is -1, then array is not initialized, when its
0, its empty. This is fair distinction thus in PR I'm working on I'm
going to provide an update to plc4j array count reader to honor that.
I haven't seen any failure in any of the tests, thus dropping
notification about this update here for future generations as well as
other languages.
Java code works in following way:
If count = -1 - return null
If count >= 0 return array with count elements
The COUNT spi/meta-macro behavior is not defined and I am leaving it
unaffected. Exact behavior needs to be handled on each protocol
individually to avoid issues with uint/int representation of implicit
fields used to send arrays lengths.
Best,
Łukasz