Android studio使用别名注解xlm中String转类这句会闪退是什么原因啊?
PersonAlias Person= (PersonAlias) xs.fromXML(list[0]);
代码段在这里:
XStream xs = new XStream();
xs.autodetectAnnotations(true);
ClassAliasingMapper classAliasingMapper = new ClassAliasingMapper(xs.getMapper());
classAliasingMapper.addClassAlias("hobby", String.class);
xs.registerLocalConverter(PersonAlias.class, "hobbies", new CollectionConverter(classAliasingMapper));
xs.allowTypes(new Class[] {PersonAlias.class});
PersonAlias Person= (PersonAlias) xs.fromXML(list[0]);
String xml=xs.toXML(Person);
闪退debug跳到了这里: