title: "Failed to transform class with name" error when mocking a class with a static enum class
body: <pre><code>java.lang.IllegalStateException: Failed to transform class with name com.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX$ReadSets. Reason: null
      at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:219)
      at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:147)
      at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:67)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:264)
      at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114)
      at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
      at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
      at sun.reflect.annotation.AnnotationParser.parseSig(AnnotationParser.java:390)
      at sun.reflect.annotation.AnnotationParser.parseClassValue(AnnotationParser.java:371)
      at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:673)
      at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:480)
      at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:306)
      at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:241)
      at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:88)
      at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:70)
      at java.lang.Class.initAnnotationsIfNecessary(Class.java:3089)
      at java.lang.Class.getAnnotations(Class.java:3069)
      at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.classAnnotations(PowerMockJUnit44RunnerDelegateImpl.java:163)
      at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.getDescription(PowerMockJUnit44RunnerDelegateImpl.java:155)
      at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.getDescription(JUnit4TestSuiteChunkerImpl.java:171)
      at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.getDescription(AbstractCommonPowerMockRunner.java:47)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.sendTree(JUnit4TestClassReference.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.sendTrees(RemoteTestRunner.java:476)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:464)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
  Caused by: java.lang.NullPointerException
      at javassist.compiler.MemberResolver.lookupMethod(MemberResolver.java:110)
      at javassist.compiler.MemberResolver.lookupMethod(MemberResolver.java:96)
      at javassist.compiler.TypeChecker.atMethodCallCore(TypeChecker.java:704)
      at javassist.compiler.TypeChecker.atCallExpr(TypeChecker.java:681)
      at javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:156)
      at javassist.compiler.ast.CallExpr.accept(CallExpr.java:45)
      at javassist.compiler.Javac$1.setReturnType(Javac.java:449)
      at javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:146)
      at javassist.compiler.ast.CallExpr.accept(CallExpr.java:45)
      at javassist.compiler.TypeChecker.atVariableAssign(TypeChecker.java:248)
      at javassist.compiler.TypeChecker.atAssignExpr(TypeChecker.java:217)
      at javassist.compiler.ast.AssignExpr.accept(AssignExpr.java:38)
      at javassist.compiler.CodeGen.doTypeCheck(CodeGen.java:235)
      at javassist.compiler.CodeGen.atStmnt(CodeGen.java:323)
      at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
      at javassist.compiler.CodeGen.atStmnt(CodeGen.java:344)
      at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
      at javassist.compiler.CodeGen.atIfStmnt(CodeGen.java:384)
      at javassist.compiler.CodeGen.atStmnt(CodeGen.java:348)
      at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
      at javassist.compiler.CodeGen.atStmnt(CodeGen.java:344)
      at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
      at javassist.compiler.Javac.compileStmnt(Javac.java:558)
      at javassist.expr.MethodCall.replace(MethodCall.java:233)
      at org.powermock.core.transformers.impl.MainMockTransformer$PowerMockExpressionEditor.edit(MainMockTransformer.java:299)
      at javassist.expr.ExprEditor.loopBody(ExprEditor.java:178)
      at javassist.expr.ExprEditor.doit(ExprEditor.java:90)
      at javassist.CtClassType.instrument(CtClassType.java:1224)
      at org.powermock.core.transformers.impl.MainMockTransformer.transform(MainMockTransformer.java:75)
      at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:215)
      ... 28 more
  </code></pre>
  
  <p>This class contains a static method getInstance (which i want to mock), to provide a singleton object and a couple of Enum classes declared as public static (one of them named ReadSets is seen in the exception). Below is how the class looks like.</p>
  
  <p>Am trying to mock this class in my test method using PowerMockito.mock and Powermockito.MockStatic and it throws the exception.</p>
  
  <p>Any clues on how it can be fixed?</p>
  
  <pre><code>public class XXX extends YYY {
  
      private volatile static XXX s_instance;
  
      public static XXX getInstance() {
          if (s_instance == null)
              synchronized (XXX.class) {
                  if (s_instance == null)
                      s_instance = new XXX();
              }
          return s_instance;
      }
  
      public static enum ReadSets {
          ANY(1), ALL(2);
          int val;
  
          public int getVal() {
              return val;
          }
  
          private ReadSets(int v) {
              val = v;
          }
      }
  
      public static enum UpdateSets {
          ANY(1), ALL(2);
          int val;
  
          private UpdateSets(int v) {
              val = v;
          }
      }
  
      // [...]
  
  }
  </code></pre>