Community
Participate
Working Groups
20205 attached JUnit-test AllTypesCacheTest.java: - load project 'org.eclipse.jdt.ui.tests' from dev.eclipse.org - copy AllTypesCacheTest next to AddUnimplementedMethodsTest.java - run it using the JUnit eclipse launcher (or use main() in AllTypesCacheTest (only if your workspace is complete and all projects are located in the default workspace)) 1. It seems that the index of the search is not updated after a JAR has been removed from the classpath failures in 'testClasspathChange()': - assertNull("mylib.Foo still found", findTypeRef(res1, "mylib.Foo")); - assertTrue("539 types in workspace expected, is " + res1.size(), res1.size() == 539); Library myLib contains 4 classes, like 'mylib.Foo', which are still found after the library has been removed from the classpath. 2. append the TestCase to the AutomatedSuite - append following line to AutomatedSuite.AutomatedSuite() addTest(AllTypesCacheTest.suite()); - run the whole test suite - it failes already in the first test of AllTypesCacheTest as even more types are found than when run separatly. It seems that index has not been completly emptied on tearDown of an other test.
Created attachment 320 [details] AllTypesCacheTest.java
Created attachment 321 [details] AllTypesCache.java
Could it be related to recent changes in the delta processor ?
Which version of jdt.ui is AllTypeCacheTests for? I tried with 20020205 and I cannot compile it. I tried the latest jdt.ui from HEAD, and I get a ClassCastException. Could you provide me with a self-contained test case?
Closing. Please re-open if you have a valid test case.
1. Load plugin 'org.eclipse.jdt.ui.tests' (its also in dev.eclipse) to your workspace for eclipse developement. 2. You find the latest version of AllTypesCacheTest in there. It can be runned from its main, if you have all requiered projects at the same locaion (No usage of projects pointing directly to the drop), or use the JUnit Eclipse launcher. Doing that you get 1 failure. (1.) 3. No go to AutomatedSuite and uncomment the last line in suite. Now also other test cases fail that succeeded before. (2)
What are the deleted types that are found? Where in the test suite code are they deleted?
all the element are from a JAR ('mylib.jar'.). This JAR is put on the classpath in setup (look for JavaProjectHelper.MYLIB), and removed from the classpath again in the test. However, the types contained are still found by search.
That's not what I'm seeing. I see that the 3 extra types are: 534: path= /TestProject2/src/pack1/ReqProjType.java; pkg= pack1; enclosing= ReqProjType; name= Inner 535: path= /TestProject2/src/pack1/ReqProjType.java; pkg= pack1; enclosing= ReqProjType.Inner; name= InnerInner 536: path= /TestProject2/src/pack1/ReqProjType.java; pkg= pack1; enclosing= ; name= ReqProjType Where are these types created and deleted?
These types come from JavaModelUtilTest.
First problem was because the same workspace scope was used before and after a classpath was changed. It was caching all the indexes visible in the workspace. Changed it (and all the scopes) so that they listen for the java element deltas and update their internal state when needed. Second problem was because the index of a project was not removed from disk when the project was deleted. As a result, when the same project was re- created, it would reuse the index and find extra-types. Now deleting the index when the project is deleted.