jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lambert, Mark " <mlamb...@nationalinfo.com>
Subject RE: java.lang.ClassFormatError when running in Java 1.5
Date Mon, 18 Oct 2004 20:08:53 GMT
 

> -----Original Message-----
> From: Felipe Leme [mailto:maven@felipeal.net] 
> Sent: Sunday, October 17, 2004 2:07 PM
> To: Cactus Users List
> Subject: Re: java.lang.ClassFormatError when running in Java 1.5
> 
> Mark,
> 
> If this bug is just a matter of updating Aspectj's version, I 
> could do the change.
> 
> But I'd rather understand what's exactly this bug and how to 
> reproducite it first. So, could you please provide more info, 
> preferably on Jira?
> 

I put a brief update in http://nagoya.apache.org/jira/browse/CACTUS-129

In short, AspectJ is creating a static method and including a reference
to _this_ in it's variable table.  Java 1.5 is more strict than earlier
versions and catches this as an error.

In longer from the AspectJ bug report:
The answer is that in AspectDeclaration.generateMethod() where we are 
generating the code for static methods like aspectOf(), hasAspect(), etc
- we 
are using the codeStream object incorrectly.  We are calling
codeStream.init() 
rather than codeStream.reset().  Not using reset() means that we don't
alter 
the method declaration object that the code stream thinks it is working
with.  
This means that when we ask the classfile to fix up its code attributes 
(around line AspectDeclaration line 306 we call
classFile.completeCodeAttribute
()) the classfile asks the methoddeclaration for the codestream whether
it is 
static - based on the result of this check, it generates a local
variable 
table entry for 'this' (See line 1413 in ClassFile).  Because we never
updated 
the codestream with a new method declaration, it still points to the
method 
declaration for our previous created method - the advice itself (public
void 
ajc$before$A$50();) - this was *not* static and so we end up creating a
'this' 
local variable entry for all the subsequent generated methods in the
aspect.

Mark
--
"A man of my acquaintance once wrote a poem called 'The Road Less
Traveled,' describing a journey he took through the woods along a path
most travelers never used. The poet found that the road less traveled
was peaceful but quite lonely, and he was probably a bit nervous as he
went along, because if anything happened on the road less traveled, the
other travelers would be on the road more frequently traveled and so
couldn't hear him as he cried for help. Sure enough, that poet is now
dead." --Lemony Snicket







E-Mail messages may contain viruses, worms, or other malicious code. By reading the message
and opening any attachments, the recipient accepts full responsibility for taking protective
action against such code. Sender is not liable for any loss or damage arising from this message.

The information in this e-mail is confidential and may be legally privileged. It is intended
solely for the addressee(s). Access to this e-mail by anyone else is unauthorized.

Mime
View raw message