Community
Participate
Working Groups
When instrumenting advices in a class that implements an empty interface (only static fields and no methods) I get the run-time exception: Exception in thread "main" java.lang.ClassFormatError: Invalid method Code length 287132 in class file <...> The pointcut is: pointcut execmethods(): classes() && call(* *(..)) && !within(AbstractTrace); pointcut classes() : !within(nl.uu.tracing.*); and advice is like: before() : classes() && execmethods() { // ... } after() throwing (Throwable ex) : classes() && execmethods() { // ... } after() returning(Object a): classes() && execmethods() { // ... } Class sig is: public class XyzTest extends TestCase implements SomeConstants All these advices make this exception occur, so it doesn't matter which one is used. I've tried M3 and M4 of 1.5 and 1.2.2 as well. All result in same exception. This bug looks like: https://bugs.eclipse.org/bugs/show_bug.cgi?id=36778 but although that one is closed it is not solved. Unfortunately I'm not allowed to post generated byte-code.
Strange, maybe the empty interface is not the cause of these errors. I get the same error on a few other classes as well. Cannot think of any reason. The classes are nothing special. Maybe bit long and complex, but no special hacks or something.
investigate for rc1
If you are allowed, can you possibly email me the failing bytecode so I can take a look at it?
Regarding bug 36778, a compiler limitation message is produced if you attempt to apply around advice to the staticinitializer for an interface (I just checked). Then I tried recreating this scenario with an interface that contains only constants having before/after throwing/after returning advice applied to all join points within it, it worked OK. So as mentioned in comment #2 there is something else going on here...I could really do with the class file for a failing class (preferably the empty interface)...
Tomorow I can ask if I'm allowed to post the byte code of a failing class. If I'm allowed I'll post the results here.
Strange, I cannot reproduce this bug. Maybe it has been fixed in the latest build, but it seems to be working ok now. So this bug can be closed.
thanks for the update. Dont hesitate to reopen the bug if you see it happening again.