Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ajdt-dev] Problem when weaving aspects boxed in a jar file

This problem occurs if the compiler sees an 'old' format version of an
aspect.  Are you *definetly* using the same version of AspectJ/AJDT
when going through this sequence?

Normally it occurs because some aspect has been built with compiler
version 'A' and then binary weaving is attempted (eg. using aspect
path) with compiler version 'B' - because 'A' wrote out the pointcut
attribute in an older style, compiler 'B' chokes on it when it sees
it.  This is happening a lot lately because we are working on Java5
language features which are causing us to constantly change the format
of the attributes - there is no guarantee that two dev builds of
AspectJ5 will be compatible.  The only thing we are trying to
guarantee right now is that the final version of AspectJ5 will be able
to understand AspectJ 1.2.1 built code.

Andy.
---
Andy Clement
AspectJ Dev.


On 05/08/05, PESSEMIER Nicolas <Nicolas.Pessemier@xxxxxxx> wrote:
> Hi everyone,
> 
> I'm encountering the following exception when I'm trying to use
> AspectJ aspects
> contained in a jar:
> 
> BCException thrown: malformed org.aspectj.weaver.PointcutDeclaration
> attribute
> java.io.EOFException
> 
> I'll explain the problem with a simple 2 projects example.
> In the first eclipse project I write a Trace.aj aspect (very simple
> around advice
> code).
> 
> public aspect Trace {
>     pointcut toBeTraced():
>         execution( void *.*());
> 
>     void around():toBeTraced(){
>         System.out.println("before method call
> "+thisJoinPoint.getSignature());
>         proceed();
>         System.out.println("after method call
> "+thisJoinPoint.getSignature());
>     }
> }
> 
> I compile this aspect with the reweavable option, and I make a jar
> with this file:
> trace.jar
> Then, I have a second eclipse project with a Test.java class such as
> the following
> one:
> 
> public class MyClass {
> 
>     public void run() {
>         System.out.println(this.getClass().getName()+".run() :-)");
>     }
>     public static void main(String[] args) {
>         new MyClass().run();
>     }
> }
> 
> Then, I set the "AspectJ Aspect Path" with the trace.aj file (on the
> 2nd project
> properties), and the exception is thrown.
> 
> Note that I do not have this problem if I'm using Eclipse 3.0 with the
> first version of
> the ajdt plugin.
> The problem arises when I'm using Eclipse 3.0 or Eclipse 3.1 with the
> ajdt plugin
> version >1.2.
> 
> The problem is not an AspectJ problem because if I'm doing the same
> procedure
> with an ant file, the weaving is working well.
> 
> any idea? maybe a bug in ajdt? I'm not sure.
> 
> Regards,
> Nicolas
> 
> _______________________________________________
> ajdt-dev mailing list
> ajdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/ajdt-dev
>


Back to the top