https://saxonica.plan.io/https://saxonica.plan.io/favicon.ico2020-09-11T11:36:18ZSaxonica Developer CommunitySaxon - Bug #4730: ClassCastException: net.sf.saxon.expr.instruct.CopyOf cannot be cast to net.sf.saxon.expr.AxisExpressionhttps://saxonica.plan.io/issues/4730?journal_id=162392020-09-11T11:36:18ZMichael Kaymike@saxonica.com
<ul></ul><p>Problem reproduced.</p>
<p>In the path expression on line 33, the <code>.../node()</code> has been rewritten as <code>.../copy-of(node())</code>, as part of the process of generating a streamable execution plan. The node will be copied because it's being transferred to a new parent at line 37, and so this makes the copy explicit because that makes the streamability analysis work. But the path expression has a flag <code>contextFree</code> set; this is set when it's possible to evaluate the rhs of the path expression without creating a new context, but it assumes the rhs will be an <code>AxisStep</code>.</p> Saxon - Bug #4730: ClassCastException: net.sf.saxon.expr.instruct.CopyOf cannot be cast to net.sf.saxon.expr.AxisExpressionhttps://saxonica.plan.io/issues/4730?journal_id=162402020-09-11T11:42:58ZMichael Kaymike@saxonica.com
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>In Progress</i></li></ul><p>The simplest fix seems to be to change SlashExpression line 946 from</p>
<pre><code>if (contextFree) {
</code></pre>
<p>to</p>
<pre><code>if (contextFree && step instanceof AxisExpression) {
</code></pre> Saxon - Bug #4730: ClassCastException: net.sf.saxon.expr.instruct.CopyOf cannot be cast to net.sf.saxon.expr.AxisExpressionhttps://saxonica.plan.io/issues/4730?journal_id=162422020-09-11T12:14:23ZMichael Kaymike@saxonica.com
<ul></ul><p>I haven't been able to trigger a failure in the bytecode compilation path, but it's making the same assumption that if <code>contextFree</code> is set, the rhs will be an AxisExpression, so I'm applying the same fix on that path.</p> Saxon - Bug #4730: ClassCastException: net.sf.saxon.expr.instruct.CopyOf cannot be cast to net.sf.saxon.expr.AxisExpressionhttps://saxonica.plan.io/issues/4730?journal_id=162442020-09-11T13:23:13ZMichael Kaymike@saxonica.com
<ul><li><strong>Status</strong> changed from <i>In Progress</i> to <i>Resolved</i></li><li><strong>Fix Committed on Branch</strong> <i>10, trunk</i> added</li></ul><p>Patched on 10 and development branches.</p>
<p>Bytecode change is regression-tested only.</p> Saxon - Bug #4730: ClassCastException: net.sf.saxon.expr.instruct.CopyOf cannot be cast to net.sf.saxon.expr.AxisExpressionhttps://saxonica.plan.io/issues/4730?journal_id=167272020-10-28T17:57:59ZO'Neil Delprattoneil@saxonica.com
<ul></ul><p>Bug fix applied in the Saxon 10.3 maintenance release</p> Saxon - Bug #4730: ClassCastException: net.sf.saxon.expr.instruct.CopyOf cannot be cast to net.sf.saxon.expr.AxisExpressionhttps://saxonica.plan.io/issues/4730?journal_id=167732020-10-28T18:13:36ZO'Neil Delprattoneil@saxonica.com
<ul><li><strong>Status</strong> changed from <i>Resolved</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li><li><strong>Fixed in Maintenance Release</strong> <i>10.3</i> added</li></ul>