Bug 60257 - SearchPattern API: R_CASE_SENSITIVE vs. boolean isCaseSensitive
Summary: SearchPattern API: R_CASE_SENSITIVE vs. boolean isCaseSensitive
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P2 minor (vote)
Target Milestone: 3.0 M9   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-28 10:59 EDT by Markus Keller CLA
Modified: 2004-05-18 13:37 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2004-04-28 10:59:53 EDT
The SearchPattern API for stringPattern searches to java elements is somewhat odd:

There's a public constant R_CASE_SENSITIVE, which is not mentioned in the javadoc of
createPattern(String stringPattern, int searchFor, int limitTo, int matchMode,
boolean isCaseSensitive)
, and there's also an extra boolean parameter isCaseSensitive.

I don't see why R_CASE_SENSITIVE is made public if it should not be used by
clients. On the other hand, it could also be turned into an official bit-flag
and the boolean isCaseSensitive removed. To have both options seems strange to me.
Comment 1 Philipe Mulet CLA 2004-04-28 13:13:36 EDT
This was the intent, but somehow we left the old code in.
Comment 2 Jerome Lanneluc CLA 2004-04-29 04:41:20 EDT
In I20040428, SearchPattern.isCaseSensitive() has been removed. However 
SearchPattern.createPattern(String stringPattern, int searchFor, int limitTo, 
int matchMode, boolean isCaseSensitive) still exists. To be consistent I 
propose that we replace it with SearchPattern.createPattern(String 
stringPattern, int searchFor, int limitTo, int matchRule). 

Markus and Thomas, would JDT UI be able to switch to this new method for next 
integration build ?
Comment 3 Thomas M??der CLA 2004-04-29 05:09:46 EDT
Sure, it's just a matter of reaplacing the constant, right?
Comment 4 Jerome Lanneluc CLA 2004-04-29 05:48:48 EDT
Yes this should be straightforward: createPattern(stringPattern, searchFor, 
limitTo, isCaseSensitive ? matchMode | R_CASE_SENSITIVE : matchMode)
Comment 5 Markus Keller CLA 2004-04-29 06:07:16 EDT
Sounds good. Jerome, can you give us a migration period to avoid hassles with
the breaking API change? It would be best for us if you could release the new
SearchPattern.createPattern(String stringPattern, int searchFor, int limitTo,
int matchRule) and still retain the old (deprecated) method with the boolean for
a day. We could then migrate to the new API without ever having compile errors.
Comment 6 Jerome Lanneluc CLA 2004-04-29 12:13:58 EDT
Added new API that takes a matchRule, and deprecated the old one.
Please let me know when I can remove the old API.
Comment 7 Markus Keller CLA 2004-04-29 12:30:27 EDT
I'll take care of the references in jdt.ui and jdt.junit tomorrow, so that we
are ready to live without it by next Monday.

I saw that jdt.debug.ui also has 2 references to the deprecated method.
Jerome, could you contact them to know when they have migrated?

BTW: The javadoc of the new method still contains old @param isCaseSensitive.
Comment 8 Jerome Lanneluc CLA 2004-04-29 12:39:48 EDT
Thanks Markus for catching the @param problem.

Darin, will you be able to move to the new API for next integration build?

Comment 9 Jerome Lanneluc CLA 2004-04-30 04:41:32 EDT
Entered bug 60538 against JDT Debug as a reminder.
Comment 10 Markus Keller CLA 2004-04-30 14:44:20 EDT
Removed references to the old method from jdt.ui and jdt.junit in HEAD.
Comment 11 Frederic Fusier CLA 2004-05-18 13:37:00 EDT
Verified for 3.0 M9 with build I200405180816.