Bug 4368 - Wrong match in Java Search
Summary: Wrong match in Java Search
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P2 major (vote)
Target Milestone: 2.0 M1   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-11 08:51 EDT by Andre Weinand CLA
Modified: 2002-01-11 09:22 EST (History)
1 user (show)

See Also:


Attachments
Java file where the problem occurred (5.66 KB, text/java)
2001-10-11 08:55 EDT, Andre Weinand CLA
no flags Details
Here is a sreen copy that shows the search results (71.97 KB, application/octet-stream)
2001-10-25 09:29 EDT, Jerome Lanneluc CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andre Weinand CLA 2001-10-11 08:51:03 EDT
0.203
In Java Search I was searching for the type "Differencer" in the Compare plugin.
For the file CompilationUnitDelta.java I got 6 matches.
When stepping through them the second match was bogus.
Here is the relevant line of CompilationUnitDelta.java where the problem 
occured and the three matches:
		Differencer differencer= new Differencer() {
                11111111111
                 22222222222
                                             33333333333
I wasn't able to reproduce this problem with a standalone setup.
Comment 1 Andre Weinand CLA 2001-10-11 08:55:41 EDT
Created attachment 1 [details]
Java file where the problem occurred
Comment 2 Erich Gamma CLA 2001-10-12 05:48:33 EDT
pls investigate whether this is the matchlocator or the UI
Comment 3 Dani Megert CLA 2001-10-24 04:57:47 EDT
Searching the attached file works fine i.e. does not report the (wrong) match 
22222222222.
Comment 4 Dani Megert CLA 2001-10-24 07:12:28 EDT
Debugged on actual workspace (see 
http://www.zrh.oti.com/webprojects/jabiru2000/testing/EclipseWorkspace_4368.zip) 
with breakpoint in:
JavaSearchResultCollector.accept(...).

1.Match: OK
  start= 3886
  end= 3897
  enclosingElement= SourceMethod  (id=3128)
	fLEType= 9
	fName= "CompilationUnitDelta"
	fOccurrenceCount= 1
	fParameterTypes= String[2]  (id=3131)
	fParent= SourceType  (id=3132)
  accuracy= 0

2. Match (NOT OK)
  start= 3887
  end= 3898
  enclosingElement= SourceMethod  (id=3133)
	fLEType= 9
	fName= "CompilationUnitDelta"
	fOccurrenceCount= 1
	fParameterTypes= String[2]  (id=3136)
	fParent= SourceType  (id=3132)
  accuracy= 1

This 2nd match is reported as POTENTIAL match but it rather looks like search 
engine bug: why should "ifferencer " be a potential match?

Maybe it is an indexer problem but please note that I could reproduce the bug 
with a completely new workspace (see 
http://www.zrh.oti.com/webprojects/jabiru2000/testing/EclipseWorkspace_4368.zip)
.

Moving to JDT Core
Comment 5 Jerome Lanneluc CLA 2001-10-25 06:43:02 EDT
Downloaded EclipseWorkspace_4368.zip.
With 202a, I find 5 matches with correct positions in CompilationUnitDelta.java.
With 203 I find no matches at all in CompilationUnitDelta.java (it seems that 
search was broken in this build.)
With 205, I find 5 matches with correct positions in CompilationUnitDelta.java.
With our latest, I also find 5 matches with correct positions in 
CompilationUnitDelta.java.
Comment 6 Dani Megert CLA 2001-10-25 08:57:03 EDT
What's your 0.205 version?
  I used: jre-win32-Eclipse-SDK-SHIPPED-20011018.zip (aka 0.205)

I did the following steps (again):
1. Extract EclipseWorkspace_4368.zip to: D:\
2. Download 
http://home.ott.oti.com/hubba/drops/sdk/20011018/jre-win32-Eclipse-SDK-SHIPPED-2
0011018.zip
3. Extract jre-win32-Eclipse-SDK-SHIPPED-20011018.zip to D:\
4. Open D:\eclipse
5. Create shortcut for eclipse.exe:
      Target: D:\eclipse\eclipse.exe -data d:\EclipseWorkspace_Bug\plugins
6. Double-click the shortcut
7. Open Search Dialog
8. Search for type refs of "Differencer"
==> I get 6 results
Comment 7 Jerome Lanneluc CLA 2001-10-25 09:28:49 EDT
Followed exactly the above steps (except I didn't download again jre-win32-
Eclipse-SDK-SHIPPED-20011018.zip as I already had it).
After step 8, I got 80 matches in total, and CompilationUnitDelta had 5 matches.
Comment 8 Jerome Lanneluc CLA 2001-10-25 09:29:29 EDT
Created attachment 14 [details]
Here is a sreen copy that shows the search results
Comment 9 Dani Megert CLA 2001-10-25 13:12:24 EDT
Adam has repeated the test and could not reproduce either, so it is not just on 
your side.
I repeated the test on my machine once again (also using download)
==> bug still there

I know that the WindowsNT WinZip version behaves different than the Windows2000.
Ensure that eventually hidden files are also extracted.
Could you test if all files are extracted (unzip the workspace again - they were 
changed). The properties of d:\EclipseWorkspace_Bug should be:
	8486 files
	940 directories
	84192818 bytes

Regional Settings: English (United States)
Input Locale: German (Swiss)
Comment 10 Jerome Lanneluc CLA 2001-10-26 02:42:22 EDT
When looking at the properties of EclipseWorkspace_Bug, I also have:
	8486 files
	940 directories
	84192818 bytes
For the regional settings, the difference is that I have English (United 
States) as the input locale.
Comment 11 Dani Megert CLA 2001-10-29 05:40:07 EST
André verified the bug on his machine and can't reproduce either.
I guess the following could happen:
Eclipse fixes / changes files (index?) when an existing workspace is started on 
another machine than the one which it was created.

There was definitely a bug in the search/index infrastructure because André 
(Windows2000) and I (WindowsNT) have seen the bug. Ok to close if you don't have  
another idea where the bug could be.

Comment 12 Jerome Lanneluc CLA 2001-10-31 07:21:33 EST
This bug makes me think of bug "5021 Refactoring trashed my code" but I cannot 
be sure as I cannot reproduce the problem (even with a clean install).
Bug 5021 was fixed in 206/20011025.

Closing