I'm using both java 1.6.0_41 in production and dev builds. However, in production this line, namely valueOf():
List<Identifier> identifiers = new ArrayList<Identifier>();
identifiers.add(Identifier.valueOf(key));
throws is not an enum. Identifier is an enum.
Here's the stack trace.
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: com.core.datamodel.Identifier is not an enum type
at java.lang.Class.enumConstantDirectory(Unknown Source)
at java.lang.Enum.valueOf(Unknown Source)
<Break in method call trace. Could be due to JIT compiler inlining of method.>
We use zkm as an obfuscator and so maybe that's the issue?
public enum Identifier {FOO}
I pass in a key string FOO and hope to get the Identifier.FOO
It's possible that the obfuscator has renamed (or even removed) methods that internally need to be called by the enum class using reflections. Reflections won't work any more if the method has been renamed.
You should try to compile and run the code without the obfuscator. If this works, you can try to narrow down the cause by excluding only the enum from getting obfuscated.
In particular I suspect that the enum's values() method may have been obfuscated. valueOf at some point looks for this method using getMethod("values").
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With