Class MethodSizeMockTransformer

java.lang.Object
org.powermock.core.transformers.javassist.AbstractJavaAssistMockTransformer
org.powermock.core.transformers.javassist.MethodSizeMockTransformer
All Implemented Interfaces:
MockTransformer<javassist.CtClass>

public class MethodSizeMockTransformer extends AbstractJavaAssistMockTransformer
According to JVM specification method size must be lower than 65536 bytes. When that limit is exceeded class loader will fail to load the class. Since instrumentation can increase method size significantly it must be ensured that JVM limit is not exceeded.

When the limit is exceeded method's body is replaced by exception throw. Method is then instrumented again to allow mocking and suppression.

See Also:
  • Constructor Details

    • MethodSizeMockTransformer

      public MethodSizeMockTransformer(TransformStrategy strategy)
  • Method Details

    • transform

      public javassist.CtClass transform(javassist.CtClass clazz) throws javassist.CannotCompileException, javassist.NotFoundException
      Specified by:
      transform in class AbstractJavaAssistMockTransformer
      Throws:
      javassist.CannotCompileException
      javassist.NotFoundException