Java ProGuard:ClassCastException

Java ProGuard:ClassCastException,java,gson,proguard,obfuscation,Java,Gson,Proguard,Obfuscation,当我混淆Java代码(在使用ProGuard)混淆之前,我会得到这个烦人的ClassCastException 该异常错误指向此代码位,如下所示(粗体线为精确线): 整个类文件(未混淆): RawProfileList类文件(未模糊化): ProGuard版本:5.2.1 配置文件声明字段: private final Map<String, Profile> profiles = new HashMap<String, Profile>(); private fina

当我混淆Java代码(在使用
ProGuard
)混淆之前,我会得到这个烦人的
ClassCastException

该异常错误指向此代码位,如下所示(粗体线为精确线):

整个类文件(未混淆):
RawProfileList
类文件(未模糊化):
ProGuard
版本:5.2.1

配置文件声明字段:

private final Map<String, Profile> profiles = new HashMap<String, Profile>();
private final Map profiles=new HashMap();

您的课程看起来不错
ClassCastException
表示
Gson
不知道字段应该序列化为
Profile


确保您的
proguard.cfg
包含所有字段。

请向我们展示
selectedProfile
profiles
字段的声明。如果可能的话,请提供一个非模糊和模糊的
.class
文件。您使用的是哪个版本的ProGuard?添加到帖子底部。整个类文件(未混淆):ProGuard版本:5.2.1配置文件声明字段:private final Map Profiles=new HashMap();谁在
profiles
map中写作?我怀疑Minecraft框架中存在某种东西,它使用反射来决定用什么填充地图,并且由于名称已更改,它的行为与模糊代码不同。向我们展示
RawProfileList
类。您的
proguard.cfg
是否包含?
public Profile getSelectedProfile()
{
    if ((this.selectedProfile == null) || (!this.profiles.containsKey(this.selectedProfile))) {
        if (this.profiles.get("Default") != null)
        {
            this.selectedProfile = "Default";
        }
        else if (this.profiles.size() > 0)
        {
            this.selectedProfile = ((Profile)this.profiles.values().iterator().next()).getName();
        }
        else
        {
            this.selectedProfile = "Default";
            this.profiles.put("Default", new Profile(this.selectedProfile));
        }
    }
    *Profile profile = this.profiles.get(this.selectedProfile);*
    return profile;
}
private final Map<String, Profile> profiles = new HashMap<String, Profile>();