Community
Participate
Working Groups
20050404 - Use the search dialog and create a Java working set that contains a new Java project. - Search - No result or only half of the results (see bug 82505) Probelm is BasicSearchEngine.createJavaSearchScope: It starts collecting the elements for the scope but with a problem just silently leaves the loop (line 145) I see the following solutions: - be more tollerant with Non- Java projects (make a IJavaProject.exists test before accessing getResolvedClasspath in JavaSearchScope.add(..) - only skip the problematic element, but collect elements for the rest - forward the exception to the client (new API)
It would be good if a IJavaSearchScope could deal with a non-Java project. We use the created IJavaSearchScope later as input for search UI participants. They might want to contribute results from non-Java project.
Of course new API will not be done for 3.1 as API is now frozen...
I do not understand the first solution: how can we be tolerant with Non-Java project although they cannot contain element which would be on the classpath and so will never be found by indexer... IMO, it's a Java search, user has to use textual search to find any other piece of information than Java ones... but perhaps I missed something? So, the only valid solution I see at this late stage (frozen APIs) is to skip the problematic element by catching the exception inside the loop instead of outside. That will allow search engine to collect elements for non problematic ones.
Fixed and released in HEAD. Even if first solution was valid, it would have been too risky to implement it at this late stage in 3.1 dvpt. So, Marting, if you're definitely convinced that Non-Java project should be added to JavaSearchScope, then open a new bug for this requirement to open discussion on this specific topic. So, fix consists in catching exception for non-java project to allow search engine continue normally on java ones... [jdt-core-internal] Changes done in BasicSearchEngine.createJavaSearchScope(IJavaElement[],int) No specific test case added as fix was really trivial... Note that all JDT/UI tests pass with this fix
With tolerating I meant the same as skipping. Do I have to skip the file now to avaid a log entry?
No, you do not. As execption is now catched for each project, all non-java projects are skipped and not added to JavaSearchScope. All others (ie. Java project) are added in JavaSearchScope and search is performed on them...
Verified for 3.1 M7 using build I20050509-2010 + jdt.core HEAD.