Project

Profile

Help

Bug #3818

closed

Reflexive java functions vs byte arrays

Added by Philipp Nanz over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Saxon extensions
Sprint/Milestone:
-
Start date:
2018-06-12
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.8, trunk
Fix Committed on Branch:
9.8, trunk
Fixed in Maintenance Release:
Platforms:

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

byte-array-bug.zip (1.09 KB) byte-array-bug.zip Philipp Nanz, 2018-06-12 16:24

Related issues

Related to Saxon - Bug #3525: Reflexive extension function returning byte[]ClosedMichael Kay2017-11-14

Actions
Actions #1

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.

Actions #2

Updated by Michael Kay over 6 years ago

  • Category set to Saxon extensions
  • Assignee set to Michael Kay
Actions #3

Updated by Michael Kay over 6 years ago

  • Related to Bug #3525: Reflexive extension function returning byte[] added
Actions #4

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.

Actions #5

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

Also available in: Atom PDF