Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AJDT » Weaving an aspect into single class in jar
Weaving an aspect into single class in jar [message #71057] Wed, 16 January 2008 09:38 Go to next message
Eclipse User
Originally posted by: nullnullschneider.gmail.com

Hey there,
I have the following problem:
There is a jar file "test.jar" that contains only class files and no source.
Lets say test.jar has the following files
/p1/class1.class
/p1/class2.class
/p2/class3.class

Now I want to weave an aspect only into /p1/class1.class!

When I do it via commandline I get an error.

ajc -1.5 @classes_1.lst -d injectedProject Injector_1.aj -inpath inject
where classes_1.lst contains /p1/class1.class

Is this possible to do this? Can the compiler access single class files in a
jar archive? How do I have to address them? How do I tell the compiler which
class files it should use?

The source of this problem is a massive memory usage when I weave it into
the whole jar at once. Therefore I want to use multiple compiler calls and
weave it step by step. Would the incremental weaving supported by the
compiler also be an alternative?

Thanks,
Daniel
Re: Weaving an aspect into single class in jar [message #71121 is a reply to message #71057] Wed, 23 January 2008 19:42 Go to previous message
Eclipse User
Originally posted by: nullnullschneider.gmail.com

Hm, ok I try to formulate it in another way.

1) I have an aspect called aspect1.aj and a class file called MyClass.class
How do I tell ajc to weave aspect1.aj into MyClass.class? I do NOT have
the .java files.

ajc /path/to/aspect1.aj /path/to/MyClass.class
it does not work :(

2) If this class is located in a jar archive called MyJar.jar. There are
also some other classes included but I only want to inject the aspect into
the class MyClass.class

According to my previous example I tried

ajc /path/to/aspect1.aj /path/to/MyJar.jar!/MyClass.class
it does not work :(

if I use
ajc /path/to/aspect1.aj -inpath /path/to/MyJar.jar
it works fine but the aspect is injected into every class file!?! Am I
right?

An idea is to extract the jar and address the single class file and put it
all back into a jar. But the problem 1 still remains ;)

Any help? It should not be that complicated but i don't get it!

Geets,
Daniel
Re: Weaving an aspect into single class in jar [message #596639 is a reply to message #71057] Wed, 23 January 2008 19:42 Go to previous message
Eclipse User
Originally posted by: nullnullschneider.gmail.com

Hm, ok I try to formulate it in another way.

1) I have an aspect called aspect1.aj and a class file called MyClass.class
How do I tell ajc to weave aspect1.aj into MyClass.class? I do NOT have
the .java files.

ajc /path/to/aspect1.aj /path/to/MyClass.class
it does not work :(

2) If this class is located in a jar archive called MyJar.jar. There are
also some other classes included but I only want to inject the aspect into
the class MyClass.class

According to my previous example I tried

ajc /path/to/aspect1.aj /path/to/MyJar.jar!/MyClass.class
it does not work :(

if I use
ajc /path/to/aspect1.aj -inpath /path/to/MyJar.jar
it works fine but the aspect is injected into every class file!?! Am I
right?

An idea is to extract the jar and address the single class file and put it
all back into a jar. But the problem 1 still remains ;)

Any help? It should not be that complicated but i don't get it!

Geets,
Daniel
Previous Topic:Using AspectJ with PDE Builder
Next Topic:Developing a Aspectj based plugin - Newbie questions
Goto Forum:
  


Current Time: Thu Oct 02 08:30:43 GMT 2014

Powered by FUDForum. Page generated in 0.01700 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software