Project

Profile

Help

Bug #5183

closed

FeatureKey<Class> mechanism in C# doesn't work

Added by Michael Kay over 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
.NET API
Sprint/Milestone:
-
Start date:
2021-12-03
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
11, trunk
Fix Committed on Branch:
trunk
Fixed in Maintenance Release:
Platforms:
.NET, Java

Description

SaxonCS had adopted the same scheme of defining FeatureKey as a generic class parameterised by the type of the property. In Java this means you can do

processor.setProperty(FeatureKey.TIMING, true)

and you get a type error if you try to supply a string rather than a boolean.

On C# this doesn't work.

Firstly, you have to specify the type explicitly:

processor.setProperty(FeatureKey<boolean>.TIMING, true)

which tends to outweigh any convenience factor.

More seriously, it's not possible to do

processor.setProperty(FeatureKey<URIResolver>.URI_RESOLVER, new MyResolver())

if MyResolver is a subclass of URIResolver.

I'm therefore proposing to degenerify Feature and FeatureKey, with a loss of type-safety by an improvement in usability.

This is an incompatible change.

Actions #3

Updated by Michael Kay over 2 years ago

  • Category set to .NET API
  • Status changed from New to Resolved
  • Priority changed from Low to Normal
  • Applies to branch 11, trunk added
  • Fix Committed on Branch trunk added

The change has been made and documented and will affect SaxonCS 11.1.

Actions #4

Updated by O'Neil Delpratt about 2 years ago

  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 11.1 added
  • Platforms .NET, Java added

Bug fix applied in the Saxon 11.1 release.

Actions #5

Updated by O'Neil Delpratt about 2 years ago

  • Status changed from Resolved to Closed

Please register to edit this issue

Also available in: Atom PDF