bug? wrapped-java-type to java array
Added by Anonymous over 16 years ago
Legacy ID: #5003286 Legacy Poster: Chapman Flack (jcflack)
Hi, In a function resembling declare function local:foo($es as java-type:net.sf.saxon.functions.Evaluate-PreparedExpression+) { myclass:bar($es) } where myclass's bar method looks liks: public static SequenceIterator bar(Evaluate.PreparedExpression[] es) { ... } I get an error converting the argument IF a sequence of length 1 is passed to local:foo: Error in call to extension function ... Conversion of external object to [Lnet.sf.saxon.functions.Evaluate$PreparedExpression; is not supported As long as the sequence is not a singleton the conversion succeeds. I can work around it by having local:foo always add a dummy expression to the sequence and the java method ignore it. http://saxonica.com/documentation/extensibility/converting-args/converting-atomic.html seems to say that conversion to an array should be possible as long as the static type of $es allows a sequence of more than one item (which it does, as it's declared with +). So, should this not work even when $es happens dynamically to be a singleton? The particular app where I'm doing this is still on bj 8.0, if that matters. -Chap
Replies (3)
Please register to reply
RE: bug? wrapped-java-type to java array - Added by Anonymous over 16 years ago
Legacy ID: #5003308 Legacy Poster: Michael Kay (mhkay)
>The particular app where I'm doing this is still on bj 8.0, if that matters. Saxon 8.0 was released over 4 years ago: yes, it does matter! If you can reproduce this on the current release (9.0.0.6 was shipped today) then I'll be happy to look at it. Having said that, the fact that a list of length one is the same as the singleton item in the XPath model, but not in the Java model, is always going to cause a few glitches. But Saxon has been moving steadily towards making more of the conversion decisions based on compile-time type information rather than run-time information, which helps to get over that problem.
RE: bug? wrapped-java-type to java array - Added by Anonymous over 16 years ago
Legacy ID: #5004752 Legacy Poster: Chapman Flack (jcflack)
>The particular app where I'm doing this is still on bj 8.0, if that unfortunate typo: 8.9. (Why can't they put the zero key next to the ONE, fer Pete's sake?) I'll see about making time to extract a test case and try it against 9.0.0.6. -Chap
RE: bug? wrapped-java-type to java array - Added by Anonymous over 16 years ago
Legacy ID: #5005922 Legacy Poster: Chapman Flack (jcflack)
It does seem to have been fixed somewhere between 9.0.0.2 and 9.0.0.6. Sorry for the noise. -Chap
Please register to reply