Bug 99915 - [search] Open Type: not yet saved types not found if case-sensitve name is entered
Summary: [search] Open Type: not yet saved types not found if case-sensitve name is en...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 RC3   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-14 05:35 EDT by Dani Megert CLA
Modified: 2005-06-16 13:39 EDT (History)
2 users (show)

See Also:


Attachments
Patch to fix this issue (927 bytes, patch)
2005-06-15 04:04 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 2005-06-14 05:36:00 EDT
3.1 RC3

Saved types are found when using case-sensitive names but this does not work for
not yet saved new types.

Example:
1. enter class AC {} and save
2. enter calss BC {} and do not save
3. open type
==> "AC" finds AC but "BC" does not find BC. However, typing just lowercase
letters "bc" finds BC.

Same is true for types named like "MiXeDClass".
Comment 1 Dirk Baeumer CLA 2005-06-14 06:09:07 EDT
Have to investigate if this is the dialog or search engine.
Comment 2 Dirk Baeumer CLA 2005-06-14 12:10:42 EDT
I tested it with the following case:

package p;

public class P {

}

class DoBr {}


- class DoBr added but not yet in the index since the file hasn't been saved.

Searching for DoBr makes the following call to searchAllTypeNames:

packagePattern:= null
pattern:= DoBr*
flags:= 2 (== SearchPattern.R_PATTERN_MATCH)
elementKind:= 0
scope:= workspace
IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH

This finds zero matches allthough such a class exists in the wortking copy of P

Searching for dobr makes the following call to searchAllTypeNames:

packagePattern:= null
pattern:= dobr*
flags:= 2 (== SearchPattern.R_PATTERN_MATCH)
elementKind:= 0
scope:= workspace
IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH

This correctly finds one match. 

So this seems to be a problem of the all types search method correctly handling
elements in working copies.

Moving to JDT/Core. Philippe, can you please investigate since this "hides"
types in the open type dialog. 
Comment 3 Philipe Mulet CLA 2005-06-14 15:44:58 EDT
Frederic - pls investigate. If fix is available, will candidate for RC3
Comment 4 Frederic Fusier CLA 2005-06-15 04:04:23 EDT
Created attachment 23132 [details]
Patch to fix this issue

Pattern type name provided to searchAllTypeNames is not lowercased as it should
be.
See javadoc comment of
CharOperation.match(char(],int,int,char[],int,int,boolean) method:
 * When not case sensitive, the pattern is assumed to already be lowercased,
the
 * name will be lowercased character per character as comparing.
Comment 5 Frederic Fusier CLA 2005-06-15 04:05:58 EDT
Philippe, please vote for this as fix is really simple and should not have any
impact...
Comment 6 Frederic Fusier CLA 2005-06-15 05:40:51 EDT
Note that all JDT tests (core + ui) pass using build N20050615-0010
Comment 7 Philipe Mulet CLA 2005-06-15 06:58:25 EDT
+1 for RC3.

Dani - pls cast your vote.
Comment 8 Dani Megert CLA 2005-06-15 07:22:42 EDT
+1 for 3.1 RC3
Comment 9 Frederic Fusier CLA 2005-06-15 07:56:56 EDT
Fixed and released in HEAD.

[jdt-core internal]
Test case added in WorkingCopySearchTests
Comment 10 Maxime Daniel CLA 2005-06-16 13:37:48 EDT
Verified using build N20050616-0010 + JDT Core HEAD.