XStream
  1. XStream
  2. XSTR-404

@XStreamImplicit() for ArrayList<ArrayList<Type>> throws ClassCastException

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.2
    • Fix Version/s: 1.3
    • Component/s: Core
    • Labels:
      None
    • JDK version and platform:
      Sun 1.5.0_1 for Windows

      Description

      ...
      @XStreamImplicit(itemFieldName="line")
      ArrayList<ArrayList<Point>> lines;
      ...
      Annotations.configureAliases(xstream, PolyLine.class); ...

      throws

      java.lang.ClassCastException:
      sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl
      at com.thoughtworks.xstream.annotations.Annotations.getFieldParameterizedType(Annotations.java:226)
      at com.thoughtworks.xstream.annotations.Annotations.configureClass(Annotations.java:161)
      at com.thoughtworks.xstream.annotations.Annotations.configureAliases(Annotations.java:49)

      when configureAliases() is executed.

      The old code I used for 1.2.1 still works and is a viable (although ugly) workaround:

      xstream.addImplicitCollection(PolyLine.class, "lines", "line", ArrayList.class); // Workaround

        People

        • Assignee:
          Guilherme Silveira
          Reporter:
          Klaus Rheinwald
        • Votes:
          0 Vote for this issue
          Watchers:
          2 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: