Community
Participate
Working Groups
The handles for initializers should contain a count that is computed based on the type it is declared in, not the compilation unit. Eg- The initializer of InnerInterAspect should be: pacakge p; public aspect HandleTestingAspect { static class InnerClass { { } static aspect InnerInnerAspect { static { } } } } =Handle Testing/src<p{HandleTestingAspect.aj}HandleTestingAspect[InnerClass}InnerInnerAspect|1 but Aspectj has it as =Handle Testing/src<p{HandleTestingAspect.aj}HandleTestingAspect[InnerClass}InnerInnerAspect|4 (I don't know why the count is 4. Maybe it is including some default initializers as well).
i cant recreate this, it is coming out as |1 for me for the code on this line: package p; public aspect HandleTestingAspect { static class InnerClass { { } static aspect InnerInnerAspect { static { } // <<<<<<<<<<<<<<<<< } } } Dont believe I fixed it with what I just changed...
(In reply to comment #1) > > Dont believe I fixed it with what I just changed... > I'll wait for the next drop of AspectJ into AJDT and see if it is now working.
with a new aj in, is this failing for you?
This is working 85% right now. I think the remaining part may be an AJDT problem. The handles are getting created properly. Gutter markers and navigation are working properly. The only thing not working is that the xref view seems not to refresh properly all the time. When moving cursor up and down sometimes the wrong around advice is being created. I will open an AJDT bug for that. You can close this bug. Thanks.
(In reply to comment #4) Oops...meant to put this comment on bug 263668. I am still seeing initializers with the wrong count on it.
Here is the full code of the case I am using. Maybe the problem has something to do with the full code. ------------------------------------------- package p; import java.util.ArrayList; public aspect HandleTestingAspect { static class InnerClass { int x; { } static aspect InnerInnerAspect { int x; static { } } public void doNothing() {} } before() : call(* *.doNothing()) { } before(int x, long y) : execution(* *.foo(int,long)) && args(x,y) { InnerClass u = new InnerClass() { public void doNothing() { doNothing(); } }; u.doNothing(); } interface X { } public void doNothing() {} // testing ITDs int X.X = 6; int X.itd() { } X.new() { } int X.itd(int x) { } X.new(int x) { } declare parents : HandleTestingClass extends InnerClass; declare parents : HandleTestingClass implements X; declare soft : Exception : execution(void HandleTestingClass.foo1(int,long)); declare error : call(void HandleTestingClass.foo1(int,long)) : ""; declare warning : call(void HandleTestingClass.foo2(int,long)) : ""; pointcut ypc(int y) : call(* *.yCall(int)) && args(y); pointcut zpc(int z) : call(* *.zCall(int)) && args(z); // should not have a count before(int y) : ypc(y) { } after(int y) : ypc(y) { } after(int y) throwing(Exception e) : ypc(y) { } after(int y) returning(int z) : ypc(y) { } int around(int y) : ypc(y) { return 1; } // should have a count before(int y) : zpc(y) { } after(int y) : zpc(y) { } after(int y) throwing(Exception e) : zpc(y) { } after(int y) returning(int z) : zpc(y) { } int around(int y) : ypc(y) { return 1; } // should have a count of 3 Object around(int y) : ypc(y) { return null; } after() returning(java.util.List z) : call(* *.zCall(int)) { } }
hmm, might be nice to have a code sample that compiled...... I added the missing HandleTestingClass, I removed the ITDs that dont work (lines 39-42), I then compiled and asked for the handle for line 13: <p{HandleTestingAspect.java}HandleTestingAspect[InnerClass}InnerInnerAspect|1 still seems fine to me. Were you getting wrong handles when the code is invalid? ie. with those ITDs in? Which testcase in AJDT can I run to investigate/see the failure?
Run the AJModelTest4 test. The test case purposely has some broken code in the sample project, but the class I sent you should compile properly.
In the code attached in comment 6: int X.itd() { } X.new() { } int X.itd(int x) { } X.new(int x) { } you can't itd ctors onto an interface. two of them don't return the value they are defined to. But I'll try running the test program you suggest.
I finally got round to running the AJModelTest4. It passes - and I can't see anything to uncomment that might get it to fail in such a way as there is something to debug with respect to handle counters. If this is still a problem, can you give me some code that compiles cleanly and yet shows the problem?
unsetting the target field which is currently set for something already released