Bug 113796 - ClassFormatError: empty interface (invalid method code length)
Summary: ClassFormatError: empty interface (invalid method code length)
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.0M4   Edit
Hardware: Macintosh All
: P2 normal (vote)
Target Milestone: 1.5.0RC1   Edit
Assignee: Andrew Clement CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-26 09:03 EDT by Koen Muilwijk CLA
Modified: 2005-11-03 10:57 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Koen Muilwijk CLA 2005-10-26 09:03:11 EDT
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.
Comment 1 Koen Muilwijk CLA 2005-10-26 09:51:48 EDT
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. 
Comment 2 Andrew Clement CLA 2005-10-28 10:07:40 EDT
investigate for rc1
Comment 3 Andrew Clement CLA 2005-10-28 12:05:44 EDT
If you are allowed, can you possibly email me the failing bytecode so I can take
a look at it?
Comment 4 Andrew Clement CLA 2005-10-31 03:25:36 EST
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)...
Comment 5 Koen Muilwijk CLA 2005-10-31 05:50:37 EST
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.
Comment 6 Koen Muilwijk CLA 2005-11-03 10:54:52 EST
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.
Comment 7 Andrew Clement CLA 2005-11-03 10:57:39 EST
thanks for the update.  Dont hesitate to reopen the bug if you see it happening
again.