Bug #3818
closedReflexive java functions vs byte arrays
100%
Description
Hello there,
I have run into a problem that I believe might be a problem in Saxon 9.8.
The problem occurs with calling reflexive Java functions that return byte[] and get passed a byte[]. With Bug #3525, the behaviour seems to have changed in such a way that reflexive Java functions that return a byte[] are treated as xs:unsignedByte*. However when a byte array is passed to such a function, it still requires xs:byte* which causes a compiler error.
Moreover I couldn't find a way to convert the xs:unsignedByte to xs:byte. When doing so in a loop, I receive weird other messages (something with java.util.Random), I haven't looked into this any further though because it's pobably not such a great idea to do this conversion the hard way in a loop.
Please see attached example. The code is running without issues in Saxon PE 9.6 and 9.7.
Thanks in advance for your time!
Kind regards,
Philipp Nanz
Files
Related issues
Updated by Philipp Nanz over 6 years ago
To make this a little clearer: It would be fine for me to change both of the variables to xs:unsignedByte* in order to get it to work (in fact that is what I would expect). But when I do so, I get the following error:
Required item type of second argument of md5:digest() is xs:byte; supplied value has item type xs:unsignedByte
So far, I wasn't able to get this little bit of code to work on 9.8 at all.
Updated by Michael Kay over 6 years ago
- Category set to Saxon extensions
- Assignee set to Michael Kay
Updated by Michael Kay over 6 years ago
- Related to Bug #3525: Reflexive extension function returning byte[] added
Updated by Michael Kay over 6 years ago
- Status changed from New to Resolved
- Applies to branch trunk added
- Fix Committed on Branch 9.8, trunk added
The code was doing the run-time conversions from byte[] to xs:unsignedByte correctly, but the static type inferencing had not been updated: the inferred type for a byte[] argument or result was still xs:byte*.
Now fixed, together with a new unit test in TestReflexion.
Updated by Debbie Lockett over 6 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 9.8.0.14 added
Bug fix applied in the Saxon 9.8.0.14 maintenance release.
Please register to edit this issue