import com.thoughtworks.xstream.XStream; public class XStreamBug { private static class Bug { private long _underscored; } public static void main(String[] args) throws Exception { XStream xs = new XStream(); xs.useAttributeFor(long.class); // Make _underscore an attribute xs.setMode(XStream.ID_REFERENCES); String xml = xs.toXML(new Bug()); Bug bug = (Bug)xs.fromXML(xml); // Gets exception } }