You need to sign in to do that
Don't have an account?

Method 'CodeCoverage' exceeds the maximum number of allowed op codes.
I get the following error when I compile my apex classes:
line -1, column -1: Method 'CodeCoverage' exceeds the maximum number of allowed op codes. Please break this method into multiple, smaller methods.
line -1, column -1: Previous load of class failed: CodeCoverageTest: line -1, column -1: Method 'CodeCoverage' exceeds the maximum number of allowed op codes. Please break this method into multiple, smaller methods.
repeats...
repeats...
repeats...
I had never received this error before in my sandbox. I have not changed anything in the apex since I last ran the compliation.
Any suggestions as to what has caused this?
Did this happen about the time that your Organization moved from Winter '12 to Spring '12? My guess is that they lowered the limits for number of lines allowed in a method.
Same error here deploying a page and its related class of 1006 lines of code with 84% code coverage in the test environment.
Cannot deploy to production with the errors below (several after this one):
There are a lot of bigger classes in production right now and yet it failed on this one. The error message really doesn't give a hint.
Any thoughts?
Regards,
Not sure this is the case but here is a thread from back in Jan on the Winter '12 update that affected the number of operation in a method to 65k
http://boards.developerforce.com/t5/Apex-Code-Development/Compile-Error-Method-exceeds-maximum-number-of-allowed-op-codes/td-p/343135
Now I am getting a different error
line -1, column -1: Previous load of class failed: codecoveragetest
Any other ideas on how this will affect the organization?
I've found out the cause and resolved the problem in my org.
The cause was that a consultant had created a class to evade the testing requirement: 75% of all lines of code on all classes have to be tested in order to be deployed to Production.
He wanted to force a class into Production without the required testing so he created a second class named "CodeCoverage" and put a huge number of dummy statements there.
The misleading name led me to believe that it was some internal class developed by SalesForce so I didn't go looking for a class with that name in my org initially.
When I tried to deploy my own class, it wouldn't allow it because of this "CodeCoverage" class was failing due to being almost 300k (about 12 thousand lines) of worthless code.
Once I reduced it to the point where it would compile, and created some decent test classes to bring the test percentage back up to 75%, it worked.
So the first thing I would go looking for is check whether there is a class named "CodeCoverage" and see what it is doing.
Wow, that'd be a great story to use if you wanted to do a presentation on things not to do in Salesforce.