Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] AspectJ implementation question: Additional Dependencies

Hi Wes!

Can you say what you mean by "direct dependency"?
Oh, sure. I think of a "direct dependency" if a class/interface is mentioned somewhere in the code of another class/interface. Because I am especially interested in the woven code we talk about the woven bytecode of a class and the compiled code of an aspect.

From my unterstanding the weaving part of the AspectJ compiler inserts code into classes that are affetced by an aspect. So the question is: Do the pieces of code that got inserted into a class contain only references to the aspect? Or is it possible to write an aspect in a way that the AspectJ compiler inserts parts of the aspect code (I wrote) in the affected class directly?

The reason for my question is that I have to analyse the additional "direct dependencies" between classes that might be introduced by an aspect. My current impression (or better my hope) is that the weaver inserts only calls to the aspect class so that any "direct dependencies" that I might wrote into an aspect to a third class remain inside the aspect code.

Hope that makes my question clearer. Sorry for the fuzzy topic. ;-)

-Martin



i.e., is it a direct dependency if a class A can load and resolve, but when you run a method of A, class B is loaded and hence required?

If I remember correctly, for class A to load, it must be able
to resolve all types for its fields and method return and parameter types (and presumably any type used in the static initializer or the static initializer for a static field being dereferenced). That means if there is a method return type or parameter refering to the Aspect type, and the aspect type requires a particular type, that type would
be loaded when class A is loaded.

Or are you only saying there is a direct dependency if there
is a field or extends/implements relationship (hasa or isa)?

Wes

Martin Lippert wrote:

Hi!

I have a question regarding the compiling and implementation of the AspectJ
language.

Lets imagine the following situation:
I have a class A and an aspect B. The aspect B uses class C to do something.
Aspect B affects class A in some way.

And now the question:
Is there any possibility to implement the aspect B in a way that the compiler
inserts an additional direct dependency from class A to class C? Or does the
compiler insert new dependencies only from class A to aspect B (where aspect B
still uses class C)?

For me the introduction features of AspectJ seems to allow the additional
dependency but in the same way the AspectJ compiler implementation might compile
and weave this differently (via delegation or something similar).

Thank you very much!!!

Best regards,
Martin

---
Martin Lippert
email: lippert@xxxxxxx

_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-dev

_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-dev




Back to the top