| Summary: | Class reference searching not working. Complicates refactoring. | ||
|---|---|---|---|
| Product: | [Tools] AJDT | Reporter: | Stan Svec <stan.svec> |
| Component: | Core | Assignee: | AJDT-inbox <AJDT-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | critical | ||
| Priority: | P3 | CC: | andrew.eisenberg |
| Version: | 2.1.3 | ||
| Target Milestone: | 2.2.0 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
Stan Svec
Thanks for the description. I am able to reproduce this problem and I will have a deeper look over the next day or so. Interesting...if the file with references is a working copy (ie- it has unsaved changes), then the search results are correct, but if the file has no unsaved changes, then search does not work. I didn't notice before. Thank you for taking a look on it. I had orignally thought this problem was Very Bad. But, it is not. Here is what is happening: First, some background: There is something called a state file that is generated by JDT for each project after each build. It keeps track of references between compilation units and is generally used to help with incremental compilation. AspectJ does not create a state file (it keeps state in memory), but even if it did create a state file, it would not be compatible with JDT's. After a build, a state object is generated. It is occasionally written to disk, but not always. It is also cached in memory. On proper shutdown, it is always written to disk. The problem happens when a project was once a Java project and then it is converted to an AJ project. The state object remains cached in memory, and the one stored on disk is not deleted. And over time, this state object becomes outdated as the project changes. The Java search engine is being "smart" in that it wants to do a deep search on only the smallest amount of classes for references. So, if a state object exists for a project, the search engine looks at the state object to see the smallest amount of files that it *really* needs to search. The problem is that for AJ projects that have stale states around, this information will be incorrect and it will miss references inside of AJ projects. If, however, as is usually the case, the state object does not exist for the AJ project, then searching will occur (but it will be slightly less efficient than if there were a correct state file). Workaround: 1. Shut down eclipse 2. Open directory workspace/.metadata/.plugins/org.eclipse.core.resources/<AJ_Project_Name>/org.eclipse.jdt.core/ 3. delete state.dat 4. restart eclipse This should ensure that the state file and state object no longer exists for that project and searching will work correctly. Fix: AJDT needs to remove the cached state object and delete the state file when a project becomes and AJ project. Please let me know if this workaround does the trick for you. Fix is committed and will be available on the 3.7 branch in a few hours. Perfect. Workaround does the trick for me. Thank you for explanation and very fast reaction. |