Details

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

      Description

      Hi...

      Im taking some problems to user alias with interfaces.

      I add an alias to Map interface:
      Map<String, String> map2 = new LinkedHashMap<String, String>();
      map2.put("a", "A");
      map2.put("b", "B");
      XStream stream = new XStream();
      stream.alias("map", Map.class);
      System.out.println(stream.toXML(map2));

      But for my surprise the toXML gave me this:
      <linked-hash-map>
      <entry>
      <string>a</string>
      <string>A</string>
      </entry>
      <entry>
      <string>b</string>
      <string>B</string>
      </entry>
      </linked-hash-map>

      I cant have linked-hash-map on this XML, Im using to send data to other language, who dont understand java.

      For now I will put alias to all know Map implementations....
      xstream.alias("map", HashMap.class);
      xstream.alias("map", Hashtable.class);
      xstream.alias("map", LinkedHashMap.class);
      xstream.alias("map", SortedMap.class);
      xstream.alias("map", TreeMap.class);
      But this is horrible... and, some genius can implement a UnknowMap and the problem shows again.

      I hope is a bug.

      VELO

        People

        • Assignee:
          Unassigned
          Reporter:
          Marvin Froeder
        • Votes:
          0 Vote for this issue
          Watchers:
          0 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: