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?

>> 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.  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? Or do you mean you want to navigate to
something else? or is it that you want more precise navigation?

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.  But I can see that you
want navigation also to be implemented via IAJCodeElements, so do
raise an enhancement request for that.

Andy.


Back to the top