XStream
  1. XStream
  2. XSTR-436

Cannot persist collection of generic type

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 1.2.2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • JDK version and platform:
      1.5.0_11 windows

      Description

      A class field like this

      @XStreamImplicit
      private List<PersistedNode<V>> nodes = new ArrayList<PersistedNode<V>>();

      causes a ClassCastException in method

      com.thoughtworks.xstream.annotations.Annotations.getFieldParameterizedType(Field, XStream) [line 226]

      because the result returned by ParameterizedType.getActualTypeArguments()[0] is of type java.lang.reflect.ParameterizedType, not java.lang.Class.

      The workaround is to use raw types and unchecked casts.

        Issue Links

          People

          • Assignee:
            Unassigned
            Reporter:
            Felix Mayer
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: