Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ajdt-dev] How to retrieve target IJavaElement from IAJCodeElement?

On Mon 23.Jun'08 at 13:55:45 -0700, Andy Clement wrote:
The model that you have access to through the guide on the wiki
provides everything about the relationships between elements, it is
all there and it is used to populate all the extra views we have,
and gutters markers, etc.   I'm surprised if it is insufficient for
method-calls and field-gets - that seems like it would be a big bug

That would be my assessment.

(or are you just talking about duplicate identical join points on
one line - which makes it a smaller bug?).

No, that's a different but related issue.

If you see the information in the cross reference view (or in the
problems view after activating the option to display weaveinfo
messages in there) then it should be accessible in the model.

Actually, no I don't see it there (please correct me if I am
mistaken).  From this view there doesn't seem to be a way to open the
declaration of the target method.

Ok, I just wrote this in a .aj file in eclipse:

public aspect A { before(): call(* m()) {} }

class C { public void m() { m();m();} }

and if I right click the gutter annotation against the line with the
m(); call on, I can navigate to the advice.

Ok, but that's not really the problem I was having ...

Or if I look in the xref view whilst that line is selected I can
navigate to the advice.  Does that not work for you?

It works fine. My issue was with the reverse, really.

Or do you mean you want to navigate to something else?

Yes, I would like to navigate from the advice (e.g., before(): call(*
m()) {} as above) to the advised method call *and then* to the
declaration of the compile time target method of that call. Of course, I
can do this by hand but not programmatically (easily/cleanly).

or is it that you want more precise navigation?

No, the precision is not an issue.

Similarly I can navigate for this program:

public aspect A { before(): get(int i) {} // can navigate from here to
the advised location }

class C { int i = 5; int j; public void m() { j=i;j=i;} // can navigate
from here to advice }

The weaveinfo messages in the problems view are not navigable but their
existence tells me that the data is in the model for full navigation.

Making parts of that model accessible through more methods on
IAJCodeElement is a different requirement.

Yes, I agree but I believe it is highly related.

Hmm, not necessarily - making two calls on the same line appear as
different navigable elements in the gutter view and xref doesn't mean
we need to do anything for IAJCodeElement.

Sorry, some confusion here. What is highly related is the issue outlined
in this email and that of the model being accessible through more
methods on IAJCodeElement.

But I can see that you want navigation also to be implemented via
IAJCodeElements,

In fact, what I am looking for doesn't seem to be implemented anywhere.

so do raise an enhancement request for that.

Does my response make more sense now? Do you see what is indeed missing?
If so, I will file the request for enhancement. Thanks again!

Raffi


Back to the top