wcx6298 / smartgwt

Automatically exported from code.google.com/p/smartgwt
0 stars 0 forks source link

Unable to Mock TreeGrid or ListGrid due to method size exceeding maximum allowed size in Java Virtual Machine #673

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a Mock of ListGrid/TreeGrid using PowerMock

What is the expected output? What do you see instead?
I should get a mock of the class ListGrid/TreeGrid
Instead, I get an error:
Caused by: java.lang.ClassFormatError: Invalid method Code length 74191 in 
class file com/smartgwt/client/widgets/grid/ListGrid$$EnhancerByCGLIB$$3fb8ac49

What version of the product are you using? On what operating system?
SmartGwt 3.0.

Please provide any additional information below.
After some googling, I found that JVM cannot support method length bigger than 
64K. The advised solution is to adapt the code generator to divide the large 
methods into smaller sub methods.

In the JVM specs, going to the following link:
http://docs.oracle.com/javase/specs/jvms/se5.0/html/ClassFile.doc.html#9279
You can see:
The value of the code_length item must be less than 65536.

Original issue reported on code.google.com by sta191...@gmail.com on 24 May 2012 at 1:48

GoogleCodeExporter commented 9 years ago
Test Case:

ListGrid gridMock = PowerMock.createMock(ListGrid.class);

you can get POwerMock at : http://code.google.com/p/powermock/

Original comment by sta191...@gmail.com on 24 May 2012 at 1:49

GoogleCodeExporter commented 9 years ago
Using powermock-easymock-junit-1.4.12 , I am now able to mock the Listgrid, but 
I still have the same problem with TreeGrid

Original comment by sta191...@gmail.com on 25 May 2012 at 5:02