Class MethodSizeMockTransformer
java.lang.Object
org.powermock.core.transformers.javassist.AbstractJavaAssistMockTransformer
org.powermock.core.transformers.javassist.MethodMockTransformer
org.powermock.core.transformers.javassist.MethodSizeMockTransformer
- All Implemented Interfaces:
MockTransformer<javassist.CtClass>
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:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanisMethodSizeExceeded(javassist.CtMethod method) javassist.CtClasstransform(javassist.CtClass clazz) Methods inherited from class MethodMockTransformer
modifyMethodMethods inherited from class AbstractJavaAssistMockTransformer
getStrategy, transform
-
Field Details
-
MAX_METHOD_CODE_LENGTH_LIMIT
private static final int MAX_METHOD_CODE_LENGTH_LIMIT- See Also:
-
-
Constructor Details
-
MethodSizeMockTransformer
-
-
Method Details
-
transform
public javassist.CtClass transform(javassist.CtClass clazz) throws javassist.CannotCompileException, javassist.NotFoundException - Specified by:
transformin classAbstractJavaAssistMockTransformer- Throws:
javassist.CannotCompileExceptionjavassist.NotFoundException
-
isMethodSizeExceeded
private boolean isMethodSizeExceeded(javassist.CtMethod method)
-