Bug 199004 - [search] Java Search in 'JRE libraries' finds matches in Application Libraries
Summary: [search] Java Search in 'JRE libraries' finds matches in Application Libraries
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.4 M2   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-07 02:35 EDT by Dani Megert CLA
Modified: 2007-09-18 04:37 EDT (History)
3 users (show)

See Also:


Attachments
Proposed patch (27.90 KB, patch)
2007-08-08 09:55 EDT, Frederic Fusier CLA
no flags Details | Diff
Additional jar file for test (685 bytes, application/octet-stream)
2007-08-08 10:00 EDT, Frederic Fusier CLA
no flags Details
Additional patch (4.42 KB, patch)
2007-08-09 04:43 EDT, Frederic Fusier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2007-08-07 02:35:36 EDT
I20070806-0010

I only selected to search in 'JRE libraries' but Java search reports matches in application JARs too.

Marking as 'major' because the feature is broken.
Comment 1 Dani Megert CLA 2007-08-07 02:49:13 EDT
Here's a little test case:
1. start fresh workspace
2. checkout 'org.eclipse.ui.ide' from CVS
3. search for "openeditor" method declarations but only in JRE libraries
==> finds matches in application JARs.
Comment 2 Benno Baumgartner CLA 2007-08-07 03:34:50 EDT
It's also in 3.3.
Too many matches are found. I checked, that matches in JRE are also found.
I have no idea how to fix this.
Comment 3 Dani Megert CLA 2007-08-08 04:10:28 EDT
Let me investigate whether this is UI or Core.
Comment 4 Dani Megert CLA 2007-08-08 04:34:54 EDT
It's a bug with the scope. I verified that only IJavaSearchScope.SYSTEM_LIBRARIES (4) is passed in.

The resulting scope is:

JavaSearchScope on [
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.jface.text_3.4.0.v20070806-1800.jar
	C:\JavaSDKs\jdk1.5.0_10\jre\lib\ext\sunpkcs11.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.osgi_3.4.0.v20070803.jar
	C:\JavaSDKs\jdk1.5.0_10\jre\lib\rt.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.equinox.registry_3.4.0.v20070803.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.ui_3.3.0.I20070802-0800.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.update.ui_3.2.100.v20070615.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.ui.workbench_3.3.0.I20070802-0800.jar
	C:\JavaSDKs\jdk1.5.0_10\jre\lib\jsse.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.update.configurator_3.2.100.v20070615.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.equinox.common_3.3.0.v20070426.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.text_3.4.0.v20070806-1800.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.jface_3.3.0.I20070802-0800.jar
	C:\JavaSDKs\jdk1.5.0_10\jre\lib\charsets.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.core.runtime.compatibility.registry_3.2.200.v20070717\runtime_registry_compatibility.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.core.resources_3.3.100.v20070806.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.swt.win32.win32.x86_3.3.0.v3406.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.core.filesystem_1.1.100.v20070723.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.update.core_3.2.100.v20070615.jar
	C:\JavaSDKs\jdk1.5.0_10\jre\lib\ext\dnsns.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.ui.views_3.2.100.I20070319-0010.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.equinox.preferences_3.2.200.v20070723.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.core.jobs_3.3.100.v20070709.jar
	C:\JavaSDKs\jdk1.5.0_10\jre\lib\ext\sunjce_provider.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.equinox.app_1.0.100.v20070730.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.core.expressions_3.3.100.v20070806-1800.jar
	C:\JavaSDKs\jdk1.5.0_10\jre\lib\ext\localedata.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.core.runtime_3.3.100.v20070530.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.help_3.3.100.v20070726.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.core.commands_3.3.0.I20070605-0010.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.swt_3.3.0.v3406.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.core.contenttype_3.2.100.v20070319.jar
	C:\eclipse\drops\I20070807-0010\plugins\com.ibm.icu_3.6.1.v20070417.jar
	C:\JavaSDKs\jdk1.5.0_10\jre\lib\jce.jar
	C:\eclipse\drops\I20070807-0010\plugins\org.eclipse.ui.forms_3.3.100.v20070716.jar
]
Comment 5 Frederic Fusier CLA 2007-08-08 09:18:56 EDT
JavaSearchScope needs to verify that container kind is SYSTEM while filtering on SYSTEM_LIBRARIES mask (JavaSearchScope.add(...) line 154)
Comment 6 Frederic Fusier CLA 2007-08-08 09:55:07 EDT
Created attachment 75670 [details]
Proposed patch
Comment 7 Frederic Fusier CLA 2007-08-08 10:00:49 EDT
Created attachment 75671 [details]
Additional jar file for test

To pass additional tests, this jar needs to be put in workspace/JavaSearchBugs/lib folder of org.eclipse.jdt.core.tests.model project.
Comment 8 Frederic Fusier CLA 2007-08-08 11:29:59 EDT
Released for 3.4M2 in HEAD stream.
Comment 9 Dani Megert CLA 2007-08-09 03:14:24 EDT
I suggest to also fix this in 3.3.1.
Comment 10 Dani Megert CLA 2007-08-09 03:19:35 EDT
The fix breaks Open Type which uses a JavaWorkspaceScope (SearchEngine.createWorkspaceScope()): types in system libraries are no longer found and also Java search no longer works.
Comment 11 Benno Baumgartner CLA 2007-08-09 03:47:58 EDT
Content Assist is also affected: No more proposals for types in jre
Comment 12 Frederic Fusier CLA 2007-08-09 04:18:47 EDT
Damned! And all JDT/Core + JDT/UI passed with the patch I released...
So, we definitely lack some tests in our suites...
Comment 13 Frederic Fusier CLA 2007-08-09 04:43:05 EDT
Created attachment 75734 [details]
Additional patch

I *simply* forgot to include K_DEFAULT_SYSTEM container when SYSTEM_LIBRARIES is specified!
Comment 14 Frederic Fusier CLA 2007-08-09 06:19:45 EDT
New patch released in HEAD
Comment 15 Eric Jodet CLA 2007-09-18 03:48:25 EDT
Verified for 3.4 M2 using build I20070917-0010.