我想用proguard混淆JAXB代碼。這是一個完整的Java類代碼:IllegalAnnotationsException使用proguard混淆JAXB代碼
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlType;
@XmlType(propOrder =
{
"setting", "subsystems"
})
@XmlAccessorType(XmlAccessType.FIELD)
public class ProfileImpl implements Profile
{
@XmlAttribute
private String name;
@XmlAttribute
private final String version;
@XmlElementWrapper(name = "subsystems")
@XmlElement(name = "subsystem")
private List<SubsystemImpl> subsystems;
private SettingImpl setting;
public ProfileImpl()
{
this.version = "1.0";
this.name = "default";
}
public ProfileImpl(String name, SettingImpl setting, List<SubsystemImpl> subsystems, String version)
{
this.name = name;
this.setting = setting;
this.version = version;
this.subsystems = subsystems;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public List<SubsystemImpl> getSubsystems()
{
return subsystems;
}
public void setSubsystems(List<SubsystemImpl> subsystems)
{
this.subsystems = subsystems;
}
public SettingImpl getSetting()
{
return setting;
}
public void setSetting(SettingImpl setting)
{
this.setting = setting;
}
}
但是當我運行的代碼我得到:
com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 4 counts of IllegalAnnotationExceptions
Property c is present but not specified in @XmlType.propOrder
this problem is related to the following location:
at private java.util.List org.settings.loader.osgi.impl.jaxb.ProfileImpl.c
at org.settings.loader.osgi.impl.jaxb.ProfileImpl
at private java.util.List org.settings.loader.osgi.impl.jaxb.f.b
at org.settings.loader.osgi.impl.jaxb.f
Property d is present but not specified in @XmlType.propOrder
this problem is related to the following location:
at private org.settings.loader.osgi.impl.jaxb.d org.settings.loader.osgi.impl.jaxb.ProfileImpl.d
at org.settings.loader.osgi.impl.jaxb.ProfileImpl
at private java.util.List org.settings.loader.osgi.impl.jaxb.f.b
at org.settings.loader.osgi.impl.jaxb.f
我怎樣才能解決這個問題?
我想這Proguard的配置,以逃課混淆:
<option>-keep public class org.settings.loader.osgi.impl.jaxb.ProfileImpl{public *; private *;} -keepattributes Exceptions, *Annotation*, InnerClasses, Signature, SourceFile, EnclosingMethod -dontshrink -dontoptimize -keepparameternames</option>
你可以添加整個'ProfileImpl'嗎? – Xstian
帖子已更新 –
'SettingImpl setting'上缺少'XmlElement'註解? –