XStream
  1. XStream
  2. XSTR-557

Converters should use isAssignableFrom, not equals

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.3.1
    • Fix Version/s: None
    • Component/s: Converters
    • Labels:
      None

      Description

      Many xstream converters use class equality when determining if they can convert an object of a given type. This is undesirable, as it prevents users from easily serializing classes that extend these objects. Under the current implementation, users are forced to implement a custom converter in order to support this scenario. Instead, Class.isAssignableFrom should be use when checking "canConvert", so that the converters will properly convert subclasses as well. If a user still needs custom functionality they can then fall-back to creating their own converter.

      So far I have found the following converters to be affected:
      CollectionConverter
      MapConverter
      TreeMapConverter
      TreeSetConverter

        People

        • Assignee:
          Jörg Schaible
          Reporter:
          Keith Kowalczykowski
        • Votes:
          0 Vote for this issue
          Watchers:
          1 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: