Bug 40793 Primary working copies: Type search does not find type in modified CU
M2 See test cases AllTypesCacheTest.testWorkingCopies() & testWorkingCopies2(): Editor is opened and the type name of the opened type is modfied. testWorkingCopies(): editor is saved: new type is found in index but also old type is still found testWorkingCopies2(): editor is not saved: new type is not found in index
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/core/AllTypesCacheTest.java
assertNotNull("jre is null", JavaProjectHelper.addRTJar(fJProject2));
		
		
		File junitSrcArchive= JavaTestPlugin.getDefault().getFileInPlugin(JavaProjectHelper.JUNIT_SRC);
		assertTrue("Junit source", junitSrcArchive != null && junitSrcArchive.exists());
		ZipFile zipfile= new ZipFile(junitSrcArchive);
		fSourceFolder= JavaProjectHelper.addSourceContainerWithImport(fJProject2, "src", zipfile);
		
	}
	protected void tearDown() throws Exception {
		JavaProjectHelper.delete(fJProject1);
		JavaProjectHelper.delete(fJProject2);		
		
	}
	public void testDifferentScopes() throws Exception {
		IJavaSearchScope workspaceScope= SearchEngine.createWorkspaceScope();
		IJavaSearchScope proj1Scope= SearchEngine.createJavaSearchScope(new IJavaElement[] { fJProject1 });
		IJavaSearchScope proj2Scope= SearchEngine.createJavaSearchScope(new IJavaElement[] { fJProject2 });
		
		ArrayList res1= new ArrayList();
		
		AllTypesCache.getTypes(workspaceScope, IJavaSearchConstants.TYPE, null, res1);
		assertTrue("542 types in workspace expected, is " + res1.size(), res1.size() == 542);
		
		int nFlushes= AllTypesCache.getNumberOfCacheFlushes();
		
		res1.clear();		
		AllTypesCache.getTypes(workspaceScope, IJavaSearchConstants.INTERFACE, null, res1);
		assertTrue("73 interfaces in workspace expected, is " + res1.size(), res1.size() == 73);