Community
Participate
Working Groups
A project containing one class and one aspect: ----------------------------------------------------- package pack; public class C { public static void main(String[] args) { new C().sayHello(); } public void sayHello() { System.out.println("HELLO"); } } ---------------------------------------------------- package pack; public aspect A { declare warning : execution(* C.sayHello(..)) : "blah blah"; } ----------------------------------------------------- has the "matched by" entry for A.aj, but doesn't have the "matches declare" entry for C.java. This means that in AJDT, C.sayHello isn't added to our map and consequently we don't get any relationships showing in the Cross Reference view for A.aj.
Do you get them for other declares? Since I know we have done some work in AJ to support them - maybe the AJDE is out of date that is in AJDT, hmmm.
The related bug was bug 91090 - but that was only to do with the staticinitialization PCD. Worth seeing if this problem occurs if the declare warning is all on one line rather than split across multiple lines.
Yes, this problem still happens when the declare statement is on one line. It also happens with declare error.
Dumping out the structure model contents using the usual API call gives us this helpful output: === MODEL STATUS REPORT ========= After a batch build A.generated.lst [build configuration file] pack [package] A.java [java source file] K:\eclipse31m7\eclipse\runtime-workspace\A\A.java:1::0 import declarations [import reference] A [aspect] K:\eclipse31m7\eclipse\runtime-workspace\A\A.java:3::31 declare warning: "blah blah" [declare warning] K:\eclipse31m7\eclipse\runtime-workspace\A\A.java:5::42 C.java [java source file] K:\eclipse31m7\eclipse\runtime-workspace\A\C.java:1::0 import declarations [import reference] C [class] K:\eclipse31m7\eclipse\runtime-workspace\A\C.java:3::31 main(String[]) [method] K:\eclipse31m7\eclipse\runtime-workspace\A\C.java:5::58 sayHello() [method] K:\eclipse31m7\eclipse\runtime-workspace\A\C.java:9::124 === END OF MODEL REPORT ========= === RELATIONSHIPS REPORT ========= After a batch build Hid:1:(targets=1) K:\eclipse31m7\eclipse\runtime-workspace\A\A.java|5|0|42 (matc hed by) K:\eclipse31m7\eclipse\runtime-workspace\A\C.java|9|0|0 Hid:2:(targets=1) K:\eclipse31m7\eclipse\runtime-workspace\A\C.java|9|0|0 (match es declare) K:\eclipse31m7\eclipse\runtime-workspace\A\A.java|5|0|42 === END OF RELATIONSHIPS REPORT == === Properties of the model and relationships map ===== method=2 import reference=2 aspect=1 declare warning=1 class=1 RelationshipMapSize=2 build configuration file=1 FileMapSize=2 package=1 java source file=2 which says that the relationships do exist in both directions. The problem is with one of the endpoints. The problem is the ASM records line 9 like this: sayHello() [method] K:\eclipse31m7\eclipse\runtime-workspace\A\C.java:9::124 whilst the relationship map records it with handle: K:\eclipse31m7\eclipse\runtime-workspace\A\C.java|9|0|0 since the offsets don't match (one is 0, one is 124) then they aren't considered equivalent. The fix is to make sure the offset isn't lost.b
offset is now correctly preserved and "matches declare" relationship created in the case that the source is compiled by ajc (needs our MethodDeclarationLineNumber attribute). This is of course the case for AJDT which is the primary client of this feature.