Community
Participate
Working Groups
The source code of Shadow.class has pointed out that it may be a bug: ------ public abstract class Shadow { // every Shadow has a unique id, doesn't matter if it wraps... private static int nextShadowID = 100; // easier to spot than zero. // OPTIMIZE is this a bug? static? //.... } ------ It's quite easy to find that this code has problems in concurrency. One more step, maybe I'm the victim of this bug? I just built an application with Spring AOP which uses AspectJ. Randomly, the pointcut didn't work. Once happended, I have to restart the application, praying it can work, due to those caches in every layers. I spent several hours to confirm whether the interceptor was applied correctly. Interestingly, for the same class, sometimes it is correct and sometimes it is wrong. I was stuck on this piece of code: --- public final FuzzyBoolean match(Shadow shadow) { if (shadow.shadowId == lastMatchedShadowId) { return lastMatchedShadowResult; } //... } --- For some reason I couldn't know the last matched shadow. This makes the problem more complicated. So here's my dilemma. I don't know what happened before it entered, so I can’t confirm whether the last match was itself. I found another bug, but I'm not sure if this bug may cause the confusing behavior.
So, you did confirm the problem was with the nextShadowId field treatment? If you had a test project that demonstrated the issue, it would be much easier to get into (and I could potentially add a test case based on such a project).