Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ajdt-dev] AJDT and ITDs

Hi Andrew,
thanks for the fast and in-depth answer. I arrived to ITDAwareNameEnvironment and was following my way back to "the core" of it. You gave me the right pointers.

I have basically this problem, and I was trying to understand internals of AJDT to see if this is achievable at all, and if I could eventually contribute somehow.

Suppose I have a User class, packaged in A.jar. Then I have an aspect ITD getIQ() on user, packaged in B.jar.

Now, from a different project, that "depends" on A.jar and B.jar, I want to call User.getIQ().

If I place A.jar on the inpath and B.jar on the aspectpath, AspectJ itself gives no error at all, and in fact there is no error in the package view. But if I open the .java or .aj file making the call, I can see reconciliation errors, and no ITD content assist for user.getIQ(). (should I raise a bug for this? I have it ready :D )

I'm using this construct (aspect libraries adding new functionalities to classes in different libraries using ITDs) all the way around, and then they are composed together on a third package that need to use the original classes with the additional functionalities. It works in AspectJ, but it is a pain while writing it in Eclipse, due to reconciliation errors and lack of content assist.

I was hoping that bug 271269 <https://bugs.eclipse.org/bugs/show_bug.cgi?id=271269> was somehow going to resolve this issue, but it seems that it adds "source->binary" ITDs, while "binary->binary" ITDs are not handled, while they work in AspectJ.


I noticed that in ITDAwareNameEnvironment, in the find(String,String) method, if the found type is a binary then no ITD interpolation is performed, and it does not exist an ITDAwareBinaryType* class.

Exploring the AJProjectModelFacade however I can see many places where it tries to access AJ data from resources in jar files or class files.

Is it a hard work to get that working? Theoretically if AJDT is able to extract ITDs from binary aspects, and to apply ITDs to binary classes (for bug 271269), the hardest pieces should be there.


Simone

Andrew Eisenberg wrote:
Sure.  AJDT uses the crosscutting model from AspectJ as the base.  The
entry point into the AspectJ model is the AJProjectModelFacade class
(and AJProjectModelFactory to create them).  This class allows you to
convert from IJavaElement handles to IProgramElement handles, as well
as ask interesting questions about what elements crosscut other
elements.

This information is used to seed content assist, gutter markers, the
crosscutting view, etc.  Gutter markers and crosscutting view are easy
since that is basically just taking a projection of the underlying
model and transforming it to the correct format.

ITD Aware content assist is a bit more complex because we need to
trick JDT into thinking that ITDs really exist in the target type.
ITDInserter and ITDAwareSourceTypeElementInfo are two classes that
handle this mocking up of ITDs.

There is a code sample on AJProjectModelFacade available on this wiki page:
http://wiki.eclipse.org/Developer%27s_guide_to_building_tools_on_top_of_AJDT_and_AspectJ

I'm happy to go into more detail if you have any questions.

On Wed, Jul 22, 2009 at 1:14 PM, Simone Gianni<simoneg@xxxxxxxxxx> wrote:
Hi all,
this is the first time I have a serious look at AJDT internals, so please
forgive me if I ask stupid questions :)

I'm trying to figure out how AJDT fetches information from the underlying
AJ, especially regarding ITDs. Does AJDT "re-reads" the .class files
generated by AJ build? Or does it parses pointcuts and check them using the
matcher? Or what else? :D

I'm talking about informations to display ITD content assist as well as
cross reference view, even if I think these use different methods.

If you can point me to relevant part of code I'll then try to figure it out
on my own.

Simone

--
Simone Gianni            CEO Semeru s.r.l.           Apache Committer
http://www.simonegianni.it/

_______________________________________________
ajdt-dev mailing list
ajdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ajdt-dev

_______________________________________________
ajdt-dev mailing list
ajdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ajdt-dev


--
Simone Gianni            CEO Semeru s.r.l.           Apache Committer
http://www.simonegianni.it/



Back to the top