0

I'm trying to obfuscate a plugin of my server with ProGuard, but I can't obfuscate an enum class. They keep losing information.

The enum class is this:

public enum PasswordType
{
    XAUTH(xAuth.class);

    Class<?> classe;

    private PasswordType(Class<?> authClass)
    {
        this.classe = authClass;
    }

    public PasswordMethod getInstance()
    {
        try
        {
            return (PasswordMethod) this.classe.newInstance();
        } catch (InstantiationException | IllegalAccessException e)
        {
            e.printStackTrace();
        }
        return null;
    }
}

And my config is this:

<options>
    <option>-keep class com.ehaqui.ehlogin.EhLoginPlugin</option>
    <option>-dontshrink</option>
    <option>-dontoptimize</option>
    <option>-dontusemixedcaseclassnames</option>
    <option>-keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,LocalVariable*Table,*Annotation*,Synthetic,EnclosingMethod,EventHandler,Override</option>
</options>

But when I build the project, the enum value XAUTH(xAuth.class) disappears and the plugin doesn't run correctly.

Shows: java.lang.IllegalArgumentException: com.ehaqui.ehlogin.e.b is not an enum type

How can I fix this?

mtrueblood
  • 414
  • 2
  • 11
  • 28
Lucas Fernando
  • 344
  • 3
  • 11
  • It looks like a duplicate of http://stackoverflow.com/questions/6285623/proguard-wont-keep-a-class-members-enums – Linuslabo Apr 18 '16 at 16:06

1 Answers1

1

I think i found

-keep class com.ehaqui.ehlogin.security.PasswordType {*;}
Lucas Fernando
  • 344
  • 3
  • 11