Community
Participate
Working Groups
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.5) Gecko/2009010218 Gentoo Firefox/3.0.5 Build Identifier: 20090619-0625 AspectJ 1.6.6 I cannot yet fully reproduce this issue, but it happens quite often. I'll try to investigate it better and produce a test case if I manage to, but it will not be easy. While writing an aspect in the AJ editor, I frequently use the CTRL+SPACE to have Eclipse resolve a class name and add the import clause. Sometimes, it adds the new import, but removes all the other imports that were there. Hitting CTRL-Z reverts the removed imports, but trying it again removes them again, so I usually end up inserting the import manually. If i insert the import manually and use CTRL+SPACE on the "import" line (and not in code) the problem does not appear. Closing and reopening eclipse removes the error, and this make it hard to reproduce, cause it does not always happen on the same aspects. Sometimes you are editing an aspect for hours without this problem, then it happens, then you close eclipse and go back working on it another day and it works properly. Reproducible: Sometimes
Hmmm...I think I know what is happening here. The class ImportRewrite (in JDT not AJDT) is in control of adding and removing imports from a compilation unit. When adding imports from a content assist proposal, all imports are analyzed and if an import can't be matched, then it is removed. AJDT generally does a pretty good job of making sure that all import references are found, but sometimes they are missed. Without checking directly, this may have something to do with pointcuts not being properly parsed. Question: are the missing imports coming from references in pointcuts? My guess is yes. I'll see if there's something I can do here. But, if you can find a failing test case for me, that would be very helpful.
Hi Andrew, thanks for answering. Imports for pointcuts are sometimes removed if using CTRL+O (Organize imports), but the bug we are facing is a complete removal of all imports except the one that is currently being added. Since it is "state related" (it does not happen always), could it be that JDT is using some "compilation unit state" that somehow gets corrupted? For example, if AspectJ build fails somewhere, could it be that the compilation unit "metadata" used by JDT to find imports is partial or corrupted, resulting in JDT removing all imports? Sorry if I'm using vague terminology, but I'm not a JDT expert and I don't have time right now to correctly investigate this bug deeper ... so I'm just guessing. I hope I'll have time to investigate this further during this weekend.
Try to solve for 2.1.0.
Determining what will be tackled for 2.1.1 release.
I've had this happen a few times, but haven't found a reproducible scenario yet. It feels like having errors in the aspect file makes it more likely to happen, but I don't have definitive proof.