Project

Profile

Help

Bug #2531

closed

Reflexive extension functions: synthetic methods

Added by Michael Kay over 8 years ago. Updated over 8 years ago.

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

100%

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

Description

When resolving reflexive extension functions, Saxon makes no attempt to exclude Java synthetic methods from its search. Since a synthetic method can have the same name and argument types as a "real" method on the same class, this can cause the search for a method to fail saying that there is more than one candidate, and insufficient type information to disambiguate them. To demonstrate the problem:

package z;
public interface Foo<T> {
  T foo();
}

package z;
public class MyFoo implements Foo<String> {
  String foo() { return "foo"; }
}

XSLT:
<xsl:stylesheet 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  xmlns:z="java:z.MyFoo"
  version="2.0">

  <xsl:variable name="my" select="z:new()" />
  <xsl:value-of select="z:foo($my)" />
  
</xsl:stylesheet> 

Please register to edit this issue

Also available in: Atom PDF