« Return to Thread: [jira] Created: (JMOCK-197) Mocking a static nested class causes a net.sf.cglib.core.CodeGenerationException to be thrown.

[jira] Created: (JMOCK-197) Mocking a static nested class causes a net.sf.cglib.core.CodeGenerationException to be thrown.

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View in Thread

Mocking a static nested class causes a net.sf.cglib.core.CodeGenerationException to be thrown.
----------------------------------------------------------------------------------------------

                 Key: JMOCK-197
                 URL: http://jira.codehaus.org/browse/JMOCK-197
             Project: jMock
          Issue Type: Bug
    Affects Versions: 1.2.0
            Reporter: Ryan C. Payne


In some code that I have inherited I have a class with a static nested class. In the past (jMock 1.1.0) I was able to successfully mock this static nested class. After upgrading to jMock 1.2.0, this no longer works. I end up getting the following exception:
net.sf.cglib.core.CodeGenerationException: java.lang.IllegalAccessError-->tried to access method org.jmock.codegen.com.mycompany.core.util.DataPage$DataPageDefinition$$EnhancerByCGLIB$$3417fee6.CGLIB$setPageNumber$6(I)V from class org.jmock.codegen.org.jmock.codegen.com.mycompany.core.util.DataPage$DataPageDefinition$$EnhancerByCGLIB$$3417fee6$$FastClassByCGLIB$$e9f65fd5
        at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:235)
        at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:220)
        at net.sf.cglib.proxy.Enhancer.createUsingReflection(Enhancer.java:636)
        at net.sf.cglib.proxy.Enhancer.firstInstance(Enhancer.java:538)
        at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:225)
        at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
        at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:304)
        at org.jmock.cglib.CGLIBCoreMock.<init>(CGLIBCoreMock.java:63)
        at org.jmock.cglib.CGLIBCoreMock.<init>(CGLIBCoreMock.java:46)
        at org.jmock.cglib.CGLIBCoreMock.<init>(CGLIBCoreMock.java:35)
        at org.jmock.cglib.MockObjectTestCase.newCoreMock(MockObjectTestCase.java:33)
        at org.jmock.MockObjectTestCase.mock(MockObjectTestCase.java:67)
        at org.jmock.MockObjectTestCase.mock(MockObjectTestCase.java:55)
        at com.mycompany.core.persistence.hbm.HBMBaseDAOTest.testLimitResultSet(HBMBaseDAOTest.java:117)
Caused by: java.lang.IllegalAccessError: tried to access method org.jmock.codegen.com.mycompany.core.util.DataPage$DataPageDefinition$$EnhancerByCGLIB$$3417fee6.CGLIB$setPageNumber$6(I)V from class org.jmock.codegen.org.jmock.codegen.com.mycompany.core.util.DataPage$DataPageDefinition$$EnhancerByCGLIB$$3417fee6$$FastClassByCGLIB$$e9f65fd5
        at org.jmock.codegen.org.jmock.codegen.com.mycompany.core.util.DataPage$DataPageDefinition$$EnhancerByCGLIB$$3417fee6$$FastClassByCGLIB$$e9f65fd5.invoke(<generated>)
        at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:167)
        at org.jmock.cglib.CGLIBCoreMock.intercept(CGLIBCoreMock.java:79)
        at org.jmock.codegen.com.mycompany.core.util.DataPage$DataPageDefinition$$EnhancerByCGLIB$$3417fee6.setPageNumber(<generated>)
        at com.mycompany.core.util.DataPage$DataPageDefinition.<init>(DataPage.java:280)
        at com.mycompany.core.util.DataPage$DataPageDefinition.<init>(DataPage.java:267)
        at org.jmock.codegen.com.mycompany.core.util.DataPage$DataPageDefinition$$EnhancerByCGLIB$$3417fee6.<init>(<generated>)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:228)
        ... 58 more

Research led me to the following:
  http://www.gg3721.com/list/50/44427.html 
and the followup
  http://www.gg3721.com/list/50/44774.html

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: [jira] Created: (JMOCK-197) Mocking a static nested class causes a net.sf.cglib.core.CodeGenerationException to be thrown.