Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Duplicate
-
Affects Version/s: 1.2.2
-
Fix Version/s: None
-
Component/s: Annotations
-
Labels:None
-
JDK version and platform:JDK 1.6.0 WIndows
Description
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.
Issue Links
- duplicates
-
XSTR-418 Attribute alias of super class ignored during unmarshal.
See linked issue.