Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#82 StringValue, Object and isAssignableTo

v6.5.2
closed
nobody
None
5
2012-10-08
2002-05-28
Brett Knights
No

I am using a StringBuffer to accumulate Strings in a
stylesheet.

When I run
<xsl:value-of select="stringBuffer:append($sentList,
concat('x',
''y'))"/>

I get the error :
There are several Java methods that match equally well.

StringBuffer.append takes a number of argument types.
Among these are
String and Object. I believe the problem lies with the
conversionPreferences method in StringValue. I made
the change
indicated below and my stylesheet ran as expected.

public int conversionPreference(Class required) {

 //   if (required.isAssignableFrom(StringValue.class))

return 0;

...

    if (required==String.class) return 0;
    if (required==Object.class) return 1;

    // put this after the Object test. if required ==

Object
// then this test always returns true even when
there
// is a more specific value match.

    if (required.isAssignableFrom(StringValue.class))

return 0;
return Integer.MAX_VALUE;
}

Discussion

  • Michael Kay
    Michael Kay
    2002-08-27

    Logged In: YES
    user_id=251681

    Applies to 7.1: source code fixed for 7.2 release. I've taken
    the opportunity to revise all the conversion preferences to
    reduce the cases where unnecessary ambiguities will be
    reported (typically where there are two methods but both
    would return the same result).

    Also applies to 6.5.2: source code not yet fixed in this branch.

     
  • Michael Kay
    Michael Kay
    2002-08-28

    Logged In: YES
    user_id=251681

    Fixed in 7.2. Still present in 6.5.2 (and source code in 6.5.x
    not yet corrected).

     
  • Michael Kay
    Michael Kay
    2003-08-07

    Logged In: YES
    user_id=251681

    Fix applied to 6.5.3 (regression tested only)