Suppose you have two classes A and B like this which are both declared with Annotations.configureAliases():
public abstract class A {
@XStreamAlias("test")
@XStreamAsAttribute
private String bug;
}
@XStreamAlias("concrete")
public class B extends A {
@XStreamAlias("firstName")
@XStreamAsAttribute
private String name;
}
Then XStream persists an instance of B like this:
<concrete firstName="michael" test="whatever"/>
Then XStream will not read the attribute 'test' from the XML document into the class since it expects the attribute name to be 'bug'. Basically the @XStreamAlias annotation is ignored in (abstract) super classes and the actual field name is used instead when the XML document is read; when an object is persisted, however, the @XStreamAlias annotation is used correctly.