Project

Profile

Help

Bug #4056

closed

object?method() notation for reflexive extension functions does not work when there is an XPathContext parameter

Added by Michael Kay over 5 years ago. Updated almost 5 years ago.

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

100%

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

Description

The new notation object?method() used to call the methods of a Java external object does not work in the case of methods that declare a first argument of type XPathContext - the arity of the corresponding function is calculated incorrectly.

Actions #1

Updated by Michael Kay over 5 years ago

Also note: the run-time cost of using this notation is quite high. There is scope for optimization here, for example even if we can't determine the type of object statically, there's a very good chance that when the expression is executed repeatedly, object will have the same type (or even be the same instance!) each time, so we should be able to remember what method to call, rather than introspecting the class from scratch each time.

Actions #2

Updated by Michael Kay about 5 years ago

Created test TestReflexion.testLookupNotationWithContext() to test this. It currently fails with an NPE.

Actions #3

Updated by Michael Kay about 5 years ago

  • Status changed from New to Resolved
  • Applies to branch 9.9, trunk added
  • Fix Committed on Branch 9.9, trunk added

Fixed.

The new code:

  • Improves the error handling if there is no method with the given name, detecting this during type checking where possible

  • Identifies the method to be called at compile time where possible, reducing run-time cost

  • Allows methods that have XPathContext as a first argument to pass this argument implicitly.

Test case: TestReflexion.testLookupNotationWithContext

Actions #4

Updated by O'Neil Delpratt almost 5 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 9.9.1.3 added

Bug fix applied to the Saxon 9.9.1.3 maintenance release

Please register to edit this issue

Also available in: Atom PDF