View | Details | Raw Unified | Return to bug 201426 | Differences between
and this patch

Collapse All | Expand All

(-)search/org/eclipse/jdt/internal/core/search/matching/TypeReferencePattern.java (-5 / +5 lines)
Lines 51-57 Link Here
51
		((InternalSearchPattern)this).mustResolve = true; // always resolve (in case of a simple name reference being a potential match)
51
		((InternalSearchPattern)this).mustResolve = true; // always resolve (in case of a simple name reference being a potential match)
52
	}
52
	}
53
	/*
53
	/*
54
	 * Instanciate a type reference pattern with additional information for generics search
54
	 * Instantiate a type reference pattern with additional information for generics search
55
	 */
55
	 */
56
	public TypeReferencePattern(char[] qualification, char[] simpleName, String typeSignature, int matchRule) {
56
	public TypeReferencePattern(char[] qualification, char[] simpleName, String typeSignature, int matchRule) {
57
		this(qualification, simpleName,matchRule);
57
		this(qualification, simpleName,matchRule);
Lines 65-71 Link Here
65
		}
65
		}
66
	}
66
	}
67
	/*
67
	/*
68
	 * Instanciate a type reference pattern with additional information for generics search
68
	 * Instantiate a type reference pattern with additional information for generics search
69
	 */
69
	 */
70
	public TypeReferencePattern(char[] qualification, char[] simpleName, IType type, int matchRule) {
70
	public TypeReferencePattern(char[] qualification, char[] simpleName, IType type, int matchRule) {
71
		this(qualification, simpleName,matchRule);
71
		this(qualification, simpleName,matchRule);
Lines 84-90 Link Here
84
		if (this.simpleName != null)
84
		if (this.simpleName != null)
85
			return this.simpleName;
85
			return this.simpleName;
86
	
86
	
87
		// Optimization, eg. type reference is 'org.eclipse.jdt.core.*'
87
		// Optimization, e.g. type reference is 'org.eclipse.jdt.core.*'
88
		if (this.currentSegment >= 0) 
88
		if (this.currentSegment >= 0) 
89
			return this.segments[this.currentSegment];
89
			return this.segments[this.currentSegment];
90
		return null;
90
		return null;
Lines 95-103 Link Here
95
	protected boolean hasNextQuery() {
95
	protected boolean hasNextQuery() {
96
		if (this.segments == null) return false;
96
		if (this.segments == null) return false;
97
	
97
	
98
		// Optimization, eg. type reference is 'org.eclipse.jdt.core.*'
98
		// Optimization, e.g. type reference is 'org.eclipse.jdt.core.*'
99
		// if package has at least 4 segments, don't look at the first 2 since they are mostly
99
		// if package has at least 4 segments, don't look at the first 2 since they are mostly
100
		// redundant (eg. in 'org.eclipse.jdt.core.*' 'org.eclipse' is used all the time)
100
		// redundant (e.g. in 'org.eclipse.jdt.core.*' 'org.eclipse' is used all the time)
101
		return --this.currentSegment >= (this.segments.length >= 4 ? 2 : 0);
101
		return --this.currentSegment >= (this.segments.length >= 4 ? 2 : 0);
102
	}
102
	}
103
103
(-)search/org/eclipse/jdt/internal/core/search/matching/ConstructorPattern.java (-1 / +4 lines)
Lines 265-271 Link Here
265
265
266
	switch(getMatchMode()) {
266
	switch(getMatchMode()) {
267
		case R_EXACT_MATCH :
267
		case R_EXACT_MATCH :
268
			if (this.isCamelCase) break;
269
			if (this.declaringSimpleName != null && this.parameterCount >= 0 && !this.varargs)
268
			if (this.declaringSimpleName != null && this.parameterCount >= 0 && !this.varargs)
270
				key = createIndexKey(this.declaringSimpleName, this.parameterCount);
269
				key = createIndexKey(this.declaringSimpleName, this.parameterCount);
271
			else { // do a prefix query with the declaringSimpleName
270
			else { // do a prefix query with the declaringSimpleName
Lines 286-291 Link Here
286
		case R_REGEXP_MATCH :
285
		case R_REGEXP_MATCH :
287
			// TODO (frederic) implement regular expression match
286
			// TODO (frederic) implement regular expression match
288
			break;
287
			break;
288
		case R_CAMELCASE_MATCH:
289
		case R_CAMELCASE_SAME_PART_COUNT_MATCH:
290
			// do a prefix query with the declaringSimpleName
291
			break;
289
	}
292
	}
290
293
291
	return index.query(getIndexCategories(), key, matchRule); // match rule is irrelevant when the key is null
294
	return index.query(getIndexCategories(), key, matchRule); // match rule is irrelevant when the key is null
(-)search/org/eclipse/jdt/internal/core/search/matching/MultiTypeDeclarationPattern.java (-7 / +9 lines)
Lines 38-44 Link Here
38
38
39
	this(matchRule);
39
	this(matchRule);
40
40
41
	if (isCaseSensitive() || qualifications == null) {
41
	if (this.isCaseSensitive || qualifications == null) {
42
		this.qualifications = qualifications;
42
		this.qualifications = qualifications;
43
	} else {
43
	} else {
44
		int length = qualifications.length;
44
		int length = qualifications.length;
Lines 122-133 Link Here
122
				// do a prefix query with the simpleName
122
				// do a prefix query with the simpleName
123
				break;
123
				break;
124
			case R_EXACT_MATCH :
124
			case R_EXACT_MATCH :
125
				if (!this.isCamelCase) {
125
				// do a prefix query with the simpleName
126
					// do a prefix query with the simpleName
126
				matchRule &= ~R_EXACT_MATCH;
127
					matchRule &= ~R_EXACT_MATCH;
127
				matchRule |= R_PREFIX_MATCH;
128
					matchRule |= R_PREFIX_MATCH;
128
				key = CharOperation.append(key, SEPARATOR);
129
					key = CharOperation.append(key, SEPARATOR);
130
				}
131
				break;
129
				break;
132
			case R_PATTERN_MATCH :
130
			case R_PATTERN_MATCH :
133
				if (key[key.length - 1] != '*')
131
				if (key[key.length - 1] != '*')
Lines 136-141 Link Here
136
			case R_REGEXP_MATCH :
134
			case R_REGEXP_MATCH :
137
				// TODO (frederic) implement regular expression match
135
				// TODO (frederic) implement regular expression match
138
				break;
136
				break;
137
			case R_CAMELCASE_MATCH:
138
			case R_CAMELCASE_SAME_PART_COUNT_MATCH:
139
				// do a prefix query with the simpleName
140
				break;
139
		}
141
		}
140
142
141
		EntryResult[] entries = index.query(getIndexCategories(), key, matchRule); // match rule is irrelevant when the key is null
143
		EntryResult[] entries = index.query(getIndexCategories(), key, matchRule); // match rule is irrelevant when the key is null
(-)search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java (-1 / +4 lines)
Lines 308-314 Link Here
308
308
309
	switch(getMatchMode()) {
309
	switch(getMatchMode()) {
310
		case R_EXACT_MATCH :
310
		case R_EXACT_MATCH :
311
			if (this.isCamelCase) break;
312
			if (this.selector != null && this.parameterCount >= 0 && !this.varargs)
311
			if (this.selector != null && this.parameterCount >= 0 && !this.varargs)
313
				key = createIndexKey(this.selector, this.parameterCount);
312
				key = createIndexKey(this.selector, this.parameterCount);
314
			else { // do a prefix query with the selector
313
			else { // do a prefix query with the selector
Lines 329-334 Link Here
329
		case R_REGEXP_MATCH :
328
		case R_REGEXP_MATCH :
330
			// TODO (frederic) implement regular expression match
329
			// TODO (frederic) implement regular expression match
331
			break;
330
			break;
331
		case R_CAMELCASE_MATCH:
332
		case R_CAMELCASE_SAME_PART_COUNT_MATCH:
333
			// do a prefix query with the selector
334
			break;
332
	}
335
	}
333
336
334
	return index.query(getIndexCategories(), key, matchRule); // match rule is irrelevant when the key is null
337
	return index.query(getIndexCategories(), key, matchRule); // match rule is irrelevant when the key is null
(-)search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java (-6 / +14 lines)
Lines 112-123 Link Here
112
			return IMPOSSIBLE_MATCH;
112
			return IMPOSSIBLE_MATCH;
113
		}
113
		}
114
		boolean matchFirstChar = !this.isCaseSensitive || (qualifiedPattern[0] == qualifiedTypeName[0]);
114
		boolean matchFirstChar = !this.isCaseSensitive || (qualifiedPattern[0] == qualifiedTypeName[0]);
115
		if (this.isCamelCase) {
116
			if (matchFirstChar && CharOperation.camelCaseMatch(qualifiedPattern, qualifiedTypeName, (this.matchMode & SearchPattern.R_PREFIX_MATCH) != 0)) {
117
				return POSSIBLE_MATCH;
118
			}
119
			if (this.isCaseSensitive) return IMPOSSIBLE_MATCH;
120
		}
121
		switch (this.matchMode) {
115
		switch (this.matchMode) {
122
			case SearchPattern.R_EXACT_MATCH:
116
			case SearchPattern.R_EXACT_MATCH:
123
			case SearchPattern.R_PREFIX_MATCH:
117
			case SearchPattern.R_PREFIX_MATCH:
Lines 135-140 Link Here
135
			case SearchPattern.R_REGEXP_MATCH :
129
			case SearchPattern.R_REGEXP_MATCH :
136
				// TODO (frederic) implement regular expression match
130
				// TODO (frederic) implement regular expression match
137
				break;
131
				break;
132
			case SearchPattern.R_CAMELCASE_MATCH:
133
				if (matchFirstChar && CharOperation.camelCaseMatch(qualifiedPattern, qualifiedTypeName, false)) {
134
					return POSSIBLE_MATCH;
135
				}
136
				// if camel case does not match then try a insensitive prefix match if allowed
137
				if (!this.isCaseSensitive && CharOperation.prefixEquals(qualifiedPattern, qualifiedTypeName, false)) {
138
					return POSSIBLE_MATCH;
139
				}
140
				break;
141
			case SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH:
142
				if (matchFirstChar && CharOperation.camelCaseMatch(qualifiedPattern, qualifiedTypeName, true)) {
143
					return POSSIBLE_MATCH;
144
				}
145
				break;
138
		}
146
		}
139
	}
147
	}
140
	return IMPOSSIBLE_MATCH;
148
	return IMPOSSIBLE_MATCH;
(-)search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferencePattern.java (-1 / +4 lines)
Lines 248-254 Link Here
248
	// cannot include the superQualification since it may not exist in the index
248
	// cannot include the superQualification since it may not exist in the index
249
	switch(getMatchMode()) {
249
	switch(getMatchMode()) {
250
		case R_EXACT_MATCH :
250
		case R_EXACT_MATCH :
251
			if (this.isCamelCase) break;
252
			// do a prefix query with the superSimpleName
251
			// do a prefix query with the superSimpleName
253
			matchRule &= ~R_EXACT_MATCH;
252
			matchRule &= ~R_EXACT_MATCH;
254
			matchRule |= R_PREFIX_MATCH;
253
			matchRule |= R_PREFIX_MATCH;
Lines 264-269 Link Here
264
		case R_REGEXP_MATCH :
263
		case R_REGEXP_MATCH :
265
			// TODO (frederic) implement regular expression match
264
			// TODO (frederic) implement regular expression match
266
			break;
265
			break;
266
		case R_CAMELCASE_MATCH:
267
		case R_CAMELCASE_SAME_PART_COUNT_MATCH:
268
			// do a prefix query with the superSimpleName
269
			break;
267
	}
270
	}
268
271
269
	return index.query(getIndexCategories(), key, matchRule); // match rule is irrelevant when the key is null
272
	return index.query(getIndexCategories(), key, matchRule); // match rule is irrelevant when the key is null
(-)search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java (-7 / +15 lines)
Lines 29-35 Link Here
29
	 * Whether this pattern is case sensitive.
29
	 * Whether this pattern is case sensitive.
30
	 */
30
	 */
31
	boolean isCaseSensitive;
31
	boolean isCaseSensitive;
32
33
	/*
32
	/*
34
	 * Whether this pattern is camel case.
33
	 * Whether this pattern is camel case.
35
	 */
34
	 */
Lines 42-48 Link Here
42
	 *		<li>{@link #R_PREFIX_MATCH}</li>
41
	 *		<li>{@link #R_PREFIX_MATCH}</li>
43
	 *		<li>{@link #R_PATTERN_MATCH}</li>
42
	 *		<li>{@link #R_PATTERN_MATCH}</li>
44
	 *		<li>{@link #R_REGEXP_MATCH}</li>
43
	 *		<li>{@link #R_REGEXP_MATCH}</li>
45
	 *		<li>{@link #R_CAMEL_CASE_MATCH}</li>
44
	 *		<li>{@link #R_CAMELCASE_MATCH}</li>
45
	 *		<li>{@link #R_CAMELCASE_SAME_PART_COUNT_MATCH}</li>
46
	 * </ul>
46
	 * </ul>
47
	 */
47
	 */
48
	int matchMode;
48
	int matchMode;
Lines 55-61 Link Here
55
	/**
55
	/**
56
	 * Mask used on match rule for match mode.
56
	 * Mask used on match rule for match mode.
57
	 */
57
	 */
58
	public static final int MATCH_MODE_MASK = R_EXACT_MATCH | R_PREFIX_MATCH | R_PATTERN_MATCH | R_REGEXP_MATCH;
58
	public static final int MATCH_MODE_MASK = R_EXACT_MATCH
59
		| R_PREFIX_MATCH 
60
		| R_PATTERN_MATCH 
61
		| R_REGEXP_MATCH 
62
		| R_CAMELCASE_MATCH
63
		| R_CAMELCASE_SAME_PART_COUNT_MATCH;
59
64
60
	/**
65
	/**
61
	 * Mask used on match rule for generic relevance.
66
	 * Mask used on match rule for generic relevance.
Lines 75-81 Link Here
75
		// see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=81377
80
		// see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=81377
76
		int rule = getMatchRule();
81
		int rule = getMatchRule();
77
		this.isCaseSensitive = (rule & R_CASE_SENSITIVE) != 0;
82
		this.isCaseSensitive = (rule & R_CASE_SENSITIVE) != 0;
78
		this.isCamelCase = (rule & R_CAMEL_CASE_MATCH) != 0;
83
		this.isCamelCase = (rule & (R_CAMELCASE_MATCH | R_CAMELCASE_SAME_PART_COUNT_MATCH)) != 0;
79
		this.matchCompatibility = rule & MATCH_COMPATIBILITY_MASK;
84
		this.matchCompatibility = rule & MATCH_COMPATIBILITY_MASK;
80
		this.matchMode = rule & MATCH_MODE_MASK;
85
		this.matchMode = rule & MATCH_MODE_MASK;
81
	}
86
	}
Lines 252-260 Link Here
252
			output.append(this.typeSignatures[0]);
257
			output.append(this.typeSignatures[0]);
253
			output.append("\", "); //$NON-NLS-1$
258
			output.append("\", "); //$NON-NLS-1$
254
		}
259
		}
255
		if (this.isCamelCase) {
256
			output.append("camel case + "); //$NON-NLS-1$
257
		}
258
		switch(getMatchMode()) {
260
		switch(getMatchMode()) {
259
			case R_EXACT_MATCH : 
261
			case R_EXACT_MATCH : 
260
				output.append("exact match,"); //$NON-NLS-1$
262
				output.append("exact match,"); //$NON-NLS-1$
Lines 268-273 Link Here
268
			case R_REGEXP_MATCH :
270
			case R_REGEXP_MATCH :
269
				output.append("regexp match, "); //$NON-NLS-1$
271
				output.append("regexp match, "); //$NON-NLS-1$
270
				break;
272
				break;
273
			case R_CAMELCASE_MATCH :
274
				output.append("camel case match, "); //$NON-NLS-1$
275
				break;
276
			case R_CAMELCASE_SAME_PART_COUNT_MATCH:
277
				output.append("camel case same part count match, "); //$NON-NLS-1$
278
				break;
271
		}
279
		}
272
		if (isCaseSensitive())
280
		if (isCaseSensitive())
273
			output.append(" case sensitive"); //$NON-NLS-1$
281
			output.append(" case sensitive"); //$NON-NLS-1$
(-)search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java (-12 / +22 lines)
Lines 95-128 Link Here
95
protected int matchLevelForTokens(char[][] tokens) {
95
protected int matchLevelForTokens(char[][] tokens) {
96
	if (this.pattern.pkgName == null) return ACCURATE_MATCH;
96
	if (this.pattern.pkgName == null) return ACCURATE_MATCH;
97
97
98
	char[] packageName = null;
99
	if (this.isCamelCase) {
100
		packageName = CharOperation.concatWith(tokens, '.');
101
		if (CharOperation.camelCaseMatch(this.pattern.pkgName, packageName, (this.matchMode & SearchPattern.R_PREFIX_MATCH) != 0)) {
102
			return POSSIBLE_MATCH;
103
		}
104
		if (this.isCaseSensitive) return IMPOSSIBLE_MATCH;
105
	}
106
	switch (this.matchMode) {
98
	switch (this.matchMode) {
107
		case SearchPattern.R_EXACT_MATCH:
99
		case SearchPattern.R_EXACT_MATCH:
108
		case SearchPattern.R_PREFIX_MATCH:
100
		case SearchPattern.R_PREFIX_MATCH:
109
			if (packageName==null) packageName = CharOperation.concatWith(tokens, '.');
101
			if (CharOperation.prefixEquals(this.pattern.pkgName, CharOperation.concatWith(tokens, '.'), this.isCaseSensitive)) {
110
			if (CharOperation.prefixEquals(this.pattern.pkgName, packageName, this.isCaseSensitive)) {
111
				return POSSIBLE_MATCH;
102
				return POSSIBLE_MATCH;
112
			}
103
			}
113
			break;
104
			break;
105
114
		case SearchPattern.R_PATTERN_MATCH:
106
		case SearchPattern.R_PATTERN_MATCH:
115
			char[] patternName = this.pattern.pkgName[this.pattern.pkgName.length - 1] == '*'
107
			char[] patternName = this.pattern.pkgName[this.pattern.pkgName.length - 1] == '*'
116
				? this.pattern.pkgName
108
				? this.pattern.pkgName
117
				: CharOperation.concat(this.pattern.pkgName, ".*".toCharArray()); //$NON-NLS-1$
109
				: CharOperation.concat(this.pattern.pkgName, ".*".toCharArray()); //$NON-NLS-1$
118
			if (packageName==null) packageName = CharOperation.concatWith(tokens, '.');
110
			if (CharOperation.match(patternName, CharOperation.concatWith(tokens, '.'), this.isCaseSensitive)) {
119
			if (CharOperation.match(patternName, packageName, this.isCaseSensitive)) {
120
				return POSSIBLE_MATCH;
111
				return POSSIBLE_MATCH;
121
			}
112
			}
122
			break;
113
			break;
114
123
		case SearchPattern.R_REGEXP_MATCH :
115
		case SearchPattern.R_REGEXP_MATCH :
124
			// TODO (frederic) implement regular expression match
116
			// TODO (frederic) implement regular expression match
125
			break;
117
			break;
118
119
		case SearchPattern.R_CAMELCASE_MATCH:
120
			char[] packageName = CharOperation.concatWith(tokens, '.');
121
			if (CharOperation.camelCaseMatch(this.pattern.pkgName, packageName, false)) {
122
				return POSSIBLE_MATCH;
123
			}
124
			// if camel case does not match then try a insensitive prefix match if allowed
125
			if (!this.isCaseSensitive && CharOperation.prefixEquals(this.pattern.pkgName, packageName, false)) {
126
				return POSSIBLE_MATCH;
127
			}
128
			break;
129
130
		case SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH:
131
			packageName = CharOperation.concatWith(tokens, '.');
132
			if (CharOperation.camelCaseMatch(this.pattern.pkgName, CharOperation.concatWith(tokens, '.'), true)) {
133
				return POSSIBLE_MATCH;
134
			}
135
			break;
126
	}
136
	}
127
	return IMPOSSIBLE_MATCH;
137
	return IMPOSSIBLE_MATCH;
128
}
138
}
(-)search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java (-1 / +4 lines)
Lines 264-270 Link Here
264
			// do a prefix query with the simpleName
264
			// do a prefix query with the simpleName
265
			break;
265
			break;
266
		case R_EXACT_MATCH :
266
		case R_EXACT_MATCH :
267
			if (this.isCamelCase) break;
268
			matchRule &= ~R_EXACT_MATCH;
267
			matchRule &= ~R_EXACT_MATCH;
269
			if (this.simpleName != null) {
268
			if (this.simpleName != null) {
270
				matchRule |= R_PREFIX_MATCH;
269
				matchRule |= R_PREFIX_MATCH;
Lines 302-307 Link Here
302
		case R_REGEXP_MATCH :
301
		case R_REGEXP_MATCH :
303
			// TODO (frederic) implement regular expression match
302
			// TODO (frederic) implement regular expression match
304
			break;
303
			break;
304
		case R_CAMELCASE_MATCH:
305
		case R_CAMELCASE_SAME_PART_COUNT_MATCH:
306
			// do a prefix query with the simpleName
307
			break;
305
	}
308
	}
306
309
307
	return index.query(getIndexCategories(), key, matchRule); // match rule is irrelevant when the key is null
310
	return index.query(getIndexCategories(), key, matchRule); // match rule is irrelevant when the key is null
(-)search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java (-24 / +45 lines)
Lines 23-29 Link Here
23
// store pattern info
23
// store pattern info
24
protected int matchMode;
24
protected int matchMode;
25
protected boolean isCaseSensitive;
25
protected boolean isCaseSensitive;
26
protected boolean isCamelCase;
27
protected boolean isEquivalentMatch;
26
protected boolean isEquivalentMatch;
28
protected boolean isErasureMatch;
27
protected boolean isErasureMatch;
29
protected boolean mustResolve;
28
protected boolean mustResolve;
Lines 118-124 Link Here
118
public PatternLocator(SearchPattern pattern) {
117
public PatternLocator(SearchPattern pattern) {
119
	int matchRule = pattern.getMatchRule();
118
	int matchRule = pattern.getMatchRule();
120
	this.isCaseSensitive = (matchRule & SearchPattern.R_CASE_SENSITIVE) != 0;
119
	this.isCaseSensitive = (matchRule & SearchPattern.R_CASE_SENSITIVE) != 0;
121
	this.isCamelCase = (matchRule & SearchPattern.R_CAMEL_CASE_MATCH) != 0;
122
	this.isErasureMatch = (matchRule & SearchPattern.R_ERASURE_MATCH) != 0;
120
	this.isErasureMatch = (matchRule & SearchPattern.R_ERASURE_MATCH) != 0;
123
	this.isEquivalentMatch = (matchRule & SearchPattern.R_EQUIVALENT_MATCH) != 0;
121
	this.isEquivalentMatch = (matchRule & SearchPattern.R_EQUIVALENT_MATCH) != 0;
124
	this.matchMode = matchRule & JavaSearchPattern.MATCH_MODE_MASK;
122
	this.matchMode = matchRule & JavaSearchPattern.MATCH_MODE_MASK;
Lines 282-304 Link Here
282
	boolean matchFirstChar = !this.isCaseSensitive || pattern[0] == name[0];
280
	boolean matchFirstChar = !this.isCaseSensitive || pattern[0] == name[0];
283
	boolean sameLength = pattern.length == name.length;
281
	boolean sameLength = pattern.length == name.length;
284
	boolean canBePrefix = name.length >= pattern.length;
282
	boolean canBePrefix = name.length >= pattern.length;
285
	if (this.isCamelCase) {
286
		if (matchFirstChar && CharOperation.camelCaseMatch(pattern, name, (this.matchMode & SearchPattern.R_PREFIX_MATCH) != 0)) {
287
			return POSSIBLE_MATCH;
288
		}
289
		if (this.isCaseSensitive) return IMPOSSIBLE_MATCH;
290
	}
291
	switch (this.matchMode) {
283
	switch (this.matchMode) {
292
		case SearchPattern.R_EXACT_MATCH:
284
		case SearchPattern.R_EXACT_MATCH:
293
			if (sameLength && matchFirstChar && CharOperation.equals(pattern, name, this.isCaseSensitive)) {
285
			if (sameLength && matchFirstChar && CharOperation.equals(pattern, name, this.isCaseSensitive)) {
294
				return POSSIBLE_MATCH | EXACT_FLAVOR;
286
				return POSSIBLE_MATCH | EXACT_FLAVOR;
295
			}
287
			}
296
			break;
288
			break;
289
297
		case SearchPattern.R_PREFIX_MATCH:
290
		case SearchPattern.R_PREFIX_MATCH:
298
			if (canBePrefix && matchFirstChar && CharOperation.prefixEquals(pattern, name, this.isCaseSensitive)) {
291
			if (canBePrefix && matchFirstChar && CharOperation.prefixEquals(pattern, name, this.isCaseSensitive)) {
299
				return POSSIBLE_MATCH;
292
				return POSSIBLE_MATCH;
300
			}
293
			}
301
			break;
294
			break;
295
302
		case SearchPattern.R_PATTERN_MATCH:
296
		case SearchPattern.R_PATTERN_MATCH:
303
			// TODO_PERFS (frederic) Not sure this lowercase is necessary
297
			// TODO_PERFS (frederic) Not sure this lowercase is necessary
304
			if (!this.isCaseSensitive) {
298
			if (!this.isCaseSensitive) {
Lines 308-316 Link Here
308
				return POSSIBLE_MATCH;
302
				return POSSIBLE_MATCH;
309
			}
303
			}
310
			break;
304
			break;
305
311
		case SearchPattern.R_REGEXP_MATCH :
306
		case SearchPattern.R_REGEXP_MATCH :
312
			// TODO (frederic) implement regular expression match
307
			// TODO (frederic) implement regular expression match
313
			break;
308
			break;
309
310
		case SearchPattern.R_CAMELCASE_MATCH:
311
			if (CharOperation.camelCaseMatch(pattern, name, false)) {
312
				return POSSIBLE_MATCH;
313
			}
314
			// if camel case does not match then try a insensitive prefix match if allowed
315
			if (!this.isCaseSensitive && CharOperation.prefixEquals(pattern, name, false)) {
316
				return POSSIBLE_MATCH;
317
			}
318
			break;
319
320
		case SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH:
321
			if (CharOperation.camelCaseMatch(pattern, name, true)) {
322
				return POSSIBLE_MATCH;
323
			}
324
			break;
314
	}
325
	}
315
	return IMPOSSIBLE_MATCH;
326
	return IMPOSSIBLE_MATCH;
316
}
327
}
Lines 712-736 Link Here
712
		sourceName =  getQualifiedSourceName(binding);
723
		sourceName =  getQualifiedSourceName(binding);
713
	}
724
	}
714
	if (sourceName == null) return IMPOSSIBLE_MATCH;
725
	if (sourceName == null) return IMPOSSIBLE_MATCH;
715
	if ((this.matchMode & SearchPattern.R_PREFIX_MATCH) != 0) {
726
	switch (this.matchMode) {
716
		if (CharOperation.prefixEquals(qualifiedPattern, sourceName, this.isCaseSensitive)) {
727
		case SearchPattern.R_PREFIX_MATCH:
717
			return ACCURATE_MATCH;
728
			if (CharOperation.prefixEquals(qualifiedPattern, sourceName, this.isCaseSensitive)) {
718
		}
729
				return ACCURATE_MATCH;
719
	}
730
			}
720
	if (this.isCamelCase) {
731
			break;
721
		if ((qualifiedPattern.length>0 && sourceName.length>0 && qualifiedPattern[0] == sourceName[0])) {
732
		case SearchPattern.R_CAMELCASE_MATCH:
722
			if (CharOperation.camelCaseMatch(qualifiedPattern, sourceName, (this.matchMode & SearchPattern.R_PREFIX_MATCH) != 0)) {
733
			if ((qualifiedPattern.length>0 && sourceName.length>0 && qualifiedPattern[0] == sourceName[0])) {
734
				if (CharOperation.camelCaseMatch(qualifiedPattern, sourceName, false)) {
735
					return ACCURATE_MATCH;
736
				}
737
			}
738
			if (!this.isCaseSensitive && CharOperation.prefixEquals(qualifiedPattern, sourceName, false)) {
739
				return ACCURATE_MATCH;
740
			}
741
			break;
742
		case SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH:
743
			if ((qualifiedPattern.length>0 && sourceName.length>0 && qualifiedPattern[0] == sourceName[0])) {
744
				if (CharOperation.camelCaseMatch(qualifiedPattern, sourceName, true)) {
745
					return ACCURATE_MATCH;
746
				}
747
			}
748
			break;
749
		default:
750
			if (CharOperation.match(qualifiedPattern, sourceName, this.isCaseSensitive)) {
723
				return ACCURATE_MATCH;
751
				return ACCURATE_MATCH;
724
			}
752
			}
725
		}
726
		if (!this.isCaseSensitive && this.matchMode == SearchPattern.R_EXACT_MATCH) {
727
			boolean matchPattern = CharOperation.equals(qualifiedPattern, sourceName, false);
728
			return matchPattern ? ACCURATE_MATCH : IMPOSSIBLE_MATCH;
729
		}
730
	}
753
	}
731
	boolean matchPattern = CharOperation.match(qualifiedPattern, sourceName, this.isCaseSensitive);
754
	return IMPOSSIBLE_MATCH;
732
	return matchPattern ? ACCURATE_MATCH : IMPOSSIBLE_MATCH;
733
734
}
755
}
735
756
736
/**
757
/**
(-)search/org/eclipse/jdt/internal/core/search/matching/AndPattern.java (-1 / +1 lines)
Lines 31-37 Link Here
31
	return (combined & (R_EXACT_MATCH | R_PREFIX_MATCH | R_PATTERN_MATCH | R_REGEXP_MATCH))
31
	return (combined & (R_EXACT_MATCH | R_PREFIX_MATCH | R_PATTERN_MATCH | R_REGEXP_MATCH))
32
		| (combined & R_CASE_SENSITIVE)
32
		| (combined & R_CASE_SENSITIVE)
33
		| compatibility
33
		| compatibility
34
		| (combined & R_CAMEL_CASE_MATCH);
34
		| (combined & (R_CAMELCASE_MATCH | R_CAMELCASE_SAME_PART_COUNT_MATCH));
35
}
35
}
36
36
37
public AndPattern(SearchPattern leftPattern, SearchPattern rightPattern) {
37
public AndPattern(SearchPattern leftPattern, SearchPattern rightPattern) {
(-)buildnotes_jdt-core.html (-1 / +108 lines)
Lines 49-58 Link Here
49
<ul>
49
<ul>
50
<li>Added API <code>IJavaElementDelta#F_RESOLVED_CLASSPATH_CHANGED</code>. This flag is set when the resolved classpath of a Java project changes.
50
<li>Added API <code>IJavaElementDelta#F_RESOLVED_CLASSPATH_CHANGED</code>. This flag is set when the resolved classpath of a Java project changes.
51
     This is independent from <code>IJavaElementDelta#F_CLASSPATH_CHANGED</code> which indicates that the raw classpath has changed.</li>
51
     This is independent from <code>IJavaElementDelta#F_CLASSPATH_CHANGED</code> which indicates that the raw classpath has changed.</li>
52
<li>Added API <code>SearchPattern#R_CAMELCASE_SAME_PART_COUNT_MATCH</code>.<br>
53
This constant tells Search Engine to report matches which have <b>exactly</b>
54
the same count of parts (i.e. uppercase characters) than the Camel Case pattern 
55
(see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=201426">bug 201426</a>):
56
<pre>
57
/**
58
 * Match rule: The search pattern contains a Camel Case expression with
59
 * a strict expected number of parts.
60
 *
61
 * Examples:
62
 * 	. 'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types,
63
 * 	  but not 'HashMapEntry'
64
 * 	. 'HMap' type string pattern will still match previous 'HashMap' and
65
 * 	  'HtmlMapper' types, but not 'HighMagnitude'
66
 *
67
 * This rule is not intended to be combined with any other match rule. In case
68
 * of other match rule flags are combined with this one, then match rule validation
69
 * will return a modified rule in order to perform a better appropriate search request
70
 * (see {@link #validateMatchRule(String, int)} for more details).
71
 *
72
 * @see CharOperation#camelCaseMatch(char[], char[], boolean) for a detailed
73
 * explanation of Camel Case matching.
74
 *
75
 * @since 3.4
76
 */
77
public static final int R_CAMELCASE_SAME_PART_COUNT_MATCH = 0x0100;
78
</pre>
79
Note that this constant replace previous one <code>R_CAMEL_CASE_MATCH</code>
80
added while fixing <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=124624">bug 124624</a>.<br>
81
Also note that <code>R_CAMELCASE_MATCH</code> is no longer deprecated as, finally,
82
Camel Case match rule flags are not supposed to be combined with other ones (e.g.
83
<code>R_PREFIX_MATCH</code> or <code>R_PATTERN_MATCH</code>).
84
</li>
85
<li><code>CharOperation</code> and <code>SearchPattern</code> Camel Case API methods
86
added while fixing <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=124624">bug 124624</a>)
87
have been modified to clarify the behavior of the additional boolean parameter.<br>
88
This parameter now indicates whether the pattern and the name should have the same
89
count of parts (i.e. uppercase characters) or not:
90
<pre>
91
/**
92
 *...
93
 * CamelCase can be restricted to match only the same count of parts. When this
94
 * restriction is specified the given pattern and the given name must have <b>exactly</b>
95
 * the same number of parts (i.e. the same number of uppercase characters).
96
 * For instance, 'HM' , 'HaMa' and  'HMap' patterns will match 'HashMap' and
97
 * 'HatMapper' <b>but not</b> 'HashMapEntry'.
98
 *...
99
 * . pattern = "HM".toCharArray()
100
 * name = "HashMapEntry".toCharArray()
101
 * result => (samePartCount == false)
102
 *...
103
 * @param samePartCount flag telling whether the pattern and the name should
104
 * 	have the same count of parts or not.
105
 * 	&nbsp;&nbsp;For example:
106
 * 		. 'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types,
107
 * 				but not 'HashMapEntry'
108
 * 		. 'HMap' type string pattern will still match previous 'HashMap' and
109
 * 				'HtmlMapper' types, but not 'HighMagnitude'
110
 * @return true if the pattern matches the given name, false otherwise
111
 * @since 3.4
112
 */
113
public static final boolean camelCaseMatch(char[] pattern, char[] name, boolean samePartCount) {
114
...
115
}
116
117
/**
118
 *...
119
 * CamelCase can be restricted to match only the same count of parts. When this
120
 * restriction is specified the given pattern and the given name must have <b>exactly</b>
121
 * the same number of parts (i.e. the same number of uppercase characters).
122
 * For instance, 'HM' , 'HaMa' and  'HMap' patterns will match 'HashMap' and
123
 * 'HatMapper' <b>but not</b> 'HashMapEntry'.
124
 *...
125
 * . pattern = "HM".toCharArray()
126
 * patternStart = 0
127
 * patternEnd = 2
128
 * name = "HashMapEntry".toCharArray()
129
 * nameStart = 0
130
 * nameEnd = 12
131
 * result => (samePartCount == false)
132
 *...
133
 * @param samePartCount flag telling whether the pattern and the name should
134
 * 	have the same count of parts or not.
135
 * 	&nbsp;&nbsp;For example:
136
 * 		. 'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types,
137
 * 				but not 'HashMapEntry'
138
 * 		. 'HMap' type string pattern will still match previous 'HashMap' and
139
 * 				'HtmlMapper' types, but not 'HighMagnitude'
140
 * @return true if a sub-pattern matches the sub-part of the given name, false otherwise
141
 * @since 3.4
142
 */
143
public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd, boolean prefixMatch) {
144
...
145
}
146
</pre>
147
Note that similar modifications have been done on <code>SearchPattern</code>
148
corresponding methods:
149
<pre>
150
public static final boolean camelCaseMatch(String pattern, String name, boolean samePartCount) {
151
...
152
}
153
public static final boolean camelCaseMatch(String pattern, int patternStart, int patternEnd, String name, int nameStart, int nameEnd, boolean samePartCount) {
154
...
155
}
156
</li>
52
</ul>
157
</ul>
53
158
54
<h3>Problem Reports Fixed</h3>
159
<h3>Problem Reports Fixed</h3>
55
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=204339">204339</a>
160
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=201426">201426</a>
161
[search] New SearchPattern constant R_CAMEL_CASE_MATCH name may be misleading for users
162
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=204339">204339</a>
56
[compiler] Invalid length for missing package declaration in empty package-info.java file
163
[compiler] Invalid length for missing package declaration in empty package-info.java file
57
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=203587">203587</a>
164
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=203587">203587</a>
58
Improve messages consistency in case of generic methods having same erasure
165
Improve messages consistency in case of generic methods having same erasure
(-)compiler/org/eclipse/jdt/core/compiler/CharOperation.java (-192 / +145 lines)
Lines 202-235 Link Here
202
 * but are not always considered as leading character. For instance, both
202
 * but are not always considered as leading character. For instance, both
203
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
203
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
204
 * <p>
204
 * <p>
205
 * This method allows prefix match in Camel Case (see
205
 * Using this method allows matching names to have more parts than the specified
206
 * {@link #camelCaseMatch(char[], char[], boolean)}).
206
 * pattern (see {@link #camelCaseMatch(char[], char[], boolean)}).<br>
207
 * For instance, 'HM' , 'HaMa' and  'HMap' patterns will match 'HashMap',
208
 * 'HatMapper' <b>and also</b> 'HashMapEntry'.
207
 * <p>
209
 * <p>
208
 * <pre>
210
 * <pre>
209
 * Examples:<ol>
211
 * Examples:<ol>
210
 * <li> pattern = { 'N', 'P', 'E' }
212
 * <li> pattern = "NPE".toCharArray()
211
 * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
213
 * name = "NullPointerException".toCharArray()
212
 * result => true</li>
214
 * result => true</li>
213
 * <li> pattern = { 'N', 'P', 'E' }
215
 * <li> pattern = "NPE".toCharArray()
214
 * name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
216
 * name = "NoPermissionException".toCharArray()
215
 * result => true</li>
217
 * result => true</li>
216
 * <li> pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
218
 * <li> pattern = "NuPoEx".toCharArray()
217
 * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
219
 * name = "NullPointerException".toCharArray()
218
 * result => true</li>
220
 * result => true</li>
219
 * <li> pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
221
 * <li> pattern = "NuPoEx".toCharArray()
220
 * name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
222
 * name = "NoPermissionException".toCharArray()
221
 * result => false</li>
223
 * result => false</li>
222
 * <li> pattern = { 'n', p', 'e' }
224
 * <li> pattern = "npe".toCharArray()
223
 * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
225
 * name = "NullPointerException".toCharArray()
224
 * result => false</li>
226
 * result => false</li>
225
 * <li> pattern = { 'I', 'P', 'L', '3' }
227
 * <li> pattern = "IPL3".toCharArray()
226
 * name = { 'I', 'P', 'e', 'r', 's', 'p', 'e', 'c', 't', 'i', 'v', 'e', 'L', 'i', 's', 't', 'e', 'n', 'e', 'r', '3' }
228
 * name = "IPerspectiveListener3".toCharArray()
227
 * result => true</li>
229
 * result => true</li>
228
 * <li> pattern = { 'H', M' }
230
 * <li> pattern = "HM".toCharArray()
229
 * name = { 'H', 'a', 's', 'h', 'M', 'a', 'p', 'E', 'n', 't', 'r', 'y' }
231
 * name = "HashMapEntry".toCharArray()
230
 * result => true</li>
231
 * <li>pattern = { 'H', M', 'a', 'p' }
232
 * name = { 'H', 'a', 't', 'M', 'a', 'p', 'p', 'e', 'r' }
233
 * result => true</li>
232
 * result => true</li>
234
 * </ol></pre>
233
 * </ol></pre>
235
 * 
234
 * 
Lines 244-250 Link Here
244
	if (name == null)
243
	if (name == null)
245
		return false; // null name cannot match
244
		return false; // null name cannot match
246
245
247
	return camelCaseMatch(pattern, 0, pattern.length, name, 0, name.length, true/*prefix match*/);
246
	return camelCaseMatch(pattern, 0, pattern.length, name, 0, name.length, false/*not the same count of parts*/);
248
}
247
}
249
248
250
/**
249
/**
Lines 272-345 Link Here
272
 * but are not always considered as leading character. For instance, both
271
 * but are not always considered as leading character. For instance, both
273
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
272
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
274
 * <p>
273
 * <p>
275
 * CamelCase may or may not match prefixes depending on the given parameter.
274
 * CamelCase can be restricted to match only the same count of parts. When this
276
 * When the prefix match parameter is <code>true</code>, the given pattern can
275
 * restriction is specified the given pattern and the given name must have <b>exactly</b>
277
 * match only a prefix of the given name. For instance, 'HM' , 'HaMa' and  'HMap'
276
 * the same number of parts (i.e. the same number of uppercase characters).<br>
278
 * patterns will all match 'HashMap', 'HatMapper' <b>and</b> 'HashMapEntry'.
277
 * For instance, 'HM' , 'HaMa' and  'HMap' patterns will match 'HashMap' and
279
 * <br>
278
 * 'HatMapper' <b>but not</b> 'HashMapEntry'.
280
 * Reversely, if the prefix match parameter is <code>false</code>, then pattern
281
 * and name must have <b>exactly</b> the same number of parts, and their last
282
 * parts must be identical if they contain lowercase characters.
283
 * For instance, 'HMap' and 'HaMap' patterns will match 'HashMap' but neither
284
 * 'HashMapEntry' nor 'HatMapper'. Note that when the last part does not contain
285
 * lowercase characters, then the name may end with lowercase characters.
286
 * So, 'HM' pattern will match both 'HashMap' <b>and</b> 'HatMapper' but will not
287
 * match 'HashMapEntry'.
288
 * <p>
279
 * <p>
289
 * <pre>
280
 * <pre>
290
 * Examples:<ol>
281
 * Examples:<ol>
291
 * <li> pattern = { 'N', 'P', 'E' }
282
 * <li> pattern = "NPE".toCharArray()
292
 * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
283
 * name = "NullPointerException".toCharArray()
293
 * result => true</li>
284
 * result => true</li>
294
 * <li> pattern = { 'N', 'P', 'E' }
285
 * <li> pattern = "NPE".toCharArray()
295
 * name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
286
 * name = "NoPermissionException".toCharArray()
296
 * result => true</li>
287
 * result => true</li>
297
 * <li> pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
288
 * <li> pattern = "NuPoEx".toCharArray()
298
 * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
289
 * name = "NullPointerException".toCharArray()
299
 * result => true</li>
290
 * result => true</li>
300
 * <li> pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
291
 * <li> pattern = "NuPoEx".toCharArray()
301
 * name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
292
 * name = "NoPermissionException".toCharArray()
302
 * result => false</li>
293
 * result => false</li>
303
 * <li> pattern = { 'n', p', 'e' }
294
 * <li> pattern = "npe".toCharArray()
304
 * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
295
 * name = "NullPointerException".toCharArray()
305
 * result => false</li>
296
 * result => false</li>
306
 * <li> pattern = { 'I', 'P', 'L', '3' }
297
 * <li> pattern = "IPL3".toCharArray()
307
 * name = { 'I', 'P', 'e', 'r', 's', 'p', 'e', 'c', 't', 'i', 'v', 'e', 'L', 'i', 's', 't', 'e', 'n', 'e', 'r', '3' }
298
 * name = "IPerspectiveListener3".toCharArray()
308
 * result => true</li>
299
 * result => true</li>
309
 * <li> pattern = { 'H', M' }
300
 * <li> pattern = "HM".toCharArray()
310
 * name = { 'H', 'a', 's', 'h', 'M', 'a', 'p', 'E', 'n', 't', 'r', 'y' }
301
 * name = "HashMapEntry".toCharArray()
311
 * result => (prefixMatch == true)</li>
302
 * result => (samePartCount == false)</li>
312
 * <li> pattern = { 'H', M', 'a', 'p' }
313
 * name = { 'H', 'a', 't', 'M', 'a', 'p', 'p', 'e', 'r' }
314
 * result => (prefixMatch == true)</li>
315
 * </ol></pre>
303
 * </ol></pre>
316
 * 
304
 * 
317
 * @param pattern the given pattern
305
 * @param pattern the given pattern
318
 * @param name the given name
306
 * @param name the given name
319
 * @param prefixMatch flag telling whether the pattern can match name prefix or not.
307
 * @param samePartCount flag telling whether the pattern and the name should
308
 * 	have the same count of parts or not.<br>
309
 * 	&nbsp;&nbsp;For example:
320
 * 	<ul>
310
 * 	<ul>
321
 * 		<li>For example, when it's <code>true</code>:<br>
311
 * 		<li>'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types,
322
 * 			- 'HM' type string pattern will match  'HashMap' and 'HtmlMapper' types,
312
 * 				but not 'HashMapEntry'</li>
323
 * 			  but not 'HashMapEntry'<br>
313
 * 		<li>'HMap' type string pattern will still match previous 'HashMap' and
324
 * 			- 'HMap' type string pattern will match  'HashMap' type but not 'HtmlMapper'.
314
 * 				'HtmlMapper' types, but not 'HighMagnitude'</li>
325
 * 		</li>
326
 * 		<li>and, when it's <code>false</code>:<br>
327
 * 			- 'HM' type string pattern will match both   'HashMap' and 'HtmlMapper'
328
 * 			  and 'HashMapEntry'<br>
329
 * 			- 'HMap' type string pattern will match both 'HashMap' and 'HtmlMapper'
330
 * 			  types.
331
 * 		</li>
332
 * 	</ul>
315
 * 	</ul>
333
 * @return true if the pattern matches the given name, false otherwise
316
 * @return true if the pattern matches the given name, false otherwise
334
 * @since 3.4
317
 * @since 3.4
335
 */
318
 */
336
public static final boolean camelCaseMatch(char[] pattern, char[] name, boolean prefixMatch) {
319
public static final boolean camelCaseMatch(char[] pattern, char[] name, boolean samePartCount) {
337
	if (pattern == null)
320
	if (pattern == null)
338
		return true; // null pattern is equivalent to '*'
321
		return true; // null pattern is equivalent to '*'
339
	if (name == null)
322
	if (name == null)
340
		return false; // null name cannot match
323
		return false; // null name cannot match
341
324
342
	return camelCaseMatch(pattern, 0, pattern.length, name, 0, name.length, prefixMatch);
325
	return camelCaseMatch(pattern, 0, pattern.length, name, 0, name.length, samePartCount);
343
}
326
}
344
327
345
/**
328
/**
Lines 373-443 Link Here
373
 * but are not always considered as leading character. For instance, both
356
 * but are not always considered as leading character. For instance, both
374
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
357
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
375
 * <p>
358
 * <p>
376
 * This method allows prefix match in Camel Case (see
359
 * Using this method allows matching names to have more parts than the specified
377
 * {@link #camelCaseMatch(char[], int, int, char[], int, int, boolean)}).
360
 * pattern (see {@link #camelCaseMatch(char[], int, int, char[], int, int, boolean)}).<br>
361
 * For instance, 'HM' , 'HaMa' and  'HMap' patterns will match 'HashMap',
362
 * 'HatMapper' <b>and also</b> 'HashMapEntry'.
378
 * <p>
363
 * <p>
379
 * Examples:
364
 * Examples:
380
 * <ol>
365
 * <ol>
381
 * <li><pre>
366
 * <li> pattern = "NPE".toCharArray()
382
 *    pattern = { 'N', 'P', 'E' }
367
 * patternStart = 0
383
 *    patternStart = 0
368
 * patternEnd = 3
384
 *    patternEnd = 3
369
 * name = "NullPointerException".toCharArray()
385
 *    name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
370
 * nameStart = 0
386
 *    nameStart = 0
371
 * nameEnd = 20
387
 *    nameEnd = 20
372
 * result => true</li>
388
 *    result => true
373
 * <li> pattern = "NPE".toCharArray()
389
 * </pre>
374
 * patternStart = 0
390
 * </li>
375
 * patternEnd = 3
391
 * <li><pre>
376
 * name = "NoPermissionException".toCharArray()
392
 *    pattern = { 'N', 'P', 'E' }
377
 * nameStart = 0
393
 *    patternStart = 0
378
 * nameEnd = 21
394
 *    patternEnd = 3
379
 * result => true</li>
395
 *    name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
380
 * <li> pattern = "NuPoEx".toCharArray()
396
 *    nameStart = 0
381
 * patternStart = 0
397
 *    nameEnd = 21
382
 * patternEnd = 6
398
 *    result => true
383
 * name = "NullPointerException".toCharArray()
399
 * </pre>
384
 * nameStart = 0
400
 * </li>
385
 * nameEnd = 20
401
 * <li><pre>
386
 * result => true</li>
402
 *    pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
387
 * <li> pattern = "NuPoEx".toCharArray()
403
 *    patternStart = 0
388
 * patternStart = 0
404
 *    patternEnd = 6
389
 * patternEnd = 6
405
 *    name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
390
 * name = "NoPermissionException".toCharArray()
406
 *    nameStart = 0
391
 * nameStart = 0
407
 *    nameEnd = 20
392
 * nameEnd = 21
408
 *    result => true
393
 * result => false</li>
409
 * </pre>
394
 * <li> pattern = "npe".toCharArray()
410
 * </li>
395
 * patternStart = 0
411
 * <li><pre>
396
 * patternEnd = 3
412
 *    pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
397
 * name = "NullPointerException".toCharArray()
413
 *    patternStart = 0
398
 * nameStart = 0
414
 *    patternEnd = 6
399
 * nameEnd = 20
415
 *    name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
400
 * result => false</li>
416
 *    nameStart = 0
401
 * <li> pattern = "IPL3".toCharArray()
417
 *    nameEnd = 21
402
 * patternStart = 0
418
 *    result => false
403
 * patternEnd = 4
419
 * </pre>
404
 * name = "IPerspectiveListener3".toCharArray()
420
 * </li>
405
 * nameStart = 0
421
 * <li><pre>
406
 * nameEnd = 21
422
 *    pattern = { 'n', p', 'e' }
407
 * result => true</li>
423
 *    patternStart = 0
408
 * <li> pattern = "HM".toCharArray()
424
 *    patternEnd = 3
409
 * patternStart = 0
425
 *    name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
410
 * patternEnd = 2
426
 *    nameStart = 0
411
 * name = "HashMapEntry".toCharArray()
427
 *    nameEnd = 20
412
 * nameStart = 0
428
 *    result => false
413
 * nameEnd = 12
429
 * </pre>
414
 * result => true</li>
430
 * </li>
431
 * <li><pre>
432
 *    pattern = { 'I', 'P', 'L', '3' }
433
 *    patternStart = 0
434
 *    patternEnd = 4
435
 *    name = { 'I', 'P', 'e', 'r', 's', 'p', 'e', 'c', 't', 'i', 'v', 'e', 'L', 'i', 's', 't', 'e', 'n', 'e', 'r', '3' }
436
 *    nameStart = 0
437
 *    nameEnd = 21
438
 *    result => true
439
 * </pre>
440
 * </li>
441
 * </ol>
415
 * </ol>
442
 * 
416
 * 
443
 * @param pattern the given pattern
417
 * @param pattern the given pattern
Lines 450-456 Link Here
450
 * @since 3.2
424
 * @since 3.2
451
 */
425
 */
452
public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd) {
426
public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd) {
453
	return camelCaseMatch(pattern, patternStart, patternEnd, name, nameStart, nameEnd, true/*prefix match*/);
427
	return camelCaseMatch(pattern, patternStart, patternEnd, name, nameStart, nameEnd, false/*not the same count of parts*/);
454
}
428
}
455
429
456
/**
430
/**
Lines 481-559 Link Here
481
 * but are not always considered as leading character. For instance, both
455
 * but are not always considered as leading character. For instance, both
482
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
456
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
483
 * <p>
457
 * <p>
484
 * CamelCase may or may not match prefixes depending on the given parameter.
458
 * CamelCase can be restricted to match only the same count of parts. When this
485
 * When the prefix match parameter is <code>true</code>, the given pattern can
459
 * restriction is specified the given pattern and the given name must have <b>exactly</b>
486
 * match only a prefix of the given name. For instance, 'HM' , 'HaMa' and  'HMap'
460
 * the same number of parts (i.e. the same number of uppercase characters).<br>
487
 * patterns will all match 'HashMap', 'HatMapper' <b>and</b> 'HashMapEntry'.
461
 * For instance, 'HM' , 'HaMa' and  'HMap' patterns will match 'HashMap' and
488
 * <br>
462
 * 'HatMapper' <b>but not</b> 'HashMapEntry'.
489
 * Reversely, if the prefix match parameter is <code>false</code>, then pattern
490
 * and name must have <b>exactly</b> the same number of parts, and their last
491
 * parts must be identical if they contain lowercase characters.
492
 * For instance, 'HMap' and 'HaMap' patterns will match 'HashMap' but neither
493
 * 'HashMapEntry' nor 'HatMapper'. Note that when the last part does not contain
494
 * lowercase characters, then the name may end with lowercase characters.
495
 * So, 'HM' pattern will match both 'HashMap' <b>and</b> 'HatMapper' but will not
496
 * match 'HashMapEntry'.
497
 * <p>
463
 * <p>
498
 * <pre>
464
 * <pre>
499
 * Examples:
465
 * Examples:
500
 * <ol>
466
 * <ol>
501
 * <li> pattern = { 'N', 'P', 'E' }
467
 * <li> pattern = "NPE".toCharArray()
502
 * patternStart = 0
468
 * patternStart = 0
503
 * patternEnd = 3
469
 * patternEnd = 3
504
 * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
470
 * name = "NullPointerException".toCharArray()
505
 * nameStart = 0
471
 * nameStart = 0
506
 * nameEnd = 20
472
 * nameEnd = 20
507
 * result => true</li>
473
 * result => true</li>
508
 * <li> pattern = { 'N', 'P', 'E' }
474
 * <li> pattern = "NPE".toCharArray()
509
 * patternStart = 0
475
 * patternStart = 0
510
 * patternEnd = 3
476
 * patternEnd = 3
511
 * name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
477
 * name = "NoPermissionException".toCharArray()
512
 * nameStart = 0
478
 * nameStart = 0
513
 * nameEnd = 21
479
 * nameEnd = 21
514
 * result => true</li>
480
 * result => true</li>
515
 * <li> pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
481
 * <li> pattern = "NuPoEx".toCharArray()
516
 * patternStart = 0
482
 * patternStart = 0
517
 * patternEnd = 6
483
 * patternEnd = 6
518
 * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
484
 * name = "NullPointerException".toCharArray()
519
 * nameStart = 0
485
 * nameStart = 0
520
 * nameEnd = 20
486
 * nameEnd = 20
521
 * result => true</li>
487
 * result => true</li>
522
 * <li> pattern = { 'N', 'u', 'P', 'o', 'E', 'x' }
488
 * <li> pattern = "NuPoEx".toCharArray()
523
 * patternStart = 0
489
 * patternStart = 0
524
 * patternEnd = 6
490
 * patternEnd = 6
525
 * name = { 'N', 'o', 'P', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
491
 * name = "NoPermissionException".toCharArray()
526
 * nameStart = 0
492
 * nameStart = 0
527
 * nameEnd = 21
493
 * nameEnd = 21
528
 * result => false</li>
494
 * result => false</li>
529
 * <li> pattern = { 'n', p', 'e' }
495
 * <li> pattern = "npe".toCharArray()
530
 * patternStart = 0
496
 * patternStart = 0
531
 * patternEnd = 3
497
 * patternEnd = 3
532
 * name = { 'N', 'u','l', 'l', 'P', 'o', 'i', 'n', 't', 'e', 'r', 'E', 'x', 'c', 'e', 'p', 't', 'i', 'o', 'n' }
498
 * name = "NullPointerException".toCharArray()
533
 * nameStart = 0
499
 * nameStart = 0
534
 * nameEnd = 20
500
 * nameEnd = 20
535
 * result => false</li>
501
 * result => false</li>
536
 * <li> pattern = { 'I', 'P', 'L', '3' }
502
 * <li> pattern = "IPL3".toCharArray()
537
 * patternStart = 0
503
 * patternStart = 0
538
 * patternEnd = 4
504
 * patternEnd = 4
539
 * name = { 'I', 'P', 'e', 'r', 's', 'p', 'e', 'c', 't', 'i', 'v', 'e', 'L', 'i', 's', 't', 'e', 'n', 'e', 'r', '3' }
505
 * name = "IPerspectiveListener3".toCharArray()
540
 * nameStart = 0
506
 * nameStart = 0
541
 * nameEnd = 21
507
 * nameEnd = 21
542
 * result => true</li>
508
 * result => true</li>
543
 * <li> pattern = { 'H', M' }
509
 * <li> pattern = "HM".toCharArray()
544
 * patternStart = 0
510
 * patternStart = 0
545
 * patternEnd = 2
511
 * patternEnd = 2
546
 * name = { 'H', 'a', 's', 'h', 'M', 'a', 'p', 'E', 'n', 't', 'r', 'y' }
512
 * name = "HashMapEntry".toCharArray()
547
 * nameStart = 0
513
 * nameStart = 0
548
 * nameEnd = 12
514
 * nameEnd = 12
549
 * result => (exactMode == false)</li>
515
 * result => (samePartCount == false)</li>
550
 * <li> pattern = { 'H', M', 'a', 'p' }
551
 * patternStart = 0
552
 * patternEnd = 4
553
 * name = { 'H', 'a', 't', 'M', 'a', 'p', 'p', 'e', 'r' }
554
 * nameStart = 0
555
 * nameEnd = 9
556
 * result => (exactMode == false)</li>
557
 * </ol>
516
 * </ol>
558
 * </pre>
517
 * </pre>
559
 * 
518
 * 
Lines 563-586 Link Here
563
 * @param name the given name
522
 * @param name the given name
564
 * @param nameStart the start index of the name, inclusive
523
 * @param nameStart the start index of the name, inclusive
565
 * @param nameEnd the end index of the name, exclusive
524
 * @param nameEnd the end index of the name, exclusive
566
 * @param prefixMatch flag telling whether the pattern can match name prefix or not.
525
 * @param samePartCount flag telling whether the pattern and the name should
526
 * 	have the same count of parts or not.<br>
527
 * 	&nbsp;&nbsp;For example:
567
 * 	<ul>
528
 * 	<ul>
568
 * 		<li>For example, when it's <code>true</code>:<br>
529
 * 		<li>'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types,
569
 * 			- 'HM' type string pattern will match  'HashMap' and 'HtmlMapper' types,
530
 * 				but not 'HashMapEntry'</li>
570
 * 			  but not 'HashMapEntry'<br>
531
 * 		<li>'HMap' type string pattern will still match previous 'HashMap' and
571
 * 			- 'HMap' type string pattern will match  'HashMap' type but not 'HtmlMapper'.
532
 * 				'HtmlMapper' types, but not 'HighMagnitude'</li>
572
 * 		</li>
573
 * 		<li>and, when it's <code>false</code>:<br>
574
 * 			- 'HM' type string pattern will match both   'HashMap' and 'HtmlMapper'
575
 * 			  and 'HashMapEntry'<br>
576
 * 			- 'HMap' type string pattern will match both 'HashMap' and 'HtmlMapper'
577
 * 			  types.
578
 * 		</li>
579
 * 	</ul>
533
 * 	</ul>
580
 * @return true if a sub-pattern matches the sub-part of the given name, false otherwise
534
 * @return true if a sub-pattern matches the sub-part of the given name, false otherwise
581
 * @since 3.4
535
 * @since 3.4
582
 */
536
 */
583
public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd, boolean prefixMatch) {
537
public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd, boolean samePartCount) {
538
539
	/* !!!!!!!!!! WARNING !!!!!!!!!!
540
	 * The content of this method has been fully copied to
541
	 * SearchPattern#camelCaseMatch(String, int, int, String, int, int, boolean).
542
	 * 
543
	 * So, if current method is modified, do NOT forget to copy again its content
544
	 * to SearchPattern corresponding method!
545
	 */
546
584
	if (name == null)
547
	if (name == null)
585
		return false; // null name cannot match
548
		return false; // null name cannot match
586
	if (pattern == null)
549
	if (pattern == null)
Lines 607-635 Link Here
607
		iName++;
570
		iName++;
608
571
609
		if (iPattern == patternEnd) { // we have exhausted pattern...
572
		if (iPattern == patternEnd) { // we have exhausted pattern...
610
			// it's a match if not exact mode or name is also exhausted
573
			// it's a match if the name can have additional parts (i.e. uppercase characters) or is also exhausted
611
			if (prefixMatch || iName == nameEnd) return true;
574
			if (!samePartCount || iName == nameEnd) return true;
612
613
			// it's not a match if last pattern character is a lowercase
614
			if ((patternChar = pattern[iPattern-1]) < ScannerHelper.MAX_OBVIOUS) {
615
				if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[patternChar] & (ScannerHelper.C_UPPER_LETTER | ScannerHelper.C_DIGIT)) == 0) {
616
					return false;
617
				}
618
			}
619
			else if (Character.isJavaIdentifierPart(patternChar) && !Character.isUpperCase(patternChar) && !Character.isDigit(patternChar)) {
620
				return false;
621
			}
622
575
623
			// it's a match only if name has no more uppercase characters (exact mode)
576
			// otherwise it's a match only if the name has no more uppercase characters
624
			while (true) {
577
			while (true) {
625
				if (iName == nameEnd) {
578
				if (iName == nameEnd) {
626
					// we have exhausted name, so it's a match
579
					// we have exhausted the name, so it's a match
627
					return true;
580
					return true;
628
				}
581
				}
629
				nameChar = name[iName];
582
				nameChar = name[iName];
583
				// test if the name character is uppercase
630
				if (nameChar < ScannerHelper.MAX_OBVIOUS) {
584
				if (nameChar < ScannerHelper.MAX_OBVIOUS) {
631
					if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[nameChar] & ScannerHelper.C_UPPER_LETTER) != 0) {
585
					if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[nameChar] & ScannerHelper.C_UPPER_LETTER) != 0) {
632
						// nameChar is uppercase, so it's not a match
633
						return false;
586
						return false;
634
					}
587
					}
635
				}
588
				}
Lines 641-647 Link Here
641
		}
594
		}
642
595
643
		if (iName == nameEnd){
596
		if (iName == nameEnd){
644
			// We have exhausted name (and not pattern), so it's not a match 
597
			// We have exhausted the name (and not the pattern), so it's not a match 
645
			return false;
598
			return false;
646
		}
599
		}
647
600
(-)search/org/eclipse/jdt/core/search/SearchPattern.java (-270 / +261 lines)
Lines 150-167 Link Here
150
	 * 		'NullPointerException' type.</li>
150
	 * 		'NullPointerException' type.</li>
151
	 * </ul>
151
	 * </ul>
152
	 *
152
	 *
153
	 * Can be combined to {@link #R_PREFIX_MATCH} match rule. For example,
153
	 * This rule is not intended to be combined with any other match rule. In case
154
	 * when prefix match rule is combined with Camel Case match rule,
154
	 * of other match rule flags are combined with this one, then match rule validation
155
	 * 'nPE' pattern will match 'nPException'.
155
	 * will return a modified rule in order to perform a better appropriate search request
156
	 *<p>
156
	 * (see {@link #validateMatchRule(String, int)} for more details).
157
	 * Match rule {@link #R_PATTERN_MATCH} may also be combined but both rules
158
	 * will not be used simultaneously as they are mutually exclusive.
159
	 * Used match rule depends on whether string pattern contains specific pattern 
160
	 * characters (e.g. '*' or '?') or not. If it does, then only Pattern match rule
161
	 * will be used, otherwise only Camel Case match will be used.
162
	 * For example, with 'NPE' string pattern, search will only use
163
	 * Camel Case match rule, but with 'N*P*E*' string pattern, it will 
164
	 * use only Pattern match rule.
165
	 * <p>
157
	 * <p>
166
	 * @see #camelCaseMatch(String, String) for a detailed explanation of Camel
158
	 * @see #camelCaseMatch(String, String) for a detailed explanation of Camel
167
	 * 	Case matching.
159
	 * 	Case matching.
Lines 172-218 Link Here
172
164
173
	/**
165
	/**
174
	 * Match rule: The search pattern contains a Camel Case expression with
166
	 * Match rule: The search pattern contains a Camel Case expression with
175
	 * a strict number of parts and preventing automatic prefix matching for the last
167
	 * a strict expected number of parts.
176
	 * part (if it consists of multiple letters).
177
	 * <br>
168
	 * <br>
178
	 * Examples:
169
	 * Examples:
179
	 * <ul>
170
	 * <ul>
180
	 * 	<li>'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types,
171
	 * 	<li>'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types,
181
	 * 		but not 'HashMapEntry'
172
	 * 		but not 'HashMapEntry'
182
	 * 	</li>
173
	 * 	</li>
183
	 * 	<li>'HMap' type string pattern will match 'HashMap' type but not 'HtmlMapper'.
174
	 * 	<li>'HMap' type string pattern will still match previous 'HashMap' and
175
	 * 		'HtmlMapper' types, but not 'HighMagnitude'
184
	 * 	</li>
176
	 * 	</li>
185
	 * </ul>
177
	 * </ul>
186
	 *
178
	 *
187
	 * This Camel Case match rule does not allow prefix match but accept insensitive
179
	 * This rule is not intended to be combined with any other match rule. In case
188
	 * case. For instance, 'HashMap' or 'HASHMAP' patterns using this Camel Case
180
	 * of other match rule flags are combined with this one, then match rule validation
189
	 * rule will match both 'HashMap' but not 'HashMapEntry'.
181
	 * will return a modified rule in order to perform a better appropriate search request
182
	 * (see {@link #validateMatchRule(String, int)} for more details).
190
	 * <p>
183
	 * <p>
191
	 * This rule still can be combined to prefix match to accept prefix matches
192
	 * ('HashMap' pattern matching 'HashMapEntry' name). It can also be combined
193
	 * to case sensitive match to reject case insensitive matches ('HAMA' pattern
194
	 * will not match 'HashMap' name).
195
	 *<p>
196
	 * If {@link #R_PATTERN_MATCH} rule is also combined, then the real used
197
	 * match rule will depend on whether string pattern contains specific pattern
198
	 * characters (e.g. '*' or '?') or not. If it does, then only Pattern match rule will
199
	 * be used, otherwise only Camel Case match will be used.<br>
200
	 * For example, with 'NPE' string pattern, search will only use
201
	 * Camel Case match rule, but with 'N*P*E*' string pattern, it will 
202
	 * use only Pattern match rule.
203
	 *<p>
204
	 * @see CharOperation#camelCaseMatch(char[], char[], boolean) for a detailed
184
	 * @see CharOperation#camelCaseMatch(char[], char[], boolean) for a detailed
205
	 * explanation of Camel Case matching.
185
	 * explanation of Camel Case matching.
206
	 *<p>
186
	 *<p>
207
	 * @since 3.4
187
	 * @since 3.4
208
	 * <p><b>WARNING: work is still in progress on this new constant due to
209
	 * bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=201426.<br>
210
	 * So, there's high chance that this constant will be renamed and its behavior
211
	 * slightly changed in next milestone...</b>
212
	 */
188
	 */
213
	public static final int R_CAMEL_CASE_MATCH = 0x0100;
189
	public static final int R_CAMELCASE_SAME_PART_COUNT_MATCH = 0x0100;
214
190
215
	private static final int MODE_MASK = R_EXACT_MATCH | R_PREFIX_MATCH | R_PATTERN_MATCH | R_REGEXP_MATCH;
191
	private static final int MODE_MASK = R_EXACT_MATCH
192
		| R_PREFIX_MATCH 
193
		| R_PATTERN_MATCH 
194
		| R_REGEXP_MATCH 
195
		| R_CAMELCASE_MATCH
196
		| R_CAMELCASE_SAME_PART_COUNT_MATCH;
216
197
217
	private int matchRule;
198
	private int matchRule;
218
199
Lines 221-236 Link Here
221
 * It can be exact match, prefix match, pattern match or regexp match.
202
 * It can be exact match, prefix match, pattern match or regexp match.
222
 * Rule can also be combined with a case sensitivity flag.
203
 * Rule can also be combined with a case sensitivity flag.
223
 * 
204
 * 
224
 * @param matchRule one of {@link #R_EXACT_MATCH}, {@link #R_PREFIX_MATCH},
205
 * @param matchRule one of following match rule
225
 * 	{@link #R_PATTERN_MATCH}, {@link #R_REGEXP_MATCH} combined with
206
 * 	<ul>
226
 * 	one of following values: {@link #R_CASE_SENSITIVE}, {@link #R_ERASURE_MATCH},
207
 * 		<li>{@link #R_EXACT_MATCH}</li>
227
 * 	{@link #R_EQUIVALENT_MATCH} or {@link #R_CAMEL_CASE_MATCH}.
208
 * 		<li>{@link #R_PREFIX_MATCH}</li>
228
 *		e.g. {@link #R_EXACT_MATCH} | {@link #R_CASE_SENSITIVE} if an exact
209
 * 		<li>{@link #R_PATTERN_MATCH}</li>
229
 *		and case sensitive match is requested, {@link #R_PREFIX_MATCH} if a prefix
210
 * 		<li>{@link #R_REGEXP_MATCH}</li>
230
 *		non case sensitive match is requested or {@link #R_EXACT_MATCH} | {@link #R_ERASURE_MATCH}
211
 * 		<li>{@link #R_CAMELCASE_MATCH}</li>
231
 *		if a non case sensitive and erasure match is requested.<br>
212
 * 		<li>{@link #R_CAMELCASE_SAME_PART_COUNT_MATCH}</li>
232
 * 	Note that {@link #R_ERASURE_MATCH} or {@link #R_EQUIVALENT_MATCH} have no effect
213
 * 	</ul>
233
 * 	on non-generic types/methods search.<br>
214
 * 	which may be also combined with one of following flag:
215
 * 	<ul>
216
 * 		<li>{@link #R_CASE_SENSITIVE}</li>
217
 * 		<li>{@link #R_ERASURE_MATCH}</li>
218
 * 		<li>{@link #R_EQUIVALENT_MATCH}</li>
219
 * 	</ul>
220
 *		For example,
221
 *		<ul>
222
 *			<li>{@link #R_EXACT_MATCH} | {@link #R_CASE_SENSITIVE}: if an exact
223
 *				and case sensitive match is requested,</li>
224
 *			<li>{@link #R_PREFIX_MATCH} if a case insensitive prefix match is requested</li>
225
 *			<li>{@link #R_EXACT_MATCH} | {@link #R_ERASURE_MATCH}: if a case
226
 *				insensitive and erasure match is requested.</li>
227
 *		</ul>
228
 * 	Note that {@link #R_ERASURE_MATCH} or {@link #R_EQUIVALENT_MATCH} has no effect
229
 * 	on non-generic types/methods search.
230
 * 	<p>
234
 * 	Note also that default behavior for generic types/methods search is to find exact matches.
231
 * 	Note also that default behavior for generic types/methods search is to find exact matches.
235
 */
232
 */
236
public SearchPattern(int matchRule) {
233
public SearchPattern(int matchRule) {
Lines 239-245 Link Here
239
	if ((matchRule & (R_EQUIVALENT_MATCH | R_ERASURE_MATCH )) == 0) {
236
	if ((matchRule & (R_EQUIVALENT_MATCH | R_ERASURE_MATCH )) == 0) {
240
		this.matchRule |= R_FULL_MATCH;
237
		this.matchRule |= R_FULL_MATCH;
241
	}
238
	}
242
	this.matchRule = updateMatchRule(this.matchRule);
239
	if ((matchRule & R_CAMELCASE_SAME_PART_COUNT_MATCH) != 0) {
240
		// reset other incompatible flags
241
		this.matchRule &= ~R_CAMELCASE_MATCH;
242
		this.matchRule &= ~R_PREFIX_MATCH;
243
	} else if ((matchRule & R_CAMELCASE_MATCH) != 0) {
244
		// reset other incompatible flags
245
		this.matchRule &= ~R_PREFIX_MATCH;
246
	}
243
}
247
}
244
248
245
/**
249
/**
Lines 267-274 Link Here
267
 * but are not always considered as leading character. For instance, both
271
 * but are not always considered as leading character. For instance, both
268
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
272
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
269
 * <p>
273
 * <p>
270
 * This method allows prefix match in Camel Case (see
274
 * Using this method allows matching names to have more parts than the specified
271
 * {@link #camelCaseMatch(String, String, boolean)}).
275
 * pattern (see {@link #camelCaseMatch(String, String, boolean)}).<br>
276
 * For instance, 'HM' , 'HaMa' and  'HMap' patterns will match 'HashMap',
277
 * 'HatMapper' <b>and also</b> 'HashMapEntry'.
272
 * <p>
278
 * <p>
273
 * <pre>
279
 * <pre>
274
 * Examples:
280
 * Examples:
Lines 306-312 Link Here
306
	if (name == null)
312
	if (name == null)
307
		return false; // null name cannot match
313
		return false; // null name cannot match
308
314
309
	return camelCaseMatch(pattern, 0, pattern.length(), name, 0, name.length(), true/*prefix match*/);
315
	return camelCaseMatch(pattern, 0, pattern.length(), name, 0, name.length(), false/*not the same count of parts*/);
310
}
316
}
311
317
312
/**
318
/**
Lines 334-352 Link Here
334
 * but are not always considered as leading character. For instance, both
340
 * but are not always considered as leading character. For instance, both
335
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
341
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
336
 * <p>
342
 * <p>
337
 * CamelCase may or may not match prefixes depending on the given parameter.
343
 * CamelCase can be restricted to match only the same count of parts. When this
338
 * When the prefix match parameter is <code>true</code>, the given pattern can
344
 * restriction is specified the given pattern and the given name must have <b>exactly</b>
339
 * match only a prefix of the given name. For instance, 'HM' , 'HaMa' and  'HMap'
345
 * the same number of parts (i.e. the same number of uppercase characters).<br>
340
 * patterns will all match 'HashMap', 'HatMapper' <b>and</b> 'HashMapEntry'.
346
 * For instance, 'HM' , 'HaMa' and  'HMap' patterns will match 'HashMap' and
341
 * <br>
347
 * 'HatMapper' <b>but not</b> 'HashMapEntry'.
342
 * Reversely, if the prefix match parameter is <code>false</code>, then pattern
343
 * and name must have <b>exactly</b> the same number of parts, and their last
344
 * parts must be identical if they contain lowercase characters.
345
 * For instance, 'HMap' and 'HaMap' patterns will match 'HashMap' but neither
346
 * 'HashMapEntry' nor 'HatMapper'. Note that when the last part does not contain
347
 * lowercase characters, then the name may end with lowercase characters.
348
 * So, 'HM' pattern will match both 'HashMap' <b>and</b> 'HatMapper' but will not
349
 * match 'HashMapEntry'.
350
 * <p>
348
 * <p>
351
 * <pre>
349
 * <pre>
352
 * Examples:
350
 * Examples:
Lines 364-373 Link Here
364
 *  result => true</li>
362
 *  result => true</li>
365
 * <li>  pattern = "HM"
363
 * <li>  pattern = "HM"
366
 *  name = "HashMapEntry"
364
 *  name = "HashMapEntry"
367
 *  result => (prefixMatch == true)</li>
365
 *  result => (samePartCount == false)</li>
368
 * <li>  pattern = "HMap"
369
 *  name = "HatMapper"
370
 *  result => (prefixMatch == true)</li>
371
 * </ol></pre>
366
 * </ol></pre>
372
 * 
367
 * 
373
 * @see #camelCaseMatch(String, int, int, String, int, int, boolean) for algorithm
368
 * @see #camelCaseMatch(String, int, int, String, int, int, boolean) for algorithm
Lines 375-407 Link Here
375
 * 
370
 * 
376
 * @param pattern the given pattern
371
 * @param pattern the given pattern
377
 * @param name the given name
372
 * @param name the given name
378
 * @param prefixMatch flag telling whether the pattern can match name prefix or not.
373
 * @param samePartCount flag telling whether the pattern and the name should
374
 * 	have the same count of parts or not.<br>
375
 * 	&nbsp;&nbsp;For example:
379
 * 	<ul>
376
 * 	<ul>
380
 * 		<li>For example, when it's <code>true</code>:<br>
377
 * 		<li>'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types,
381
 * 			- <code>HM</code> type string pattern will match
378
 * 				but not 'HashMapEntry'</li>
382
 * 			  <code>HashMap</code> and <code>HtmlMapper</code> types,
379
 * 		<li>'HMap' type string pattern will still match previous 'HashMap' and
383
 * 			  but not <code>HashMapEntry</code><br>
380
 * 				'HtmlMapper' types, but not 'HighMagnitude'</li>
384
 * 			- <code>HMap</code> type string pattern will match
385
 * 			  <code>HashMap</code> type but not <code>HtmlMapper</code>.
386
 * 		</li>
387
 * 		<li>and, when it's <code>false</code>:<br>
388
 * 			- <code>HM</code> type string pattern will match both 
389
 * 			  <code>HashMap</code> and <code>HtmlMapper</code>
390
 * 			  and <code>HashMapEntry</code><br>
391
 * 			- <code>HMap</code> type string pattern will match both
392
 * 			  <code>HashMap</code> and <code>HtmlMapper</code> types.
393
 * 		</li>
394
 * 	</ul>
381
 * 	</ul>
395
 * @return true if the pattern matches the given name, false otherwise
382
 * @return true if the pattern matches the given name, false otherwise
396
 * @since 3.4
383
 * @since 3.4
397
 */
384
 */
398
public static final boolean camelCaseMatch(String pattern, String name, boolean prefixMatch) {
385
public static final boolean camelCaseMatch(String pattern, String name, boolean samePartCount) {
399
	if (pattern == null)
386
	if (pattern == null)
400
		return true; // null pattern is equivalent to '*'
387
		return true; // null pattern is equivalent to '*'
401
	if (name == null)
388
	if (name == null)
402
		return false; // null name cannot match
389
		return false; // null name cannot match
403
390
404
	return camelCaseMatch(pattern, 0, pattern.length(), name, 0, name.length(), prefixMatch);
391
	return camelCaseMatch(pattern, 0, pattern.length(), name, 0, name.length(), samePartCount);
405
}
392
}
406
393
407
/**
394
/**
Lines 435-442 Link Here
435
 * but are not always considered as leading character. For instance, both
422
 * but are not always considered as leading character. For instance, both
436
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
423
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
437
 * <p>
424
 * <p>
438
 * This method allows prefix match in Camel Case (see
425
 * Using this method allows matching names to have more parts than the specified
439
 * {@link #camelCaseMatch(String, int, int, String, int, int, boolean)}).
426
 * pattern (see {@link #camelCaseMatch(String, int, int, String, int, int, boolean)}).<br>
427
 * For instance, 'HM' , 'HaMa' and  'HMap' patterns will match 'HashMap',
428
 * 'HatMapper' <b>and also</b> 'HashMapEntry'.
440
 * <p>
429
 * <p>
441
 * <pre>Examples:<ol>
430
 * <pre>Examples:<ol>
442
 * <li>  pattern = "NPE"
431
 * <li>  pattern = "NPE"
Lines 507-513 Link Here
507
 * @since 3.2
496
 * @since 3.2
508
 */
497
 */
509
public static final boolean camelCaseMatch(String pattern, int patternStart, int patternEnd, String name, int nameStart, int nameEnd) {
498
public static final boolean camelCaseMatch(String pattern, int patternStart, int patternEnd, String name, int nameStart, int nameEnd) {
510
	return camelCaseMatch(pattern, patternStart, patternEnd, name, nameStart, nameEnd, true/*prefix match*/);
499
	return camelCaseMatch(pattern, patternStart, patternEnd, name, nameStart, nameEnd, false/*not the same count of parts*/);
511
}
500
}
512
501
513
/**
502
/**
Lines 538-556 Link Here
538
 * but are not always considered as leading character. For instance, both
527
 * but are not always considered as leading character. For instance, both
539
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
528
 * 'UTF16DSS' and 'UTFDSS' patterns will match 'UTF16DocumentScannerSupport'.
540
 * <p>
529
 * <p>
541
 * CamelCase may or may not match prefixes depending on the given parameter.
530
 * CamelCase can be restricted to match only the same count of parts. When this
542
 * When the prefix match parameter is <code>true</code>, the given pattern can
531
 * restriction is specified the given pattern and the given name must have <b>exactly</b>
543
 * match only a prefix of the given name. For instance, 'HM' , 'HaMa' and  'HMap'
532
 * the same number of parts (i.e. the same number of uppercase characters).<br>
544
 * patterns will all match 'HashMap', 'HatMapper' <b>and</b> 'HashMapEntry'.
533
 * For instance, 'HM' , 'HaMa' and  'HMap' patterns will match 'HashMap' and
545
 * <br>
534
 * 'HatMapper' <b>but not</b> 'HashMapEntry'.
546
 * Reversely, if the prefix match parameter is <code>false</code>, then pattern
547
 * and name must have <b>exactly</b> the same number of parts, and their last
548
 * parts must be identical if they contain lowercase characters.
549
 * For instance, 'HMap' and 'HaMap' patterns will match 'HashMap' but neither
550
 * 'HashMapEntry' nor 'HatMapper'. Note that when the last part does not contain
551
 * lowercase characters, then the name may end with lowercase characters.
552
 * So, 'HM' pattern will match both 'HashMap' <b>and</b> 'HatMapper' but will not
553
 * match 'HashMapEntry'.
554
 * <p>
535
 * <p>
555
 * <pre>Examples:<ol>
536
 * <pre>Examples:<ol>
556
 * <li>  pattern = "NPE"
537
 * <li>  pattern = "NPE"
Lines 601-614 Link Here
601
 *  name = "HashMapEntry"
582
 *  name = "HashMapEntry"
602
 *  nameStart = 0
583
 *  nameStart = 0
603
 *  nameEnd = 12
584
 *  nameEnd = 12
604
 *  result => (prefixMatch == true)</li>
585
 *  result => (samePartCount == false)</li>
605
 * <li>  pattern = "HMap"
606
 *  patternStart = 0
607
 *  patternEnd = 4
608
 *  name = "HatMapper"
609
 *  nameStart = 0
610
 *  nameEnd = 9
611
 *  result => (prefixMatch == true)</li>
612
 * </ol></pre>
586
 * </ol></pre>
613
 * 
587
 * 
614
 * @see CharOperation#camelCaseMatch(char[], int, int, char[], int, int, boolean)
588
 * @see CharOperation#camelCaseMatch(char[], int, int, char[], int, int, boolean)
Lines 620-654 Link Here
620
 * @param name the given name
594
 * @param name the given name
621
 * @param nameStart the start index of the name, inclusive
595
 * @param nameStart the start index of the name, inclusive
622
 * @param nameEnd the end index of the name, exclusive
596
 * @param nameEnd the end index of the name, exclusive
623
 * @param prefixMatch flag telling whether the pattern can match name prefix or not.
597
 * @param samePartCount flag telling whether the pattern and the name should
598
 * 	have the same count of parts or not.<br>
599
 * 	&nbsp;&nbsp;For example:
624
 * 	<ul>
600
 * 	<ul>
625
 * 		<li>For example, when it's <code>true</code>:<br>
601
 * 		<li>'HM' type string pattern will match 'HashMap' and 'HtmlMapper' types,
626
 * 			- <code>HM</code> type string pattern will match
602
 * 				but not 'HashMapEntry'</li>
627
 * 			  <code>HashMap</code> and <code>HtmlMapper</code> types,
603
 * 		<li>'HMap' type string pattern will still match previous 'HashMap' and
628
 * 			  but not <code>HashMapEntry</code><br>
604
 * 				'HtmlMapper' types, but not 'HighMagnitude'</li>
629
 * 			- <code>HMap</code> type string pattern will match
630
 * 			  <code>HashMap</code> type but not <code>HtmlMapper</code>.
631
 * 		</li>
632
 * 		<li>and, when it's <code>false</code>:<br>
633
 * 			- <code>HM</code> type string pattern will match both 
634
 * 			  <code>HashMap</code> and <code>HtmlMapper</code>
635
 * 			  and <code>HashMapEntry</code><br>
636
 * 			- <code>HMap</code> type string pattern will match both
637
 * 			  <code>HashMap</code> and <code>HtmlMapper</code> types.
638
 * 		</li>
639
 * 	</ul>
605
 * 	</ul>
640
 * @return true if a sub-pattern matches the sub-part of the given name, false otherwise
606
 * @return true if a sub-pattern matches the sub-part of the given name, false otherwise
641
 * @since 3.4
607
 * @since 3.4
642
 */
608
 */
643
public static final boolean camelCaseMatch(String pattern, int patternStart, int patternEnd, String name, int nameStart, int nameEnd, boolean prefixMatch) {
609
public static final boolean camelCaseMatch(String pattern, int patternStart, int patternEnd, String name, int nameStart, int nameEnd, boolean samePartCount) {
644
610
645
	/*
611
	/* !!!!!!!!!! WARNING !!!!!!!!!!
646
	 * The algorithm of this method has been entirely copied from
612
	 * The algorithm of this method has been entirely copied from
647
	 * CharOperation#camelCaseMatch(char[], int, int, char[], int, int, boolean)
613
	 * CharOperation#camelCaseMatch(char[], int, int, char[], int, int, boolean).
648
	 * Array lengths have been replaced with call to {@link String#length()} and
614
	 * Array lengths have been replaced with call to {@link String#length()} and
649
	 * array direct access have been replaced with call to {@link String#charAt(int)}.
615
	 * array direct access have been replaced with call to {@link String#charAt(int)}.
650
	 * WARNING: Do not change one of these methods without changing the other
616
	 * 
651
	 * the same way otherwise behavior differences may appear while using them...
617
	 * So, do NOT modify this method directly to fix any bug but modify first the
618
	 * corresponding CharOperation method and do the copy again to be sure that
619
	 * these two methods are kept synchronized.
652
	 */
620
	 */
653
621
654
	if (name == null)
622
	if (name == null)
Lines 665-671 Link Here
665
		// first char must strictly match (upper/lower)
633
		// first char must strictly match (upper/lower)
666
		return false;
634
		return false;
667
	}
635
	}
668
	
636
669
	char patternChar, nameChar;
637
	char patternChar, nameChar;
670
	int iPattern = patternStart;
638
	int iPattern = patternStart;
671
	int iName = nameStart;
639
	int iName = nameStart;
Lines 677-705 Link Here
677
		iName++;
645
		iName++;
678
646
679
		if (iPattern == patternEnd) { // we have exhausted pattern...
647
		if (iPattern == patternEnd) { // we have exhausted pattern...
680
			// it's a match if not exact mode or name is also exhausted
648
			// it's a match if the name can have additional parts (i.e. uppercase characters) or is also exhausted
681
			if (prefixMatch || iName == nameEnd) return true;
649
			if (!samePartCount || iName == nameEnd) return true;
682
683
			// it's not a match if last pattern character is a lowercase
684
			if ((patternChar = pattern.charAt(iPattern-1)) < ScannerHelper.MAX_OBVIOUS) {
685
				if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[patternChar] & (ScannerHelper.C_UPPER_LETTER | ScannerHelper.C_DIGIT)) == 0) {
686
					return false;
687
				}
688
			}
689
			else if (Character.isJavaIdentifierPart(patternChar) && !Character.isUpperCase(patternChar) && !Character.isDigit(patternChar)) {
690
				return false;
691
			}
692
650
693
			// it's a match only if name has no more uppercase characters (exact mode)
651
			// otherwise it's a match only if the name has no more uppercase characters
694
			while (true) {
652
			while (true) {
695
				if (iName == nameEnd) {
653
				if (iName == nameEnd) {
696
					// we have exhausted name, so it's a match
654
					// we have exhausted the name, so it's a match
697
					return true;
655
					return true;
698
				}
656
				}
699
				nameChar = name.charAt(iName);
657
				nameChar = name.charAt(iName);
658
				// test if the name character is uppercase
700
				if (nameChar < ScannerHelper.MAX_OBVIOUS) {
659
				if (nameChar < ScannerHelper.MAX_OBVIOUS) {
701
					if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[nameChar] & ScannerHelper.C_UPPER_LETTER) != 0) {
660
					if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[nameChar] & ScannerHelper.C_UPPER_LETTER) != 0) {
702
						// nameChar is uppercase, so it's not a match
703
						return false;
661
						return false;
704
					}
662
					}
705
				}
663
				}
Lines 711-717 Link Here
711
		}
669
		}
712
670
713
		if (iName == nameEnd){
671
		if (iName == nameEnd){
714
			// We have exhausted name (and not pattern), so it's not a match 
672
			// We have exhausted the name (and not the pattern), so it's not a match 
715
			return false;
673
			return false;
716
		}
674
		}
717
675
Lines 1410-1425 Link Here
1410
 *				{@link IJavaSearchConstants#INTERFACE} is respectively used instead of {@link IJavaSearchConstants#TYPE}.
1368
 *				{@link IJavaSearchConstants#INTERFACE} is respectively used instead of {@link IJavaSearchConstants#TYPE}.
1411
 *		</li>
1369
 *		</li>
1412
 *	</ul>
1370
 *	</ul>
1413
 * @param matchRule one of {@link #R_EXACT_MATCH}, {@link #R_PREFIX_MATCH},
1371
 * @param matchRule one of the following match rule
1414
 * 	{@link #R_PATTERN_MATCH}, {@link #R_REGEXP_MATCH} combined with
1372
 * 	<ul>
1415
 * 	one of following values: {@link #R_CASE_SENSITIVE}, {@link #R_ERASURE_MATCH},
1373
 * 		<li>{@link #R_EXACT_MATCH}</li>
1416
 * 	{@link #R_EQUIVALENT_MATCH} or {@link #R_CAMEL_CASE_MATCH}.
1374
 * 		<li>{@link #R_PREFIX_MATCH}</li>
1417
 *		e.g. {@link #R_EXACT_MATCH} | {@link #R_CASE_SENSITIVE} if an exact
1375
 * 		<li>{@link #R_PATTERN_MATCH}</li>
1418
 *		and case sensitive match is requested, {@link #R_PREFIX_MATCH} if a prefix
1376
 * 		<li>{@link #R_REGEXP_MATCH}</li>
1419
 *		non case sensitive match is requested or {@link #R_EXACT_MATCH} | {@link #R_ERASURE_MATCH}
1377
 * 		<li>{@link #R_CAMELCASE_MATCH}</li>
1420
 *		if a non case sensitive and erasure match is requested.<br>
1378
 * 		<li>{@link #R_CAMELCASE_SAME_PART_COUNT_MATCH}</li>
1421
 * 	Note that {@link #R_ERASURE_MATCH} or {@link #R_EQUIVALENT_MATCH} have no effect
1379
 * 	</ul>
1422
 * 	on non-generic types/methods search.<br>
1380
 * 	which may be also combined with one of the following flag:
1381
 * 	<ul>
1382
 * 		<li>{@link #R_CASE_SENSITIVE}</li>
1383
 * 		<li>{@link #R_ERASURE_MATCH}</li>
1384
 * 		<li>{@link #R_EQUIVALENT_MATCH}</li>
1385
 * 	</ul>
1386
 *		For example,
1387
 *		<ul>
1388
 *			<li>{@link #R_EXACT_MATCH} | {@link #R_CASE_SENSITIVE}: if an exact
1389
 *				and case sensitive match is requested,</li>
1390
 *			<li>{@link #R_PREFIX_MATCH} if a case insensitive prefix match is requested</li>
1391
 *			<li>{@link #R_EXACT_MATCH} | {@link #R_ERASURE_MATCH}: if a case
1392
 *				insensitive and erasure match is requested.</li>
1393
 *		</ul>
1394
 * 	Note that {@link #R_ERASURE_MATCH} or {@link #R_EQUIVALENT_MATCH} has no effect
1395
 * 	on non-generic types/methods search.
1396
 * 	<p>
1423
 * 	Note also that default behavior for generic types/methods search is to find exact matches.
1397
 * 	Note also that default behavior for generic types/methods search is to find exact matches.
1424
 * @return a search pattern on the given string pattern, or <code>null</code> if the string pattern is ill-formed
1398
 * @return a search pattern on the given string pattern, or <code>null</code> if the string pattern is ill-formed
1425
 */
1399
 */
Lines 1557-1572 Link Here
1557
 *				which directly implement/extend a given interface.
1531
 *				which directly implement/extend a given interface.
1558
 *		</li>
1532
 *		</li>
1559
 *	</ul>
1533
 *	</ul>
1560
 * @param matchRule one of {@link #R_EXACT_MATCH}, {@link #R_PREFIX_MATCH},
1534
 * @param matchRule one of the following match rule
1561
 * 	{@link #R_PATTERN_MATCH}, {@link #R_REGEXP_MATCH} combined with
1535
 * 	<ul>
1562
 * 	one of following values: {@link #R_CASE_SENSITIVE}, {@link #R_ERASURE_MATCH},
1536
 * 		<li>{@link #R_EXACT_MATCH}</li>
1563
 * 	{@link #R_EQUIVALENT_MATCH} or {@link #R_CAMEL_CASE_MATCH}.
1537
 * 		<li>{@link #R_PREFIX_MATCH}</li>
1564
 *		e.g. {@link #R_EXACT_MATCH} | {@link #R_CASE_SENSITIVE} if an exact
1538
 * 		<li>{@link #R_PATTERN_MATCH}</li>
1565
 *		and case sensitive match is requested, {@link #R_PREFIX_MATCH} if a prefix
1539
 * 		<li>{@link #R_REGEXP_MATCH}</li>
1566
 *		non case sensitive match is requested or {@link #R_EXACT_MATCH} | {@link #R_ERASURE_MATCH}
1540
 * 		<li>{@link #R_CAMELCASE_MATCH}</li>
1567
 *		if a non case sensitive and erasure match is requested.<br>
1541
 * 		<li>{@link #R_CAMELCASE_SAME_PART_COUNT_MATCH}</li>
1568
 * 	Note that {@link #R_ERASURE_MATCH} or {@link #R_EQUIVALENT_MATCH} have no effect
1542
 * 	</ul>
1569
 * 	on non-generic types/methods search.<br>
1543
 * 	which may be also combined with one of the following flag:
1544
 * 	<ul>
1545
 * 		<li>{@link #R_CASE_SENSITIVE}</li>
1546
 * 		<li>{@link #R_ERASURE_MATCH}</li>
1547
 * 		<li>{@link #R_EQUIVALENT_MATCH}</li>
1548
 * 	</ul>
1549
 *		For example,
1550
 *		<ul>
1551
 *			<li>{@link #R_EXACT_MATCH} | {@link #R_CASE_SENSITIVE}: if an exact
1552
 *				and case sensitive match is requested,</li>
1553
 *			<li>{@link #R_PREFIX_MATCH} if a case insensitive prefix match is requested</li>
1554
 *			<li>{@link #R_EXACT_MATCH} | {@link #R_ERASURE_MATCH}: if a case
1555
 *				insensitive and erasure match is requested.</li>
1556
 *		</ul>
1557
 * 	Note that {@link #R_ERASURE_MATCH} or {@link #R_EQUIVALENT_MATCH} has no effect
1558
 * 	on non-generic types/methods search.
1559
 * 	<p>
1570
 * 	Note also that default behavior for generic types/methods search is to find exact matches.
1560
 * 	Note also that default behavior for generic types/methods search is to find exact matches.
1571
 * @return a search pattern for a Java element or <code>null</code> if the given element is ill-formed
1561
 * @return a search pattern for a Java element or <code>null</code> if the given element is ill-formed
1572
 * @since 3.1
1562
 * @since 3.1
Lines 1581-1586 Link Here
1581
		ignoreDeclaringType = (limitTo & IJavaSearchConstants.IGNORE_DECLARING_TYPE) != 0;
1571
		ignoreDeclaringType = (limitTo & IJavaSearchConstants.IGNORE_DECLARING_TYPE) != 0;
1582
		ignoreReturnType = (limitTo & IJavaSearchConstants.IGNORE_RETURN_TYPE) != 0;
1572
		ignoreReturnType = (limitTo & IJavaSearchConstants.IGNORE_RETURN_TYPE) != 0;
1583
	}
1573
	}
1574
	if ((matchRule = validateMatchRule(null, matchRule)) == -1) {
1575
		return null;
1576
	}
1584
	char[] declaringSimpleName = null;
1577
	char[] declaringSimpleName = null;
1585
	char[] declaringQualification = null;
1578
	char[] declaringQualification = null;
1586
	switch (element.getElementType()) {
1579
	switch (element.getElementType()) {
Lines 2140-2165 Link Here
2140
	if (pattern == null) return true; // null is as if it was "*"
2133
	if (pattern == null) return true; // null is as if it was "*"
2141
	if (name != null) {
2134
	if (name != null) {
2142
		boolean isCaseSensitive = (this.matchRule & R_CASE_SENSITIVE) != 0;
2135
		boolean isCaseSensitive = (this.matchRule & R_CASE_SENSITIVE) != 0;
2143
		boolean isCamelCase = (this.matchRule & R_CAMEL_CASE_MATCH) != 0;
2144
		int matchMode = this.matchRule & MODE_MASK;
2136
		int matchMode = this.matchRule & MODE_MASK;
2145
		boolean emptyPattern = pattern.length == 0;
2137
		boolean emptyPattern = pattern.length == 0;
2146
		boolean isPrefix = (this.matchRule & R_PREFIX_MATCH) != 0;
2138
		if (emptyPattern && (this.matchRule & R_PREFIX_MATCH) != 0) return true;
2147
		if (isPrefix && emptyPattern) return true;
2148
		boolean sameLength = pattern.length == name.length;
2139
		boolean sameLength = pattern.length == name.length;
2149
		boolean canBePrefix = name.length >= pattern.length;
2140
		boolean canBePrefix = name.length >= pattern.length;
2150
		boolean matchFirstChar = !isCaseSensitive || emptyPattern || (name.length > 0 &&  pattern[0] == name[0]);
2141
		boolean matchFirstChar = !isCaseSensitive || emptyPattern || (name.length > 0 &&  pattern[0] == name[0]);
2151
		if (isCamelCase) {
2152
			if (matchFirstChar && CharOperation.camelCaseMatch(pattern, name, isPrefix)) {
2153
				return true;
2154
			}
2155
			if (isCaseSensitive) return false;
2156
		}
2157
		switch (matchMode) {
2142
		switch (matchMode) {
2158
			case R_EXACT_MATCH :
2143
			case R_EXACT_MATCH :
2159
				if (sameLength && matchFirstChar) {
2144
				if (sameLength && matchFirstChar) {
2160
					return CharOperation.equals(pattern, name, isCaseSensitive);
2145
					return CharOperation.equals(pattern, name, isCaseSensitive);
2161
				}
2146
				}
2162
				break;
2147
				break;
2148
2163
			case R_PREFIX_MATCH :
2149
			case R_PREFIX_MATCH :
2164
				if (canBePrefix && matchFirstChar) {
2150
				if (canBePrefix && matchFirstChar) {
2165
					return CharOperation.prefixEquals(pattern, name, isCaseSensitive);
2151
					return CharOperation.prefixEquals(pattern, name, isCaseSensitive);
Lines 2172-2177 Link Here
2172
					pattern = CharOperation.toLowerCase(pattern);
2158
					pattern = CharOperation.toLowerCase(pattern);
2173
				return CharOperation.match(pattern, name, isCaseSensitive);
2159
				return CharOperation.match(pattern, name, isCaseSensitive);
2174
2160
2161
			case SearchPattern.R_CAMELCASE_MATCH:
2162
				if (matchFirstChar && CharOperation.camelCaseMatch(pattern, name, false)) {
2163
					return true;
2164
				}
2165
				// only test case insensitive as CamelCase already verified prefix case sensitive
2166
				if (!isCaseSensitive && matchFirstChar && CharOperation.prefixEquals(pattern, name, false)) {
2167
					return true;
2168
				}
2169
				break;
2170
2171
			case SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH:
2172
				return matchFirstChar && CharOperation.camelCaseMatch(pattern, name, true);
2173
2175
			case R_REGEXP_MATCH :
2174
			case R_REGEXP_MATCH :
2176
				// TODO (frederic) implement regular expression match
2175
				// TODO (frederic) implement regular expression match
2177
				return true;
2176
				return true;
Lines 2183-2216 Link Here
2183
/**
2182
/**
2184
 * Validate compatibility between given string pattern and match rule.
2183
 * Validate compatibility between given string pattern and match rule.
2185
 *<br>
2184
 *<br>
2186
 * Returned match rule is modified, when following combinations are observed in the given parameters:
2185
 * In certain circumstances described in the table below, the returned match rule is
2187
 * <ul>
2186
 * modified in order to provide a more efficient search pattern:
2188
 * 	<li>{@link #R_PATTERN_MATCH} without any '*' or '?' in string pattern:<br>
2187
 * <ol>
2189
 * 		=> <b>pattern match flag is reset</b>,
2188
 * 	<li>when regexp match flag is set (e.g. {@link #R_REGEXP_MATCH}),<br>
2190
 * 	</li>
2189
 * 		then <b>the pattern is rejected</b> as this kind of match is not supported
2191
 * 	<li>{@link #R_PATTERN_MATCH} and {@link #R_PREFIX_MATCH}  flags
2190
 * 		yet and <code>-1</code> is returned).
2192
 * 		simultaneously set:<br>
2193
 * 		&nbsp;=> <b>prefix match flag is reset</b>,
2194
 * 	</li>
2191
 * 	</li>
2195
 * 	<li>{@link #R_PATTERN_MATCH} and {@link #R_CAMEL_CASE_MATCH} 
2192
 * 	<li>when the string pattern has <u>no</u> pattern characters (e.g. '*' or '?') and
2196
 * 		(or <i>deprecated {@link #R_CAMELCASE_MATCH}</i>) flags simultaneously set:<br>
2193
 * 		the pattern match flag is set (i.e. the match rule has the {@link #R_PATTERN_MATCH}
2197
 * 		&nbsp;=> <b>camel case match flag is reset</b>,
2194
 * 		flag),<br>then <b>the pattern match flag is reset</b>. Reversely, when
2195
 * 		the string pattern has pattern characters and the pattern match flag is
2196
 * 		<u>not</u> set,<br>then <b>the pattern match flag is set</b>.
2198
 * 	</li>
2197
 * 	</li>
2199
 * 	<li>{@link #R_CAMEL_CASE_MATCH} (or <i>deprecated {@link #R_CAMELCASE_MATCH}</i>)
2198
 * 	<li>when the pattern match flag is set with other match flags ({@link #R_PREFIX_MATCH},
2200
 * 		with invalid combination of uppercase and lowercase characters:<br>
2199
 * 		{@link #R_CAMELCASE_MATCH} or {@link #R_CAMELCASE_SAME_PART_COUNT_MATCH}),<br>
2201
 * 		&nbsp;=> <b>camel case match flag is reset and replaced with prefix match pattern</b>,<br>
2200
 * 		then <b>all these other match flags are reset</b>.
2202
 * 	</li>
2201
 * 	</li>
2203
 * 	<li>The <i>deprecated {@link #R_CAMELCASE_MATCH}</i> flag combined with
2202
 * 	<li>when the CamelCase match flag is set with other match flags ({@link #R_PREFIX_MATCH}
2204
 * 		{@link #R_PREFIX_MATCH} and {@link #R_CASE_SENSITIVE} flags is
2203
 * 		or  or {@link #R_CAMELCASE_SAME_PART_COUNT_MATCH}),<br>
2205
 * 		reduced to <i>deprecated {@link #R_CAMELCASE_MATCH}</i> flag only,
2204
 * 		then <b>all these other match flags are reset</b>. If the string pattern cannot
2205
 * 		be a camel case pattern (see {@link #validateCamelCasePattern(String)}),<br>
2206
 * 		then <b>the CamelCase match is replaced with a prefix match flag</b>.
2206
 * 	</li>
2207
 * 	</li>
2207
 * </ul>
2208
 * 	<li>when the CamelCase part count match flag is set with other match flags
2208
 *<br>
2209
 * 		({@link #R_PREFIX_MATCH}),<br> then <b>all these other match flags
2209
 * Rejected (i.e. returned match rule -1) combinations are:
2210
 * 		are reset</b>. If the string pattern cannot be a camel case pattern (see
2210
 * <ul>
2211
 * 		{@link #validateCamelCasePattern(String)}),<br> then <b>the CamelCase
2211
 * 	<li>{@link #R_REGEXP_MATCH} with any other match mode flag set,
2212
 * 		part count match is replaced with a prefix match flag</b>.
2212
 * 	</li>
2213
 * 	</li>
2213
 * </ul>
2214
 * </ol>
2215
 * <i>Note: the rules are validated in the documented order. For example, it means
2216
 * 	that as soon as the string pattern contains one pattern character, the pattern
2217
 * 	match flag will be set and all other match flags reset: validation of rule 2)
2218
 * 	followed by rule 3)...</i>
2219
 *<p>
2214
 *
2220
 *
2215
 * @param stringPattern The string pattern
2221
 * @param stringPattern The string pattern
2216
 * @param matchRule The match rule
2222
 * @param matchRule The match rule
Lines 2222-2320 Link Here
2222
	// Verify Regexp match rule
2228
	// Verify Regexp match rule
2223
	if ((matchRule & R_REGEXP_MATCH) != 0) {
2229
	if ((matchRule & R_REGEXP_MATCH) != 0) {
2224
		if ((matchRule & R_PATTERN_MATCH) != 0 || (matchRule & R_PREFIX_MATCH) != 0 || 
2230
		if ((matchRule & R_PATTERN_MATCH) != 0 || (matchRule & R_PREFIX_MATCH) != 0 || 
2225
			(matchRule & R_CAMEL_CASE_MATCH) != 0 || (matchRule & R_CAMELCASE_MATCH) != 0) {
2231
			(matchRule & R_CAMELCASE_MATCH) != 0 || (matchRule & R_CAMELCASE_SAME_PART_COUNT_MATCH) != 0) {
2232
			// regexp is not supported yet
2226
			return -1;
2233
			return -1;
2227
		}
2234
		}
2228
	}
2235
	}
2229
2236
2230
	// Verify Pattern match rule
2237
	// Verify Pattern match rule
2231
	int starIndex = stringPattern.indexOf('*');
2238
	if (stringPattern != null) {
2232
	int questionIndex = stringPattern.indexOf('?');
2239
		int starIndex = stringPattern.indexOf('*');
2233
	if (starIndex < 0 && questionIndex < 0) {
2240
		int questionIndex = stringPattern.indexOf('?');
2234
		// reset pattern match flag if any
2241
		if (starIndex < 0 && questionIndex < 0) {
2235
		matchRule &= ~R_PATTERN_MATCH;
2242
			// reset pattern match flag if any
2236
	} else {
2243
			matchRule &= ~R_PATTERN_MATCH;
2237
		// force Pattern rule
2244
		} else {
2238
		matchRule |= R_PATTERN_MATCH;
2245
			// force Pattern rule
2246
			matchRule |= R_PATTERN_MATCH;
2247
		}
2239
	}
2248
	}
2240
	if ((matchRule & R_PATTERN_MATCH) != 0) {
2249
	if ((matchRule & R_PATTERN_MATCH) != 0) {
2241
		// remove Camel Case and Prefix match flags if any
2250
		// reset other incompatible flags
2242
		matchRule &= ~R_CAMELCASE_MATCH;
2251
		matchRule &= ~R_CAMELCASE_MATCH;
2243
		matchRule &= ~R_CAMEL_CASE_MATCH;
2252
		matchRule &= ~R_CAMELCASE_SAME_PART_COUNT_MATCH;
2244
		matchRule &= ~R_PREFIX_MATCH;
2253
		matchRule &= ~R_PREFIX_MATCH;
2254
		return matchRule;
2245
	}
2255
	}
2246
2256
2247
	// Verify Camel Case match rule
2257
	// Verify Camel Case
2248
	if ((matchRule & R_CAMEL_CASE_MATCH) != 0) {
2258
	if ((matchRule & R_CAMELCASE_MATCH) != 0) {
2249
		matchRule &= ~R_CAMELCASE_MATCH; // in case of some user specify both constants
2259
		// reset other incompatible flags
2250
		// Verify sting pattern validity
2260
		matchRule &= ~R_CAMELCASE_SAME_PART_COUNT_MATCH;
2251
		int length = stringPattern.length();
2261
		matchRule &= ~R_PREFIX_MATCH;
2252
		boolean validCamelCase = true;
2262
		// validate camel case rule and modify it if not valid
2253
		boolean uppercase = false;
2263
		boolean validCamelCase = validateCamelCasePattern(stringPattern);
2254
		for (int i=0; i<length && validCamelCase; i++) {
2255
			char ch = stringPattern.charAt(i);
2256
			validCamelCase = i==0 ? ScannerHelper.isJavaIdentifierStart(ch) : ScannerHelper.isJavaIdentifierPart(ch);
2257
			// at least one uppercase character is need in CamelCase pattern
2258
			// (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=136313)
2259
			if (!uppercase) uppercase = ScannerHelper.isUpperCase(ch);
2260
		}
2261
		validCamelCase = validCamelCase && uppercase;
2262
		// Verify flags compatibility
2263
		if (!validCamelCase) {
2264
		if (!validCamelCase) {
2264
			matchRule &= ~R_CAMEL_CASE_MATCH;
2265
			matchRule &= ~R_CAMELCASE_MATCH;
2265
			matchRule |= R_PREFIX_MATCH;
2266
			matchRule |= R_PREFIX_MATCH;
2266
		}
2267
		}
2268
		return matchRule;
2267
	}
2269
	}
2268
2270
	
2269
	// Verify deprecated Camel Case match rule for backward compatibility
2271
	// Verify Camel Case with same count of parts
2270
	else if ((matchRule & R_CAMELCASE_MATCH) != 0) {
2272
	if ((matchRule & R_CAMELCASE_SAME_PART_COUNT_MATCH) != 0) {
2271
		// Verify sting pattern validity
2273
		// reset other incompatible flags
2272
		int length = stringPattern.length();
2274
		matchRule &= ~R_PREFIX_MATCH;
2273
		boolean validCamelCase = true;
2275
		// validate camel case rule and modify it if not valid
2274
		boolean uppercase = false;
2276
		boolean validCamelCase = validateCamelCasePattern(stringPattern);
2275
		for (int i=0; i<length && validCamelCase; i++) {
2277
		if (!validCamelCase) {
2276
			char ch = stringPattern.charAt(i);
2278
			matchRule &= ~R_CAMELCASE_SAME_PART_COUNT_MATCH;
2277
			validCamelCase = i==0 ? ScannerHelper.isJavaIdentifierStart(ch) : ScannerHelper.isJavaIdentifierPart(ch);
2279
			matchRule |= R_PREFIX_MATCH;
2278
			// at least one uppercase character is need in CamelCase pattern
2279
			// (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=136313)
2280
			if (!uppercase) uppercase = ScannerHelper.isUpperCase(ch);
2281
		}
2282
		validCamelCase = validCamelCase && uppercase;
2283
		// Verify flags compatibility
2284
		if (validCamelCase) {
2285
			if ((matchRule & R_PREFIX_MATCH) != 0) {
2286
				if ((matchRule & R_CASE_SENSITIVE) != 0) {
2287
					// This is equivalent to Camel Case match rule
2288
					matchRule &= ~R_PREFIX_MATCH;
2289
					matchRule &= ~R_CASE_SENSITIVE;
2290
				}
2291
			}
2292
		} else {
2293
			matchRule &= ~R_CAMELCASE_MATCH;
2294
			if ((matchRule & R_PREFIX_MATCH) == 0) {
2295
				matchRule |= R_PREFIX_MATCH;
2296
				matchRule |= R_CASE_SENSITIVE;
2297
			}
2298
		}
2280
		}
2281
		return matchRule;
2299
	}
2282
	}
2283
2284
	// Return the validated match rule (modified if necessary)
2300
	return matchRule;
2285
	return matchRule;
2301
}
2286
}
2302
2287
2303
/**
2288
/*
2304
 * Update deprecated flags if necessary in the given match rule.
2289
 * Validate pattern for a camel case match rule
2305
 * 
2290
 * @return
2306
 * @param matchRule The match rule to update
2291
 */
2307
 * @return The updated match rule with the updated flags
2292
private static boolean validateCamelCasePattern(String stringPattern) {
2308
 */
2293
	if (stringPattern == null) return true;
2309
static int updateMatchRule(int matchRule) {
2294
	// verify sting pattern validity
2310
	if ((matchRule & R_CAMELCASE_MATCH) != 0) {
2295
	int length = stringPattern.length();
2311
		matchRule &= ~R_CAMELCASE_MATCH;
2296
	boolean validCamelCase = true;
2312
		matchRule |= R_CAMEL_CASE_MATCH;
2297
	int uppercase = 0;
2313
		if ((matchRule & (R_PREFIX_MATCH | R_CASE_SENSITIVE)) == 0) {
2298
	for (int i=0; i<length && validCamelCase; i++) {
2314
			matchRule |= R_PREFIX_MATCH;
2299
		char ch = stringPattern.charAt(i);
2315
		}
2300
		validCamelCase = i==0 ? ScannerHelper.isJavaIdentifierStart(ch) : ScannerHelper.isJavaIdentifierPart(ch);
2301
		// at least one uppercase character is need in CamelCase pattern
2302
		// (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=136313)
2303
		if (ScannerHelper.isUpperCase(ch)) uppercase++;
2316
	}
2304
	}
2317
	return matchRule;
2305
	if (validCamelCase) {
2306
		validCamelCase = uppercase > 0;
2307
	}
2308
	return validCamelCase;
2318
}
2309
}
2319
2310
2320
/**
2311
/**
(-)search/org/eclipse/jdt/core/search/SearchEngine.java (-32 / +57 lines)
Lines 565-576 Link Here
565
	 *					May be <code>null</code>, then any type name is accepted.
565
	 *					May be <code>null</code>, then any type name is accepted.
566
	 * @param matchRule type name match rule one of
566
	 * @param matchRule type name match rule one of
567
	 * <ul>
567
	 * <ul>
568
	 *		<li>{@link SearchPattern#R_EXACT_MATCH} if the package name and type name are the full names
568
	 *		<li>{@link SearchPattern#R_EXACT_MATCH} if the package name and type
569
	 *			of the searched types.</li>
569
	 *			name are the full names of the searched types.</li>
570
	 *		<li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type name are prefixes of the names
570
	 *		<li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type
571
	 *			of the searched types.</li>
571
	 *			name are prefixes of the names of the searched types.</li>
572
	 *		<li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and type name contain wild-cards.</li>
572
	 *		<li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and
573
	 *		<li>{@link SearchPattern#R_CAMEL_CASE_MATCH} if type name are camel case of the names of the searched types.</li>
573
	 *			type name contain wild-cards.</li>
574
	 *		<li>{@link SearchPattern#R_CAMELCASE_MATCH} if the type name is a
575
	 *			camel case of the searched types name.</li>
576
	 *		<li>{@link SearchPattern#R_CAMELCASE_SAME_PART_COUNT_MATCH}
577
	 *			if the type name is a camel case with same part count of the searched
578
	 *			types name.</li>
574
	 * </ul>
579
	 * </ul>
575
	 * combined with {@link SearchPattern#R_CASE_SENSITIVE},
580
	 * combined with {@link SearchPattern#R_CASE_SENSITIVE},
576
	 *   e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, 
581
	 *   e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, 
Lines 632-655 Link Here
632
	 *					May be <code>null</code>, then any type name is accepted.
637
	 *					May be <code>null</code>, then any type name is accepted.
633
	 * @param packageMatchRule one of
638
	 * @param packageMatchRule one of
634
	 * <ul>
639
	 * <ul>
635
	 *		<li>{@link SearchPattern#R_EXACT_MATCH} if the package name and type name are the full names
640
	 *		<li>{@link SearchPattern#R_EXACT_MATCH} if the package name and type
636
	 *			of the searched types.</li>
641
	 *			name are the full names of the searched types.</li>
637
	 *		<li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type name are prefixes of the names
642
	 *		<li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type
638
	 *			of the searched types.</li>
643
	 *			name are prefixes of the names of the searched types.</li>
639
	 *		<li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and type name contain wild-cards.</li>
644
	 *		<li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and
640
	 *		<li>{@link SearchPattern#R_CAMEL_CASE_MATCH} if type name are camel case of the names of the searched types.</li>
645
	 *			type name contain wild-cards.</li>
646
	 *		<li>{@link SearchPattern#R_CAMELCASE_MATCH} if the package name is a
647
	 *			camel case of the searched types package name.</li>
648
	 *		<li>{@link SearchPattern#R_CAMELCASE_SAME_PART_COUNT_MATCH}
649
	 *			if the package name is a camel case with same part count of the searched
650
	 *			types package name.</li>
641
	 * </ul>
651
	 * </ul>
642
	 * combined with {@link SearchPattern#R_CASE_SENSITIVE},
652
	 * combined with {@link SearchPattern#R_CASE_SENSITIVE},
643
	 *   e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, 
653
	 *   e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, 
644
	 *   or {@link SearchPattern#R_PREFIX_MATCH} if a prefix non case sensitive match is requested.
654
	 *   or {@link SearchPattern#R_PREFIX_MATCH} if a prefix non case sensitive match is requested.
645
	 * @param typeMatchRule one of
655
	 * @param typeMatchRule one of
646
	 * <ul>
656
	 * <ul>
647
	 *		<li>{@link SearchPattern#R_EXACT_MATCH} if the package name and type name are the full names
657
	 *		<li>{@link SearchPattern#R_EXACT_MATCH} if the package name and type
648
	 *			of the searched types.</li>
658
	 *			name are the full names of the searched types.</li>
649
	 *		<li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type name are prefixes of the names
659
	 *		<li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type
650
	 *			of the searched types.</li>
660
	 *			name are prefixes of the names of the searched types.</li>
651
	 *		<li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and type name contain wild-cards.</li>
661
	 *		<li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and
652
	 *		<li>{@link SearchPattern#R_CAMEL_CASE_MATCH} if type name are camel case of the names of the searched types.</li>
662
	 *			type name contain wild-cards.</li>
663
	 *		<li>{@link SearchPattern#R_CAMELCASE_MATCH} if the type name is a
664
	 *			camel case of the searched types name.</li>
665
	 *		<li>{@link SearchPattern#R_CAMELCASE_SAME_PART_COUNT_MATCH}
666
	 *			if the type name is a camel case with same part count of the searched
667
	 *			types name.</li>
653
	 * </ul>
668
	 * </ul>
654
	 * combined with {@link SearchPattern#R_CASE_SENSITIVE},
669
	 * combined with {@link SearchPattern#R_CASE_SENSITIVE},
655
	 *   e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, 
670
	 *   e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, 
Lines 697-703 Link Here
697
		this.basicEngine.searchAllTypeNames(packageName,
712
		this.basicEngine.searchAllTypeNames(packageName,
698
			packageMatchRule,
713
			packageMatchRule,
699
			typeName,
714
			typeName,
700
			SearchPattern.updateMatchRule(typeMatchRule), 
715
			typeMatchRule, 
701
			searchFor,
716
			searchFor,
702
			scope,
717
			scope,
703
			requestorWrapper,
718
			requestorWrapper,
Lines 719-730 Link Here
719
	 *						May be <code>null</code>, then any package name is accepted.
734
	 *						May be <code>null</code>, then any package name is accepted.
720
	 * @param packageMatchRule one of
735
	 * @param packageMatchRule one of
721
	 * <ul>
736
	 * <ul>
722
	 *		<li>{@link SearchPattern#R_EXACT_MATCH} if the package name and type name are the full names
737
	 *		<li>{@link SearchPattern#R_EXACT_MATCH} if the package name and type
723
	 *			of the searched types.</li>
738
	 *			name are the full names of the searched types.</li>
724
	 *		<li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type name are prefixes of the names
739
	 *		<li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type
725
	 *			of the searched types.</li>
740
	 *			name are prefixes of the names of the searched types.</li>
726
	 *		<li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and type name contain wild-cards.</li>
741
	 *		<li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and
727
	 *		<li>{@link SearchPattern#R_CAMEL_CASE_MATCH} if type name are camel case of the names of the searched types.</li>
742
	 *			type name contain wild-cards.</li>
743
	 *		<li>{@link SearchPattern#R_CAMELCASE_MATCH} if the package name is a
744
	 *			camel case of the searched types package name.</li>
745
	 *		<li>{@link SearchPattern#R_CAMELCASE_SAME_PART_COUNT_MATCH}
746
	 *			if the package name is a camel case with same part count of the searched
747
	 *			types package name.</li>
728
	 * </ul>
748
	 * </ul>
729
	 * combined with {@link SearchPattern#R_CASE_SENSITIVE},
749
	 * combined with {@link SearchPattern#R_CASE_SENSITIVE},
730
	 *   e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, 
750
	 *   e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, 
Lines 735-746 Link Here
735
	 *					May be <code>null</code>, then any type name is accepted.
755
	 *					May be <code>null</code>, then any type name is accepted.
736
	 * @param typeMatchRule one of
756
	 * @param typeMatchRule one of
737
	 * <ul>
757
	 * <ul>
738
	 *		<li>{@link SearchPattern#R_EXACT_MATCH} if the package name and type name are the full names
758
	 *		<li>{@link SearchPattern#R_EXACT_MATCH} if the package name and type
739
	 *			of the searched types.</li>
759
	 *			name are the full names of the searched types.</li>
740
	 *		<li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type name are prefixes of the names
760
	 *		<li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type
741
	 *			of the searched types.</li>
761
	 *			name are prefixes of the names of the searched types.</li>
742
	 *		<li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and type name contain wild-cards.</li>
762
	 *		<li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and
743
	 *		<li>{@link SearchPattern#R_CAMEL_CASE_MATCH} if type name are camel case of the names of the searched types.</li>
763
	 *			type name contain wild-cards.</li>
764
	 *		<li>{@link SearchPattern#R_CAMELCASE_MATCH} if the type name is a
765
	 *			camel case of the searched types name.</li>
766
	 *		<li>{@link SearchPattern#R_CAMELCASE_SAME_PART_COUNT_MATCH}
767
	 *			if the type name is a camel case with same part count of the searched
768
	 *			types name.</li>
744
	 * </ul>
769
	 * </ul>
745
	 * combined with {@link SearchPattern#R_CASE_SENSITIVE},
770
	 * combined with {@link SearchPattern#R_CASE_SENSITIVE},
746
	 *   e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, 
771
	 *   e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested, 
Lines 789-795 Link Here
789
		this.basicEngine.searchAllTypeNames(packageName, 
814
		this.basicEngine.searchAllTypeNames(packageName, 
790
			packageMatchRule, 
815
			packageMatchRule, 
791
			typeName, 
816
			typeName, 
792
			SearchPattern.updateMatchRule(typeMatchRule), 
817
			typeMatchRule, 
793
			searchFor, 
818
			searchFor, 
794
			scope, 
819
			scope, 
795
			requestorWrapper, 
820
			requestorWrapper, 
(-)search/org/eclipse/jdt/internal/core/index/Index.java (-13 / +13 lines)
Lines 47-53 Link Here
47
	SearchPattern.R_PATTERN_MATCH |
47
	SearchPattern.R_PATTERN_MATCH |
48
	SearchPattern.R_REGEXP_MATCH |
48
	SearchPattern.R_REGEXP_MATCH |
49
	SearchPattern.R_CASE_SENSITIVE |
49
	SearchPattern.R_CASE_SENSITIVE |
50
	SearchPattern.R_CAMEL_CASE_MATCH;
50
	SearchPattern.R_CAMELCASE_MATCH |
51
	SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH;
51
52
52
public static boolean isMatch(char[] pattern, char[] word, int matchRule) {
53
public static boolean isMatch(char[] pattern, char[] word, int matchRule) {
53
	if (pattern == null) return true;
54
	if (pattern == null) return true;
Lines 56-74 Link Here
56
	if (patternLength == 0) return matchRule != SearchPattern.R_EXACT_MATCH;
57
	if (patternLength == 0) return matchRule != SearchPattern.R_EXACT_MATCH;
57
	if (wordLength == 0) return (matchRule & SearchPattern.R_PATTERN_MATCH) != 0 && patternLength == 1 && pattern[0] == '*';
58
	if (wordLength == 0) return (matchRule & SearchPattern.R_PATTERN_MATCH) != 0 && patternLength == 1 && pattern[0] == '*';
58
59
59
	// First test camel case if necessary
60
	boolean isCamelCase = (matchRule & SearchPattern.R_CAMEL_CASE_MATCH) != 0;
61
	if (isCamelCase) {
62
		// prefix is always needed as index key got characters after type simple name
63
		// see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=201064
64
		if (pattern[0] == word[0] && CharOperation.camelCaseMatch(pattern, word, true/*prefix match*/)) {
65
			return true;
66
		}
67
		if ((matchRule & SearchPattern.R_CASE_SENSITIVE) != 0) return false;
68
	}
69
70
	// need to mask some bits of pattern rule (bug 79790)
60
	// need to mask some bits of pattern rule (bug 79790)
71
	matchRule &= ~SearchPattern.R_CAMEL_CASE_MATCH;
72
	switch(matchRule & MATCH_RULE_INDEX_MASK) {
61
	switch(matchRule & MATCH_RULE_INDEX_MASK) {
73
		case SearchPattern.R_EXACT_MATCH :
62
		case SearchPattern.R_EXACT_MATCH :
74
			return patternLength == wordLength && CharOperation.equals(pattern, word, false);
63
			return patternLength == wordLength && CharOperation.equals(pattern, word, false);
Lines 76-87 Link Here
76
			return patternLength <= wordLength && CharOperation.prefixEquals(pattern, word, false);
65
			return patternLength <= wordLength && CharOperation.prefixEquals(pattern, word, false);
77
		case SearchPattern.R_PATTERN_MATCH :
66
		case SearchPattern.R_PATTERN_MATCH :
78
			return CharOperation.match(pattern, word, false);
67
			return CharOperation.match(pattern, word, false);
68
		case SearchPattern.R_CAMELCASE_MATCH:
69
		// same part count is not activated because index key may have uppercase letters after the type name
70
		case SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH:
71
			if (CharOperation.camelCaseMatch(pattern, word, false)) {
72
				return true;
73
			}
74
			return patternLength <= wordLength && CharOperation.prefixEquals(pattern, word, false);
79
		case SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE :
75
		case SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE :
80
			return pattern[0] == word[0] && patternLength == wordLength && CharOperation.equals(pattern, word);
76
			return pattern[0] == word[0] && patternLength == wordLength && CharOperation.equals(pattern, word);
81
		case SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE :
77
		case SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE :
82
			return pattern[0] == word[0] && patternLength <= wordLength && CharOperation.prefixEquals(pattern, word);
78
			return pattern[0] == word[0] && patternLength <= wordLength && CharOperation.prefixEquals(pattern, word);
83
		case SearchPattern.R_PATTERN_MATCH | SearchPattern.R_CASE_SENSITIVE :
79
		case SearchPattern.R_PATTERN_MATCH | SearchPattern.R_CASE_SENSITIVE :
84
			return CharOperation.match(pattern, word, true);
80
			return CharOperation.match(pattern, word, true);
81
		case SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE :
82
		// same part count is not activated because index key may have uppercase letters after the type name
83
		case SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH | SearchPattern.R_CASE_SENSITIVE :
84
			return (pattern[0] == word[0] && CharOperation.camelCaseMatch(pattern, word, false));
85
	}
85
	}
86
	return false;
86
	return false;
87
}
87
}
(-)model/org/eclipse/jdt/internal/core/SearchableEnvironment.java (-1 / +1 lines)
Lines 380-386 Link Here
380
			};
380
			};
381
			try {
381
			try {
382
				int matchRule = SearchPattern.R_PREFIX_MATCH;
382
				int matchRule = SearchPattern.R_PREFIX_MATCH;
383
				if (camelCaseMatch) matchRule |= SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH;
383
				if (camelCaseMatch) matchRule |= SearchPattern.R_CAMELCASE_MATCH;
384
				new BasicSearchEngine(this.workingCopies).searchAllTypeNames(
384
				new BasicSearchEngine(this.workingCopies).searchAllTypeNames(
385
					qualification,
385
					qualification,
386
					SearchPattern.R_EXACT_MATCH,
386
					SearchPattern.R_EXACT_MATCH,
(-)search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java (-25 / +46 lines)
Lines 36-42 Link Here
36
/**
36
/**
37
 * Search basic engine. Public search engine (see {@link org.eclipse.jdt.core.search.SearchEngine}
37
 * Search basic engine. Public search engine (see {@link org.eclipse.jdt.core.search.SearchEngine}
38
 * for detailed comment), now uses basic engine functionalities.
38
 * for detailed comment), now uses basic engine functionalities.
39
 * Note that serch basic engine does not implement deprecated functionalities...
39
 * Note that search basic engine does not implement deprecated functionalities...
40
 */
40
 */
41
public class BasicSearchEngine {
41
public class BasicSearchEngine {
42
42
Lines 271-281 Link Here
271
				case SearchPattern.R_REGEXP_MATCH:
271
				case SearchPattern.R_REGEXP_MATCH:
272
					buffer.append("R_REGEXP_MATCH"); //$NON-NLS-1$
272
					buffer.append("R_REGEXP_MATCH"); //$NON-NLS-1$
273
					break;
273
					break;
274
				case 0x0080: // SearchPattern.R_CAMELCASE_MATCH:
274
				case SearchPattern.R_CAMELCASE_MATCH:
275
					buffer.append("R_CAMELCASE_MATCH"); //$NON-NLS-1$
275
					buffer.append("R_CAMELCASE_MATCH"); //$NON-NLS-1$
276
					break;
276
					break;
277
				case SearchPattern.R_CAMEL_CASE_MATCH:
277
				case SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH:
278
					buffer.append("R_CAMEL_CASE_MATCH"); //$NON-NLS-1$
278
					buffer.append("R_CAMELCASE_SAME_PART_COUNT_MATCH"); //$NON-NLS-1$
279
					break;
279
					break;
280
			}
280
			}
281
		}
281
		}
Lines 457-474 Link Here
457
				return false;
457
				return false;
458
		
458
		
459
		if (patternTypeName != null) {
459
		if (patternTypeName != null) {
460
			boolean isCamelCase = (matchRule & SearchPattern.R_CAMEL_CASE_MATCH) != 0;
460
			boolean isCamelCase = (matchRule & (SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH)) != 0;
461
			int matchMode = matchRule & JavaSearchPattern.MATCH_MODE_MASK;
461
			int matchMode = matchRule & JavaSearchPattern.MATCH_MODE_MASK;
462
			if (!isCaseSensitive && !isCamelCase) {
462
			if (!isCaseSensitive && !isCamelCase) {
463
				patternTypeName = CharOperation.toLowerCase(patternTypeName);
463
				patternTypeName = CharOperation.toLowerCase(patternTypeName);
464
			}
464
			}
465
			boolean matchFirstChar = !isCaseSensitive || patternTypeName[0] == typeName[0];
465
			boolean matchFirstChar = !isCaseSensitive || patternTypeName[0] == typeName[0];
466
			if (isCamelCase) {
467
				if (matchFirstChar && CharOperation.camelCaseMatch(patternTypeName, typeName, (matchRule & SearchPattern.R_PREFIX_MATCH) != 0)) {
468
					return true;
469
				}
470
				if (isCaseSensitive) return false;
471
			}
472
			switch(matchMode) {
466
			switch(matchMode) {
473
				case SearchPattern.R_EXACT_MATCH :
467
				case SearchPattern.R_EXACT_MATCH :
474
					return matchFirstChar && CharOperation.equals(patternTypeName, typeName, isCaseSensitive);
468
					return matchFirstChar && CharOperation.equals(patternTypeName, typeName, isCaseSensitive);
Lines 479-484 Link Here
479
				case SearchPattern.R_REGEXP_MATCH :
473
				case SearchPattern.R_REGEXP_MATCH :
480
					// TODO (frederic) implement regular expression match
474
					// TODO (frederic) implement regular expression match
481
					break;
475
					break;
476
				case SearchPattern.R_CAMELCASE_MATCH:
477
					if (matchFirstChar && CharOperation.camelCaseMatch(patternTypeName, typeName, false)) {
478
						return true;
479
					}
480
					return !isCaseSensitive && matchFirstChar && CharOperation.prefixEquals(patternTypeName, typeName, false);
481
				case SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH:
482
					return matchFirstChar && CharOperation.camelCaseMatch(patternTypeName, typeName, true);
482
			}
483
			}
483
		}
484
		}
484
		return true;
485
		return true;
Lines 645-659 Link Here
645
		int waitingPolicy,
646
		int waitingPolicy,
646
		IProgressMonitor progressMonitor)  throws JavaModelException {
647
		IProgressMonitor progressMonitor)  throws JavaModelException {
647
648
649
		// Validate match rule first
650
		final int validatedTypeMatchRule = SearchPattern.validateMatchRule(typeName == null ? null : new String (typeName), typeMatchRule);
651
		
652
		// Debug
648
		if (VERBOSE) {
653
		if (VERBOSE) {
649
			Util.verbose("BasicSearchEngine.searchAllTypeNames(char[], char[], int, int, IJavaSearchScope, IRestrictedAccessTypeRequestor, int, IProgressMonitor)"); //$NON-NLS-1$
654
			Util.verbose("BasicSearchEngine.searchAllTypeNames(char[], char[], int, int, IJavaSearchScope, IRestrictedAccessTypeRequestor, int, IProgressMonitor)"); //$NON-NLS-1$
650
			Util.verbose("	- package name: "+(packageName==null?"null":new String(packageName))); //$NON-NLS-1$ //$NON-NLS-2$
655
			Util.verbose("	- package name: "+(packageName==null?"null":new String(packageName))); //$NON-NLS-1$ //$NON-NLS-2$
651
			Util.verbose("	- match rule: "+getMatchRuleString(packageMatchRule)); //$NON-NLS-1$
656
			Util.verbose("	- package match rule: "+getMatchRuleString(packageMatchRule)); //$NON-NLS-1$
652
			Util.verbose("	- type name: "+(typeName==null?"null":new String(typeName))); //$NON-NLS-1$ //$NON-NLS-2$
657
			Util.verbose("	- type name: "+(typeName==null?"null":new String(typeName))); //$NON-NLS-1$ //$NON-NLS-2$
653
			Util.verbose("	- match rule: "+getMatchRuleString(typeMatchRule)); //$NON-NLS-1$
658
			Util.verbose("	- type match rule: "+getMatchRuleString(typeMatchRule)); //$NON-NLS-1$
659
			if (validatedTypeMatchRule != typeMatchRule) {
660
				Util.verbose("	- validated type match rule: "+getMatchRuleString(validatedTypeMatchRule)); //$NON-NLS-1$
661
			}
654
			Util.verbose("	- search for: "+searchFor); //$NON-NLS-1$
662
			Util.verbose("	- search for: "+searchFor); //$NON-NLS-1$
655
			Util.verbose("	- scope: "+scope); //$NON-NLS-1$
663
			Util.verbose("	- scope: "+scope); //$NON-NLS-1$
656
		}
664
		}
665
		if (validatedTypeMatchRule == -1) return; // invalid match rule => return no results
657
666
658
		// Create pattern
667
		// Create pattern
659
		IndexManager indexManager = JavaModelManager.getIndexManager();
668
		IndexManager indexManager = JavaModelManager.getIndexManager();
Lines 690-702 Link Here
690
				null,
699
				null,
691
				typeName,
700
				typeName,
692
				typeSuffix,
701
				typeSuffix,
693
				typeMatchRule)
702
				validatedTypeMatchRule)
694
			: new QualifiedTypeDeclarationPattern(
703
			: new QualifiedTypeDeclarationPattern(
695
				packageName,
704
				packageName,
696
				packageMatchRule,
705
				packageMatchRule,
697
				typeName,
706
				typeName,
698
				typeSuffix,
707
				typeSuffix,
699
				typeMatchRule);
708
				validatedTypeMatchRule);
700
709
701
		// Get working copy path(s). Store in a single string in case of only one to optimize comparison in requestor
710
		// Get working copy path(s). Store in a single string in case of only one to optimize comparison in requestor
702
		final HashSet workingCopyPaths = new HashSet();
711
		final HashSet workingCopyPaths = new HashSet();
Lines 728-734 Link Here
728
						break;
737
						break;
729
					case 1:
738
					case 1:
730
						if (singleWkcpPath.equals(documentPath)) {
739
						if (singleWkcpPath.equals(documentPath)) {
731
							return true; // fliter out *the* working copy
740
							return true; // filter out *the* working copy
732
						}
741
						}
733
						break;
742
						break;
734
					default:
743
					default:
Lines 813-819 Link Here
813
							} else /*if (type.isInterface())*/ {
822
							} else /*if (type.isInterface())*/ {
814
								kind = TypeDeclaration.INTERFACE_DECL;
823
								kind = TypeDeclaration.INTERFACE_DECL;
815
							}
824
							}
816
							if (match(typeSuffix, packageName, typeName, typeMatchRule, kind, packageDeclaration, simpleName)) {
825
							if (match(typeSuffix, packageName, typeName, validatedTypeMatchRule, kind, packageDeclaration, simpleName)) {
817
								if (nameRequestor instanceof TypeNameMatchRequestorWrapper) {
826
								if (nameRequestor instanceof TypeNameMatchRequestorWrapper) {
818
									((TypeNameMatchRequestorWrapper)nameRequestor).requestor.acceptTypeNameMatch(new JavaSearchTypeNameMatch(type, type.getFlags()));
827
									((TypeNameMatchRequestorWrapper)nameRequestor).requestor.acceptTypeNameMatch(new JavaSearchTypeNameMatch(type, type.getFlags()));
819
								} else {
828
								} else {
Lines 833-839 Link Here
833
									return false; // no local/anonymous type
842
									return false; // no local/anonymous type
834
								}
843
								}
835
								public boolean visit(TypeDeclaration typeDeclaration, CompilationUnitScope compilationUnitScope) {
844
								public boolean visit(TypeDeclaration typeDeclaration, CompilationUnitScope compilationUnitScope) {
836
									if (match(typeSuffix, packageName, typeName, typeMatchRule, TypeDeclaration.kind(typeDeclaration.modifiers), packageDeclaration, typeDeclaration.name)) {
845
									if (match(typeSuffix, packageName, typeName, validatedTypeMatchRule, TypeDeclaration.kind(typeDeclaration.modifiers), packageDeclaration, typeDeclaration.name)) {
837
										if (nameRequestor instanceof TypeNameMatchRequestorWrapper) {
846
										if (nameRequestor instanceof TypeNameMatchRequestorWrapper) {
838
											IType type = workingCopy.getType(new String(typeName));
847
											IType type = workingCopy.getType(new String(typeName));
839
											((TypeNameMatchRequestorWrapper)nameRequestor).requestor.acceptTypeNameMatch(new JavaSearchTypeNameMatch(type, typeDeclaration.modifiers));
848
											((TypeNameMatchRequestorWrapper)nameRequestor).requestor.acceptTypeNameMatch(new JavaSearchTypeNameMatch(type, typeDeclaration.modifiers));
Lines 844-850 Link Here
844
									return true;
853
									return true;
845
								}
854
								}
846
								public boolean visit(TypeDeclaration memberTypeDeclaration, ClassScope classScope) {
855
								public boolean visit(TypeDeclaration memberTypeDeclaration, ClassScope classScope) {
847
									if (match(typeSuffix, packageName, typeName, typeMatchRule, TypeDeclaration.kind(memberTypeDeclaration.modifiers), packageDeclaration, memberTypeDeclaration.name)) {
856
									if (match(typeSuffix, packageName, typeName, validatedTypeMatchRule, TypeDeclaration.kind(memberTypeDeclaration.modifiers), packageDeclaration, memberTypeDeclaration.name)) {
848
										// compute enclosing type names
857
										// compute enclosing type names
849
										TypeDeclaration enclosing = memberTypeDeclaration.enclosingType;
858
										TypeDeclaration enclosing = memberTypeDeclaration.enclosingType;
850
										char[][] enclosingTypeNames = CharOperation.NO_CHAR_CHAR;
859
										char[][] enclosingTypeNames = CharOperation.NO_CHAR_CHAR;
Lines 892-914 Link Here
892
	public void searchAllTypeNames(
901
	public void searchAllTypeNames(
893
		final char[][] qualifications, 
902
		final char[][] qualifications, 
894
		final char[][] typeNames,
903
		final char[][] typeNames,
895
		final int matchRule, 
904
		int matchRule, 
896
		int searchFor, 
905
		int searchFor, 
897
		IJavaSearchScope scope, 
906
		IJavaSearchScope scope, 
898
		final IRestrictedAccessTypeRequestor nameRequestor,
907
		final IRestrictedAccessTypeRequestor nameRequestor,
899
		int waitingPolicy,
908
		int waitingPolicy,
900
		IProgressMonitor progressMonitor)  throws JavaModelException {
909
		IProgressMonitor progressMonitor)  throws JavaModelException {
901
910
911
		// Validate match rule first
912
		int namesLength = typeNames == null ? 0 : typeNames.length;
913
		for (int i=0; i<namesLength; i++) {
914
			matchRule &= SearchPattern.validateMatchRule(new String(typeNames[i]), matchRule);
915
		}
916
		final int validatedMatchRule = matchRule;
917
		
918
		// Debug
902
		if (VERBOSE) {
919
		if (VERBOSE) {
903
			Util.verbose("BasicSearchEngine.searchAllTypeNames(char[][], char[][], int, int, IJavaSearchScope, IRestrictedAccessTypeRequestor, int, IProgressMonitor)"); //$NON-NLS-1$
920
			Util.verbose("BasicSearchEngine.searchAllTypeNames(char[][], char[][], int, int, IJavaSearchScope, IRestrictedAccessTypeRequestor, int, IProgressMonitor)"); //$NON-NLS-1$
904
			Util.verbose("	- package name: "+(qualifications==null?"null":new String(CharOperation.concatWith(qualifications, ',')))); //$NON-NLS-1$ //$NON-NLS-2$
921
			Util.verbose("	- package name: "+(qualifications==null?"null":new String(CharOperation.concatWith(qualifications, ',')))); //$NON-NLS-1$ //$NON-NLS-2$
905
			Util.verbose("	- type name: "+(typeNames==null?"null":new String(CharOperation.concatWith(typeNames, ',')))); //$NON-NLS-1$ //$NON-NLS-2$
922
			Util.verbose("	- type name: "+(typeNames==null?"null":new String(CharOperation.concatWith(typeNames, ',')))); //$NON-NLS-1$ //$NON-NLS-2$
906
			Util.verbose("	- match rule: "+matchRule); //$NON-NLS-1$
923
			Util.verbose("	- match rule: "+matchRule); //$NON-NLS-1$
924
			if (validatedMatchRule != matchRule) {
925
				Util.verbose("	- validated match rule: "+getMatchRuleString(validatedMatchRule)); //$NON-NLS-1$
926
			}
907
			Util.verbose("	- search for: "+searchFor); //$NON-NLS-1$
927
			Util.verbose("	- search for: "+searchFor); //$NON-NLS-1$
908
			Util.verbose("	- scope: "+scope); //$NON-NLS-1$
928
			Util.verbose("	- scope: "+scope); //$NON-NLS-1$
909
		}
929
		}
910
		IndexManager indexManager = JavaModelManager.getIndexManager();
930
		IndexManager indexManager = JavaModelManager.getIndexManager();
911
931
932
		// Create pattern
912
		final char typeSuffix;
933
		final char typeSuffix;
913
		switch(searchFor){
934
		switch(searchFor){
914
			case IJavaSearchConstants.CLASS :
935
			case IJavaSearchConstants.CLASS :
Lines 936-942 Link Here
936
				typeSuffix = IIndexConstants.TYPE_SUFFIX;
957
				typeSuffix = IIndexConstants.TYPE_SUFFIX;
937
				break;
958
				break;
938
		}
959
		}
939
		final MultiTypeDeclarationPattern pattern = new MultiTypeDeclarationPattern(qualifications, typeNames, typeSuffix, matchRule);
960
		final MultiTypeDeclarationPattern pattern = new MultiTypeDeclarationPattern(qualifications, typeNames, typeSuffix, validatedMatchRule);
940
961
941
		// Get working copy path(s). Store in a single string in case of only one to optimize comparison in requestor
962
		// Get working copy path(s). Store in a single string in case of only one to optimize comparison in requestor
942
		final HashSet workingCopyPaths = new HashSet();
963
		final HashSet workingCopyPaths = new HashSet();
Lines 968-974 Link Here
968
						break;
989
						break;
969
					case 1:
990
					case 1:
970
						if (singleWkcpPath.equals(documentPath)) {
991
						if (singleWkcpPath.equals(documentPath)) {
971
							return true; // fliter out *the* working copy
992
							return true; // filter out *the* working copy
972
						}
993
						}
973
						break;
994
						break;
974
					default:
995
					default:
Lines 1071-1084 Link Here
1071
								}
1092
								}
1072
								public boolean visit(TypeDeclaration typeDeclaration, CompilationUnitScope compilationUnitScope) {
1093
								public boolean visit(TypeDeclaration typeDeclaration, CompilationUnitScope compilationUnitScope) {
1073
									SearchPattern decodedPattern =
1094
									SearchPattern decodedPattern =
1074
										new QualifiedTypeDeclarationPattern(packageDeclaration, typeDeclaration.name, convertTypeKind(TypeDeclaration.kind(typeDeclaration.modifiers)), matchRule);
1095
										new QualifiedTypeDeclarationPattern(packageDeclaration, typeDeclaration.name, convertTypeKind(TypeDeclaration.kind(typeDeclaration.modifiers)), validatedMatchRule);
1075
									if (pattern.matchesDecodedKey(decodedPattern)) {
1096
									if (pattern.matchesDecodedKey(decodedPattern)) {
1076
										nameRequestor.acceptType(typeDeclaration.modifiers, packageDeclaration, typeDeclaration.name, CharOperation.NO_CHAR_CHAR, path, null);
1097
										nameRequestor.acceptType(typeDeclaration.modifiers, packageDeclaration, typeDeclaration.name, CharOperation.NO_CHAR_CHAR, path, null);
1077
									}
1098
									}
1078
									return true;
1099
									return true;
1079
								}
1100
								}
1080
								public boolean visit(TypeDeclaration memberTypeDeclaration, ClassScope classScope) {
1101
								public boolean visit(TypeDeclaration memberTypeDeclaration, ClassScope classScope) {
1081
									// compute encloising type names
1102
									// compute enclosing type names
1082
									char[] qualification = packageDeclaration;
1103
									char[] qualification = packageDeclaration;
1083
									TypeDeclaration enclosing = memberTypeDeclaration.enclosingType;
1104
									TypeDeclaration enclosing = memberTypeDeclaration.enclosingType;
1084
									char[][] enclosingTypeNames = CharOperation.NO_CHAR_CHAR;
1105
									char[][] enclosingTypeNames = CharOperation.NO_CHAR_CHAR;
Lines 1092-1098 Link Here
1092
										}
1113
										}
1093
									}
1114
									}
1094
									SearchPattern decodedPattern =
1115
									SearchPattern decodedPattern =
1095
										new QualifiedTypeDeclarationPattern(qualification, memberTypeDeclaration.name, convertTypeKind(TypeDeclaration.kind(memberTypeDeclaration.modifiers)), matchRule);
1116
										new QualifiedTypeDeclarationPattern(qualification, memberTypeDeclaration.name, convertTypeKind(TypeDeclaration.kind(memberTypeDeclaration.modifiers)), validatedMatchRule);
1096
									if (pattern.matchesDecodedKey(decodedPattern)) {
1117
									if (pattern.matchesDecodedKey(decodedPattern)) {
1097
										nameRequestor.acceptType(memberTypeDeclaration.modifiers, packageDeclaration, memberTypeDeclaration.name, enclosingTypeNames, path, null);
1118
										nameRequestor.acceptType(memberTypeDeclaration.modifiers, packageDeclaration, memberTypeDeclaration.name, enclosingTypeNames, path, null);
1098
									}
1119
									}
(-)src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java (-100 / +116 lines)
Lines 3715-3799 Link Here
3715
 *
3715
 *
3716
 * These tests are not really duplicates of {@link JavaSearchBugsTests} ones
3716
 * These tests are not really duplicates of {@link JavaSearchBugsTests} ones
3717
 * as they also test camel case in indexes...
3717
 * as they also test camel case in indexes...
3718
 * @deprecated As using a depreciated constant
3719
 */
3718
 */
3720
public void testCamelCaseTypePattern01() throws CoreException {
3719
public void testCamelCaseTypePattern01_CamelCase() throws CoreException {
3721
	search("RE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
3720
	search("RE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
3722
	assertSearchResults(
3721
	assertSearchResults(
3723
		"src/a3/References.java a3.References [References]\n" + 
3722
		"src/a3/References.java a3.References [References]\n" + 
3724
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3723
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3725
	);
3724
	);
3726
}
3725
}
3727
public void testCamelCaseTypePattern01b() throws CoreException {
3726
public void testCamelCaseTypePattern02_CamelCase() throws CoreException {
3728
	search("RE", TYPE, DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
3729
	assertSearchResults(
3730
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3731
	);
3732
}
3733
/** @deprecated As using a depreciated constant */
3734
public void testCamelCaseTypePattern02() throws CoreException {
3735
	search("RException", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
3727
	search("RException", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
3736
	assertSearchResults(
3728
	assertSearchResults(
3737
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3729
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3738
	);
3730
	);
3739
}
3731
}
3740
/** @deprecated As using a depreciated constant */
3732
public void testCamelCaseTypePattern03_CamelCase() throws CoreException {
3741
public void testCamelCaseTypePattern03() throws CoreException {
3742
	search("RuntimeException", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
3733
	search("RuntimeException", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
3743
	assertSearchResults(
3734
	assertSearchResults(
3744
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3735
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3745
	);
3736
	);
3746
}
3737
}
3747
/** @deprecated As using a depreciated constant */
3738
public void testCamelCaseTypePattern04_CamelCase() throws CoreException {
3748
public void testCamelCaseTypePattern04() throws CoreException {
3749
	search("RUNTIMEEXCEPTION", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
3739
	search("RUNTIMEEXCEPTION", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
3750
	assertSearchResults(
3740
	assertSearchResults(
3751
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3741
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3752
	);
3742
	);
3753
}
3743
}
3754
/**
3744
public void testCamelCaseTypePattern05_CamelCase() throws CoreException {
3755
 * @deprecated As using a depreciated constant
3756
 */
3757
public void testCamelCaseTypePattern05() throws CoreException {
3758
	search("R*E*", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
3745
	search("R*E*", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
3759
	assertSearchResults(
3746
	assertSearchResults(
3760
		"src/a3/References.java a3.References [References]\n" + 
3747
		"src/a3/References.java a3.References [References]\n" + 
3761
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3748
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3762
	);
3749
	);
3763
}
3750
}
3764
/** @deprecated As using a depreciated constant */
3751
public void testCamelCaseTypePattern06_CamelCase() throws CoreException {
3765
public void testCamelCaseTypePattern06() throws CoreException {
3766
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
3752
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
3767
	new SearchEngine().searchAllTypeNames(
3753
	searchAllTypeNames("CNS", SearchPattern.R_CAMELCASE_MATCH, requestor);
3768
		null,
3769
		SearchPattern.R_EXACT_MATCH,
3770
		"CNS".toCharArray(),
3771
		SearchPattern.R_CAMELCASE_MATCH,
3772
		TYPE,
3773
		getJavaSearchScope(),
3774
		requestor,
3775
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
3776
		null
3777
	);
3778
	assertSearchResults(
3754
	assertSearchResults(
3779
		"Unexpected all type names",
3755
		"Unexpected all type names",
3780
		"java.lang.CloneNotSupportedException",
3756
		"java.lang.CloneNotSupportedException",
3781
		requestor);
3757
		requestor);
3782
}
3758
}
3783
/** @deprecated As using a depreciated constant */
3759
public void testCamelCaseTypePattern07_CamelCase() throws CoreException {
3784
public void testCamelCaseTypePattern07() throws CoreException {
3785
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
3760
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
3786
	new SearchEngine().searchAllTypeNames(
3761
	searchAllTypeNames("AA", SearchPattern.R_CAMELCASE_MATCH, requestor);
3787
		null,
3788
		SearchPattern.R_EXACT_MATCH,
3789
		"AA".toCharArray(),
3790
		SearchPattern.R_CAMELCASE_MATCH,
3791
		TYPE,
3792
		getJavaSearchScope(),
3793
		requestor,
3794
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
3795
		null
3796
	);
3797
	assertSearchResults(
3762
	assertSearchResults(
3798
		"Unexpected all type names",
3763
		"Unexpected all type names",
3799
		"AA\n" + 
3764
		"AA\n" + 
Lines 3803-3822 Link Here
3803
		"q1.AA",
3768
		"q1.AA",
3804
		requestor);
3769
		requestor);
3805
}
3770
}
3806
/** @deprecated As using a depreciated constant */
3771
public void testCamelCaseTypePattern08_CamelCase() throws CoreException {
3807
public void testCamelCaseTypePattern08() throws CoreException {
3808
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
3772
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
3809
	new SearchEngine().searchAllTypeNames(
3773
	searchAllTypeNames("aa", SearchPattern.R_CAMELCASE_MATCH, requestor);
3810
		null,
3811
		SearchPattern.R_EXACT_MATCH,
3812
		"aa".toCharArray(),
3813
		SearchPattern.R_CAMELCASE_MATCH,
3814
		TYPE,
3815
		getJavaSearchScope(),
3816
		requestor,
3817
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
3818
		null
3819
	);
3820
	assertSearchResults(
3774
	assertSearchResults(
3821
		"Unexpected all type names",
3775
		"Unexpected all type names",
3822
		"AA\n" + 
3776
		"AA\n" + 
Lines 3825-3844 Link Here
3825
		"q1.AA",
3779
		"q1.AA",
3826
		requestor);
3780
		requestor);
3827
}
3781
}
3828
/** @deprecated As using a depreciated constant */
3782
public void testCamelCaseTypePattern09_CamelCase() throws CoreException {
3829
public void testCamelCaseTypePattern09() throws CoreException {
3830
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
3783
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
3831
	new SearchEngine().searchAllTypeNames(
3784
	searchAllTypeNames("aa", SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH, requestor);
3832
		null,
3833
		SearchPattern.R_EXACT_MATCH,
3834
		"aa".toCharArray(),
3835
		SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH,
3836
		TYPE,
3837
		getJavaSearchScope(),
3838
		requestor,
3839
		IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
3840
		null
3841
	);
3842
	assertSearchResults(
3785
	assertSearchResults(
3843
		"Unexpected all type names",
3786
		"Unexpected all type names",
3844
		"AA\n" + 
3787
		"AA\n" + 
Lines 3847-3859 Link Here
3847
		"q1.AA",
3790
		"q1.AA",
3848
		requestor);
3791
		requestor);
3849
}
3792
}
3850
/** @deprecated As using a depreciated constant */
3793
public void testCamelCaseTypePattern10_CamelCase() throws CoreException {
3851
public void testCamelCaseTypePattern10() throws CoreException {
3852
	workingCopies = new ICompilationUnit[1];
3794
	workingCopies = new ICompilationUnit[1];
3853
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3795
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3854
		"class Null {}\n" + 
3796
		"class Null {}\n" + 
3855
		"class NULL {}\n" + 
3797
		"class NULL {}\n" + 
3856
		"class NullPointerException {}\n" + 
3798
		"class NullPointerException {}\n" + 
3799
		"class Nullpointerexception {}\n" + 
3857
		"class NULLPointerException {}\n" + 
3800
		"class NULLPointerException {}\n" + 
3858
		"class NULLPOINTERException {}\n" + 
3801
		"class NULLPOINTERException {}\n" + 
3859
		"class NULLPOINTEREXCEPTION {}\n"
3802
		"class NULLPOINTEREXCEPTION {}\n"
Lines 3863-3880 Link Here
3863
		"src/Test.java Null [Null]\n" +
3806
		"src/Test.java Null [Null]\n" +
3864
		"src/Test.java NULL [NULL]\n" +
3807
		"src/Test.java NULL [NULL]\n" +
3865
		"src/Test.java NullPointerException [NullPointerException]\n" +
3808
		"src/Test.java NullPointerException [NullPointerException]\n" +
3809
		"src/Test.java Nullpointerexception [Nullpointerexception]\n" +
3866
		"src/Test.java NULLPointerException [NULLPointerException]\n" +
3810
		"src/Test.java NULLPointerException [NULLPointerException]\n" +
3867
		"src/Test.java NULLPOINTERException [NULLPOINTERException]\n" +
3811
		"src/Test.java NULLPOINTERException [NULLPOINTERException]\n" +
3868
		"src/Test.java NULLPOINTEREXCEPTION [NULLPOINTEREXCEPTION]"
3812
		"src/Test.java NULLPOINTEREXCEPTION [NULLPOINTEREXCEPTION]"
3869
	);
3813
	);
3870
}
3814
}
3871
/** @deprecated As using a depreciated constant */
3815
public void testCamelCaseTypePattern11_CamelCase() throws CoreException {
3872
public void testCamelCaseTypePattern11() throws CoreException {
3873
	workingCopies = new ICompilationUnit[1];
3816
	workingCopies = new ICompilationUnit[1];
3874
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3817
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3875
		"class Null {}\n" + 
3818
		"class Null {}\n" + 
3876
		"class NULL {}\n" + 
3819
		"class NULL {}\n" + 
3877
		"class NullPointerException {}\n" + 
3820
		"class NullPointerException {}\n" + 
3821
		"class Nullpointerexception {}\n" + 
3878
		"class NULLPointerException {}\n" + 
3822
		"class NULLPointerException {}\n" + 
3879
		"class NULLPOINTERException {}\n" + 
3823
		"class NULLPOINTERException {}\n" + 
3880
		"class NULLPOINTEREXCEPTION {}\n"
3824
		"class NULLPOINTEREXCEPTION {}\n"
Lines 3884-3917 Link Here
3884
		"src/Test.java Null [Null]\n" +
3828
		"src/Test.java Null [Null]\n" +
3885
		"src/Test.java NULL [NULL]\n" +
3829
		"src/Test.java NULL [NULL]\n" +
3886
		"src/Test.java NullPointerException [NullPointerException]\n" +
3830
		"src/Test.java NullPointerException [NullPointerException]\n" +
3831
		"src/Test.java Nullpointerexception [Nullpointerexception]\n" +
3887
		"src/Test.java NULLPointerException [NULLPointerException]\n" +
3832
		"src/Test.java NULLPointerException [NULLPointerException]\n" +
3888
		"src/Test.java NULLPOINTERException [NULLPOINTERException]\n" +
3833
		"src/Test.java NULLPOINTERException [NULLPOINTERException]\n" +
3889
		"src/Test.java NULLPOINTEREXCEPTION [NULLPOINTEREXCEPTION]"
3834
		"src/Test.java NULLPOINTEREXCEPTION [NULLPOINTEREXCEPTION]"
3890
	);
3835
	);
3891
}
3836
}
3892
/** @deprecated As using a depreciated constant */
3837
public void testCamelCaseTypePattern12_CamelCase() throws CoreException {
3893
public void testCamelCaseTypePattern12() throws CoreException {
3894
	workingCopies = new ICompilationUnit[1];
3838
	workingCopies = new ICompilationUnit[1];
3895
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3839
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3896
		"class Null {}\n" + 
3840
		"class Null {}\n" + 
3897
		"class NULL {}\n" + 
3841
		"class NULL {}\n" + 
3898
		"class NullPointerException {}\n" + 
3842
		"class NullPointerException {}\n" + 
3843
		"class Nullpointerexception {}\n" + 
3899
		"class NULLPointerException {}\n" + 
3844
		"class NULLPointerException {}\n" + 
3900
		"class NULLPOINTERException {}\n" + 
3845
		"class NULLPOINTERException {}\n" + 
3901
		"class NULLPOINTEREXCEPTION {}\n"
3846
		"class NULLPOINTEREXCEPTION {}\n"
3902
	);
3847
	);
3903
	search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
3848
	search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
3904
	assertSearchResults(
3849
	assertSearchResults(
3905
		"src/Test.java Null [Null]"
3850
		"src/Test.java Null [Null]\n" + 
3851
		"src/Test.java NullPointerException [NullPointerException]\n" +
3852
		"src/Test.java Nullpointerexception [Nullpointerexception]"
3906
	);
3853
	);
3907
}
3854
}
3908
/** @deprecated As using a depreciated constant */
3855
public void testCamelCaseTypePattern13_CamelCase() throws CoreException {
3909
public void testCamelCaseTypePattern13() throws CoreException {
3910
	workingCopies = new ICompilationUnit[1];
3856
	workingCopies = new ICompilationUnit[1];
3911
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3857
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3912
		"class Null {}\n" + 
3858
		"class Null {}\n" + 
3913
		"class NULL {}\n" + 
3859
		"class NULL {}\n" + 
3914
		"class NullPointerException {}\n" + 
3860
		"class NullPointerException {}\n" + 
3861
		"class Nullpointerexception {}\n" + 
3915
		"class NULLPointerException {}\n" + 
3862
		"class NULLPointerException {}\n" + 
3916
		"class NULLPOINTERException {}\n" + 
3863
		"class NULLPOINTERException {}\n" + 
3917
		"class NULLPOINTEREXCEPTION {}\n"
3864
		"class NULLPOINTEREXCEPTION {}\n"
Lines 3919-3996 Link Here
3919
	search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE);
3866
	search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE);
3920
	assertSearchResults(
3867
	assertSearchResults(
3921
		"src/Test.java Null [Null]\n" + 
3868
		"src/Test.java Null [Null]\n" + 
3922
		"src/Test.java NULL [NULL]\n" + 
3869
		"src/Test.java NullPointerException [NullPointerException]\n" +
3923
		"src/Test.java NullPointerException [NullPointerException]\n" + 
3870
		"src/Test.java Nullpointerexception [Nullpointerexception]"
3924
		"src/Test.java NULLPointerException [NULLPointerException]\n" + 
3871
	);
3925
		"src/Test.java NULLPOINTERException [NULLPOINTERException]\n" + 
3872
}
3926
		"src/Test.java NULLPOINTEREXCEPTION [NULLPOINTEREXCEPTION]"
3873
// Same tests using SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH instead
3874
public void testCamelCaseTypePattern01_CamelCaseSamePartCount() throws CoreException {
3875
	search("RE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
3876
	assertSearchResults(
3877
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3878
	);
3879
}
3880
public void testCamelCaseTypePattern02_CamelCaseSamePartCount() throws CoreException {
3881
	search("RException", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
3882
	assertSearchResults(
3883
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3884
	);
3885
}
3886
public void testCamelCaseTypePattern03_CamelCaseSamePartCount() throws CoreException {
3887
	search("RuntimeException", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
3888
	assertSearchResults(
3889
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3890
	);
3891
}
3892
public void testCamelCaseTypePattern04_CamelCaseSamePartCount() throws CoreException {
3893
	search("RUNTIMEEXCEPTION", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
3894
	assertSearchResults("");
3895
}
3896
public void testCamelCaseTypePattern05_CamelCaseSamePartCount() throws CoreException {
3897
	search("R*E*", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
3898
	assertSearchResults(
3899
		"src/a3/References.java a3.References [References]\n" + 
3900
		""+ getExternalJCLPathString() + " java.lang.RuntimeException"
3927
	);
3901
	);
3928
}
3902
}
3929
public void testCamelCaseTypePattern14() throws CoreException {
3903
public void testCamelCaseTypePattern06_CamelCaseSamePartCount() throws CoreException {
3904
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
3905
	searchAllTypeNames("CNS", SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH, requestor);
3906
	assertSearchResults(
3907
		"Unexpected all type names",
3908
		"",
3909
		requestor);
3910
}
3911
public void testCamelCaseTypePattern07_CamelCaseSamePartCount() throws CoreException {
3912
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
3913
	searchAllTypeNames("AA", SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH, requestor);
3914
	assertSearchResults(
3915
		"Unexpected all type names",
3916
		"AA\n" + 
3917
		"d8.AA\n" + 
3918
		"p6.AA\n" + 
3919
		"q1.AA",
3920
		requestor);
3921
}
3922
public void testCamelCaseTypePattern08_CamelCaseSamePartCount() throws CoreException {
3923
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
3924
	searchAllTypeNames("aa", SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH, requestor);
3925
	assertSearchResults(
3926
		"Unexpected all type names",
3927
		"AA\n" + 
3928
		"d8.AA\n" + 
3929
		"p6.AA\n" + 
3930
		"q1.AA",
3931
		requestor);
3932
}
3933
public void testCamelCaseTypePattern09_CamelCaseSamePartCount() throws CoreException {
3934
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
3935
	searchAllTypeNames("aa", SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH | SearchPattern.R_PREFIX_MATCH, requestor);
3936
	assertSearchResults(
3937
		"Unexpected all type names",
3938
		"AA\n" + 
3939
		"d8.AA\n" + 
3940
		"p6.AA\n" + 
3941
		"q1.AA",
3942
		requestor);
3943
}
3944
public void testCamelCaseTypePattern10_CamelCaseSamePartCount() throws CoreException {
3930
	workingCopies = new ICompilationUnit[1];
3945
	workingCopies = new ICompilationUnit[1];
3931
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3946
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3932
		"class Null {}\n" + 
3947
		"class Null {}\n" + 
3933
		"class NULL {}\n" + 
3948
		"class NULL {}\n" + 
3934
		"class NullPointerException {}\n" + 
3949
		"class NullPointerException {}\n" + 
3950
		"class Nullpointerexception {}\n" + 
3935
		"class NULLPointerException {}\n" + 
3951
		"class NULLPointerException {}\n" + 
3936
		"class NULLPOINTERException {}\n" + 
3952
		"class NULLPOINTERException {}\n" + 
3937
		"class NULLPOINTEREXCEPTION {}\n"
3953
		"class NULLPOINTEREXCEPTION {}\n"
3938
	);
3954
	);
3939
	search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
3955
	search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
3940
	assertSearchResults(
3956
	assertSearchResults(
3941
		"src/Test.java Null [Null]\n" +
3957
		"src/Test.java Null [Null]\n" +
3942
		"src/Test.java NULL [NULL]"
3958
		"src/Test.java Nullpointerexception [Nullpointerexception]"
3943
	);
3959
	);
3944
}
3960
}
3945
public void testCamelCaseTypePattern15() throws CoreException {
3961
public void testCamelCaseTypePattern11_CamelCaseSamePartCount() throws CoreException {
3946
	workingCopies = new ICompilationUnit[1];
3962
	workingCopies = new ICompilationUnit[1];
3947
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3963
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3948
		"class Null {}\n" + 
3964
		"class Null {}\n" + 
3949
		"class NULL {}\n" + 
3965
		"class NULL {}\n" + 
3950
		"class NullPointerException {}\n" + 
3966
		"class NullPointerException {}\n" + 
3967
		"class Nullpointerexception {}\n" + 
3951
		"class NULLPointerException {}\n" + 
3968
		"class NULLPointerException {}\n" + 
3952
		"class NULLPOINTERException {}\n" + 
3969
		"class NULLPOINTERException {}\n" + 
3953
		"class NULLPOINTEREXCEPTION {}\n"
3970
		"class NULLPOINTEREXCEPTION {}\n"
3954
	);
3971
	);
3955
	search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH);
3972
	search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH | SearchPattern.R_PREFIX_MATCH);
3956
	assertSearchResults(
3973
	assertSearchResults(
3957
		"src/Test.java Null [Null]\n" +
3974
		"src/Test.java Null [Null]\n" +
3958
		"src/Test.java NULL [NULL]\n" +
3975
		"src/Test.java Nullpointerexception [Nullpointerexception]"
3959
		"src/Test.java NullPointerException [NullPointerException]\n" +
3960
		"src/Test.java NULLPointerException [NULLPointerException]\n" +
3961
		"src/Test.java NULLPOINTERException [NULLPOINTERException]\n" +
3962
		"src/Test.java NULLPOINTEREXCEPTION [NULLPOINTEREXCEPTION]"
3963
	);
3976
	);
3964
}
3977
}
3965
public void testCamelCaseTypePattern16() throws CoreException {
3978
public void testCamelCaseTypePattern12_CamelCaseSamePartCount() throws CoreException {
3966
	workingCopies = new ICompilationUnit[1];
3979
	workingCopies = new ICompilationUnit[1];
3967
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3980
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3968
		"class Null {}\n" + 
3981
		"class Null {}\n" + 
3969
		"class NULL {}\n" + 
3982
		"class NULL {}\n" + 
3970
		"class NullPointerException {}\n" + 
3983
		"class NullPointerException {}\n" + 
3984
		"class Nullpointerexception {}\n" + 
3971
		"class NULLPointerException {}\n" + 
3985
		"class NULLPointerException {}\n" + 
3972
		"class NULLPOINTERException {}\n" + 
3986
		"class NULLPOINTERException {}\n" + 
3973
		"class NULLPOINTEREXCEPTION {}\n"
3987
		"class NULLPOINTEREXCEPTION {}\n"
3974
	);
3988
	);
3975
	search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
3989
	search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH | SearchPattern.R_CASE_SENSITIVE);
3976
	assertSearchResults(
3990
	assertSearchResults(
3977
		"src/Test.java Null [Null]"
3991
		"src/Test.java Null [Null]\n" +
3992
		"src/Test.java Nullpointerexception [Nullpointerexception]"
3978
	);
3993
	);
3979
}
3994
}
3980
public void testCamelCaseTypePattern17() throws CoreException {
3995
public void testCamelCaseTypePattern13_CamelCaseSamePartCount() throws CoreException {
3981
	workingCopies = new ICompilationUnit[1];
3996
	workingCopies = new ICompilationUnit[1];
3982
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3997
	workingCopies[0] = getWorkingCopy("/JavaSearch/src/Test.java",
3983
		"class Null {}\n" + 
3998
		"class Null {}\n" + 
3984
		"class NULL {}\n" + 
3999
		"class NULL {}\n" + 
3985
		"class NullPointerException {}\n" + 
4000
		"class NullPointerException {}\n" + 
4001
		"class Nullpointerexception {}\n" + 
3986
		"class NULLPointerException {}\n" + 
4002
		"class NULLPointerException {}\n" + 
3987
		"class NULLPOINTERException {}\n" + 
4003
		"class NULLPOINTERException {}\n" + 
3988
		"class NULLPOINTEREXCEPTION {}\n"
4004
		"class NULLPOINTEREXCEPTION {}\n"
3989
	);
4005
	);
3990
	search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE);
4006
	search("Null", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE);
3991
	assertSearchResults(
4007
	assertSearchResults(
3992
		"src/Test.java Null [Null]\n" +
4008
		"src/Test.java Null [Null]\n" +
3993
		"src/Test.java NullPointerException [NullPointerException]"
4009
		"src/Test.java Nullpointerexception [Nullpointerexception]"
3994
	);
4010
	);
3995
}
4011
}
3996
4012
(-)src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java (-458 / +597 lines)
Lines 4719-4725 Link Here
4719
		"interface IDocumentExtension315 {}\n"
4719
		"interface IDocumentExtension315 {}\n"
4720
	);
4720
	);
4721
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4721
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4722
	int validatedRule = SearchPattern.validateMatchRule("IDE3", SearchPattern.R_CAMEL_CASE_MATCH);
4722
	int validatedRule = SearchPattern.validateMatchRule("IDE3", SearchPattern.R_CAMELCASE_MATCH);
4723
	searchAllTypeNames("IDE3", validatedRule, requestor);
4723
	searchAllTypeNames("IDE3", validatedRule, requestor);
4724
	assertSearchResults(
4724
	assertSearchResults(
4725
		"IDocumentExtension135\n" + 
4725
		"IDocumentExtension135\n" + 
Lines 4740-4746 Link Here
4740
		"interface IDocumentProviderExtension54321 {}\n"
4740
		"interface IDocumentProviderExtension54321 {}\n"
4741
	);
4741
	);
4742
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4742
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4743
	int validatedRule = SearchPattern.validateMatchRule("IDPE3", SearchPattern.R_CAMEL_CASE_MATCH);
4743
	int validatedRule = SearchPattern.validateMatchRule("IDPE3", SearchPattern.R_CAMELCASE_MATCH);
4744
	searchAllTypeNames("IDPE3", validatedRule, requestor);
4744
	searchAllTypeNames("IDPE3", validatedRule, requestor);
4745
	assertSearchResults(
4745
	assertSearchResults(
4746
		"IDocumentProviderExtension12345\n" + 
4746
		"IDocumentProviderExtension12345\n" + 
Lines 4757-4763 Link Here
4757
		"interface IPerspectiveListener3 {}\n"
4757
		"interface IPerspectiveListener3 {}\n"
4758
	);
4758
	);
4759
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4759
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4760
	int validatedRule = SearchPattern.validateMatchRule("IPL3", SearchPattern.R_CAMEL_CASE_MATCH);
4760
	int validatedRule = SearchPattern.validateMatchRule("IPL3", SearchPattern.R_CAMELCASE_MATCH);
4761
	searchAllTypeNames("IPL3", validatedRule, requestor);
4761
	searchAllTypeNames("IPL3", validatedRule, requestor);
4762
	assertSearchResults(
4762
	assertSearchResults(
4763
		"IPerspectiveListener3",
4763
		"IPerspectiveListener3",
Lines 4771-4777 Link Here
4771
		"interface IPropertySource2 {}\n"
4771
		"interface IPropertySource2 {}\n"
4772
	);
4772
	);
4773
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4773
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4774
	int validatedRule = SearchPattern.validateMatchRule("IPS2", SearchPattern.R_CAMEL_CASE_MATCH);
4774
	int validatedRule = SearchPattern.validateMatchRule("IPS2", SearchPattern.R_CAMELCASE_MATCH);
4775
	searchAllTypeNames("IPS2", validatedRule, requestor);
4775
	searchAllTypeNames("IPS2", validatedRule, requestor);
4776
	assertSearchResults(
4776
	assertSearchResults(
4777
		"IPropertySource2",
4777
		"IPropertySource2",
Lines 4788-4794 Link Here
4788
		"interface IWorkbenchWindowPulldownDelegate4 {}\n"
4788
		"interface IWorkbenchWindowPulldownDelegate4 {}\n"
4789
	);
4789
	);
4790
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4790
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4791
	int validatedRule = SearchPattern.validateMatchRule("IWWPD2", SearchPattern.R_CAMEL_CASE_MATCH);
4791
	int validatedRule = SearchPattern.validateMatchRule("IWWPD2", SearchPattern.R_CAMELCASE_MATCH);
4792
	searchAllTypeNames("IWWPD2", validatedRule, requestor);
4792
	searchAllTypeNames("IWWPD2", validatedRule, requestor);
4793
	assertSearchResults(
4793
	assertSearchResults(
4794
		"IWorkbenchWindowPulldownDelegate2",
4794
		"IWorkbenchWindowPulldownDelegate2",
Lines 4804-4810 Link Here
4804
		"class UTFDocScannerSupport {}\n"
4804
		"class UTFDocScannerSupport {}\n"
4805
	);
4805
	);
4806
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4806
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4807
	int validatedRule = SearchPattern.validateMatchRule("UTF16DSS", SearchPattern.R_CAMEL_CASE_MATCH);
4807
	int validatedRule = SearchPattern.validateMatchRule("UTF16DSS", SearchPattern.R_CAMELCASE_MATCH);
4808
	searchAllTypeNames("UTF16DSS", validatedRule, requestor);
4808
	searchAllTypeNames("UTF16DSS", validatedRule, requestor);
4809
	assertSearchResults(
4809
	assertSearchResults(
4810
		"UTF16DocumentScannerSupport",
4810
		"UTF16DocumentScannerSupport",
Lines 4820-4826 Link Here
4820
		"class UTFDocScannerSupport {}\n"
4820
		"class UTFDocScannerSupport {}\n"
4821
	);
4821
	);
4822
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4822
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4823
	int validatedRule = SearchPattern.validateMatchRule("UTF1DSS", SearchPattern.R_CAMEL_CASE_MATCH);
4823
	int validatedRule = SearchPattern.validateMatchRule("UTF1DSS", SearchPattern.R_CAMELCASE_MATCH);
4824
	searchAllTypeNames("UTF1DSS", validatedRule, requestor);
4824
	searchAllTypeNames("UTF1DSS", validatedRule, requestor);
4825
	assertSearchResults(
4825
	assertSearchResults(
4826
		"UTF16DocumentScannerSupport\n" + 
4826
		"UTF16DocumentScannerSupport\n" + 
Lines 4837-4843 Link Here
4837
		"class UTFDocScannerSupport {}\n"
4837
		"class UTFDocScannerSupport {}\n"
4838
	);
4838
	);
4839
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4839
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4840
	int validatedRule = SearchPattern.validateMatchRule("UTF6DSS", SearchPattern.R_CAMEL_CASE_MATCH);
4840
	int validatedRule = SearchPattern.validateMatchRule("UTF6DSS", SearchPattern.R_CAMELCASE_MATCH);
4841
	searchAllTypeNames("UTF6DSS", validatedRule, requestor);
4841
	searchAllTypeNames("UTF6DSS", validatedRule, requestor);
4842
	assertSearchResults(
4842
	assertSearchResults(
4843
		"UTF16DocumentScannerSupport\n" + 
4843
		"UTF16DocumentScannerSupport\n" + 
Lines 4854-4860 Link Here
4854
		"class UTFDocScannerSupport {}\n"
4854
		"class UTFDocScannerSupport {}\n"
4855
	);
4855
	);
4856
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4856
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
4857
	int validatedRule = SearchPattern.validateMatchRule("UTFDSS", SearchPattern.R_CAMEL_CASE_MATCH);
4857
	int validatedRule = SearchPattern.validateMatchRule("UTFDSS", SearchPattern.R_CAMELCASE_MATCH);
4858
	searchAllTypeNames("UTFDSS", validatedRule, requestor);
4858
	searchAllTypeNames("UTFDSS", validatedRule, requestor);
4859
	assertSearchResults(
4859
	assertSearchResults(
4860
		"UTF16DocumentScannerSupport\n" + 
4860
		"UTF16DocumentScannerSupport\n" + 
Lines 4893-4899 Link Here
4893
		"class AxxAyy {}\n"
4893
		"class AxxAyy {}\n"
4894
	);
4894
	);
4895
}
4895
}
4896
/** @deprecated As using a depreciated constant */
4897
public void testBug110060_TypePattern01() throws CoreException {
4896
public void testBug110060_TypePattern01() throws CoreException {
4898
	setUpBug110060_TypePattern();
4897
	setUpBug110060_TypePattern();
4899
	search("AA", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
4898
	search("AA", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 4906-4914 Link Here
4906
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
4905
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
4907
	);
4906
	);
4908
}
4907
}
4909
public void testBug110060_TypePattern01new() throws CoreException {
4908
public void testBug110060_TypePattern01_SamePartCount() throws CoreException {
4910
	setUpBug110060_TypePattern();
4909
	setUpBug110060_TypePattern();
4911
	search("AA", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH);
4910
	search("AA", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
4912
	assertSearchResults(
4911
	assertSearchResults(
4913
		"src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + 
4912
		"src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + 
4914
		"src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH\n" + 
4913
		"src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH\n" + 
Lines 4916-4922 Link Here
4916
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
4915
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
4917
	);
4916
	);
4918
}
4917
}
4919
/** @deprecated As using a depreciated constant */
4920
public void testBug110060_TypePattern02() throws CoreException {
4918
public void testBug110060_TypePattern02() throws CoreException {
4921
	setUpBug110060_TypePattern();
4919
	setUpBug110060_TypePattern();
4922
	search("AA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
4920
	search("AA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 4935-4943 Link Here
4935
		"src/b110060/Test.java b110060.AxxAyy [AxxAyy] EXACT_MATCH"
4933
		"src/b110060/Test.java b110060.AxxAyy [AxxAyy] EXACT_MATCH"
4936
	);
4934
	);
4937
}
4935
}
4938
public void testBug110060_TypePattern02new() throws CoreException {
4936
public void testBug110060_TypePattern02_SamePartCount() throws CoreException {
4939
	setUpBug110060_TypePattern();
4937
	setUpBug110060_TypePattern();
4940
	search("AA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
4938
	search("AA", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
4941
	assertSearchResults(
4939
	assertSearchResults(
4942
		"src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + 
4940
		"src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + 
4943
		"src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH\n" + 
4941
		"src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH\n" + 
Lines 4949-4955 Link Here
4949
		"src/b110060/Test.java b110060.AxxAyy [AxxAyy] EXACT_MATCH"
4947
		"src/b110060/Test.java b110060.AxxAyy [AxxAyy] EXACT_MATCH"
4950
	);
4948
	);
4951
}
4949
}
4952
/** @deprecated As using a depreciated constant */
4953
public void testBug110060_TypePattern03() throws CoreException {
4950
public void testBug110060_TypePattern03() throws CoreException {
4954
	setUpBug110060_TypePattern();
4951
	setUpBug110060_TypePattern();
4955
	search("AAx", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
4952
	search("AAx", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 4957-4970 Link Here
4957
		"src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH"
4954
		"src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH"
4958
	);
4955
	);
4959
}
4956
}
4960
public void testBug110060_TypePattern03new() throws CoreException {
4957
public void testBug110060_TypePattern03_SamePartCount() throws CoreException {
4961
	setUpBug110060_TypePattern();
4958
	setUpBug110060_TypePattern();
4962
	search("AAx", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH);
4959
	search("AAx", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
4963
	assertSearchResults(
4960
	assertSearchResults(
4964
		"" // no result as camel case does not allow prefix match
4961
		"src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH"
4965
	);
4962
	);
4966
}
4963
}
4967
/** @deprecated As using a depreciated constant */
4968
public void testBug110060_TypePattern04() throws CoreException {
4964
public void testBug110060_TypePattern04() throws CoreException {
4969
	setUpBug110060_TypePattern();
4965
	setUpBug110060_TypePattern();
4970
	search("Axx", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
4966
	search("Axx", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 4972-4985 Link Here
4972
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
4968
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
4973
	);
4969
	);
4974
}
4970
}
4975
public void testBug110060_TypePattern04new() throws CoreException {
4971
public void testBug110060_TypePattern04_SamePartCount() throws CoreException {
4976
	setUpBug110060_TypePattern();
4972
	setUpBug110060_TypePattern();
4977
	search("Axx", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH);
4973
	search("Axx", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
4978
	assertSearchResults(
4974
	assertSearchResults("");
4979
		"" // no result as camel case does not allow prefix match
4980
	);
4981
}
4975
}
4982
/** @deprecated As using a depreciated constant */
4983
public void testBug110060_TypePattern05() throws CoreException {
4976
public void testBug110060_TypePattern05() throws CoreException {
4984
	setUpBug110060_TypePattern();
4977
	setUpBug110060_TypePattern();
4985
	search("Ax", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
4978
	search("Ax", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 4988-5004 Link Here
4988
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
4981
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
4989
	);
4982
	);
4990
}
4983
}
4991
public void testBug110060_TypePattern05new() throws CoreException {
4984
public void testBug110060_TypePattern05_SamePartCount() throws CoreException {
4992
	setUpBug110060_TypePattern();
4985
	setUpBug110060_TypePattern();
4993
	search("Ax", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
4986
	search("Ax", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
4994
	assertSearchResults(
4987
	assertSearchResults("");
4995
		"" // no result as camel case does not allow prefix match
4996
	);
4997
}
4988
}
4998
/** @deprecated As using a depreciated constant */
4999
public void testBug110060_TypePattern06() throws CoreException {
4989
public void testBug110060_TypePattern06() throws CoreException {
5000
	setUpBug110060_TypePattern();
4990
	setUpBug110060_TypePattern();
5001
	search("A*A*", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
4991
	search("A*A*", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
4992
	// Invalid camel case pattern => replace the camel case flag with pattern match one (case insensitive)
5002
	assertSearchResults(
4993
	assertSearchResults(
5003
		"src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH\n" + 
4994
		"src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH\n" + 
5004
		"src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + 
4995
		"src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + 
Lines 5008-5016 Link Here
5008
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
4999
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
5009
	);
5000
	);
5010
}
5001
}
5011
public void testBug110060_TypePattern06new() throws CoreException {
5002
public void testBug110060_TypePattern06_SamePartCount() throws CoreException {
5012
	setUpBug110060_TypePattern();
5003
	setUpBug110060_TypePattern();
5013
	search("A*A*", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5004
	search("A*A*", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5005
	// Invalid camel case pattern => replace the camel case flag with pattern match one (case insensitive)
5014
	assertSearchResults(
5006
	assertSearchResults(
5015
		"src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH\n" + 
5007
		"src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH\n" + 
5016
		"src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + 
5008
		"src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + 
Lines 5020-5077 Link Here
5020
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
5012
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
5021
	);
5013
	);
5022
}
5014
}
5023
/** @deprecated As using a depreciated constant */
5024
public void testBug110060_TypePattern07() throws CoreException {
5015
public void testBug110060_TypePattern07() throws CoreException {
5025
	setUpBug110060_TypePattern();
5016
	setUpBug110060_TypePattern();
5026
	search("aa", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
5017
	search("aaa", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
5018
	// Invalid camel case pattern => replace the camel case flag by prefix match one (case insensitive)
5027
	assertSearchResults(
5019
	assertSearchResults(
5028
		"" // no result because it's an invalid camel case pattern which is replaced with 
5020
		"src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH\n" + 
5029
			// prefix case sensitive match bu SearchPatter.validateMatchRule(...) (old behavior)
5021
		"src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + 
5022
		"src/b110060/Test.java b110060.Test.a3 [AaAaAa] EXACT_MATCH"
5030
	);
5023
	);
5031
}
5024
}
5032
public void testBug110060_TypePattern07new() throws CoreException {
5025
public void testBug110060_TypePattern07_SamePartCount() throws CoreException {
5033
	setUpBug110060_TypePattern();
5026
	setUpBug110060_TypePattern();
5034
	search("aa", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5027
	search("aaa", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5035
	// Not a valid camel case pattern => changed to prefix
5028
	// Invalid camel case pattern => replace the camel case flag by prefix match one (case insensitive)
5036
	assertSearchResults(
5029
	assertSearchResults(
5037
		"src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH\n" + 
5030
		"src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH\n" + 
5038
		"src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + 
5031
		"src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + 
5039
		"src/b110060/Test.java b110060.Test.a3 [AaAaAa] EXACT_MATCH\n" + 
5032
		"src/b110060/Test.java b110060.Test.a3 [AaAaAa] EXACT_MATCH"
5040
		"src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH"
5041
	);
5033
	);
5042
}
5034
}
5043
public void testBug110060_TypePattern08() throws CoreException {
5035
public void testBug110060_TypePattern08() throws CoreException {
5044
	setUpBug110060_TypePattern();
5036
	setUpBug110060_TypePattern();
5045
	search("aa", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH);
5037
	search("Aaa", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
5046
	assertSearchResults(
5038
	assertSearchResults(
5047
		"src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH\n" + 
5039
		"src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH\n" + 
5048
		"src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + 
5040
		"src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + 
5049
		"src/b110060/Test.java b110060.Test.a3 [AaAaAa] EXACT_MATCH\n" + 
5041
		"src/b110060/Test.java b110060.Test.a3 [AaAaAa] EXACT_MATCH"
5050
		"src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH"
5042
	);
5043
}
5044
public void testBug110060_TypePattern08_SamePartCount() throws CoreException {
5045
	setUpBug110060_TypePattern();
5046
	search("Aaa", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5047
	assertSearchResults(
5048
		"src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH"
5051
	);
5049
	);
5052
}
5050
}
5053
public void testBug110060_TypePattern09() throws CoreException {
5051
public void testBug110060_TypePattern09() throws CoreException {
5054
	setUpBug110060_TypePattern();
5052
	setUpBug110060_TypePattern();
5055
	search("AA", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
5053
	search("Aaa", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
5056
	assertSearchResults(
5054
	assertSearchResults(
5057
		"src/b110060/Test.java b110060.Test.a2 [AAa] EXACT_MATCH\n" + 
5055
		"src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH"
5058
		"src/b110060/Test.java b110060.Test.a4 [AAxx] EXACT_MATCH\n" + 
5056
	);
5059
		"src/b110060/Test.java b110060.Test.a5 [AxA] EXACT_MATCH\n" + 
5057
}
5060
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
5058
public void testBug110060_TypePattern09_SamePartCount() throws CoreException {
5059
	setUpBug110060_TypePattern();
5060
	search("Aaa", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH | SearchPattern.R_CASE_SENSITIVE);
5061
	assertSearchResults(
5062
		"src/b110060/Test.java b110060.Test.a1 [Aaa] EXACT_MATCH"
5061
	);
5063
	);
5062
}
5064
}
5063
/** @deprecated As using a depreciated constant */
5064
public void testBug110060_TypePattern10() throws CoreException {
5065
public void testBug110060_TypePattern10() throws CoreException {
5065
	setUpBug110060_TypePattern();
5066
	setUpBug110060_TypePattern();
5066
	search("AxAx", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
5067
	search("AxAx", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
5067
	assertSearchResults("");
5068
	assertSearchResults("");
5068
}
5069
}
5069
public void testBug110060_TypePattern10new() throws CoreException {
5070
public void testBug110060_TypePattern10_SamePartCount() throws CoreException {
5070
	setUpBug110060_TypePattern();
5071
	setUpBug110060_TypePattern();
5071
	search("AxAx", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5072
	search("AxAx", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5072
	assertSearchResults("");
5073
	assertSearchResults("");
5073
}
5074
}
5074
/** @deprecated As using a depreciated constant */
5075
public void testBug110060_TypePattern11() throws CoreException {
5075
public void testBug110060_TypePattern11() throws CoreException {
5076
	setUpBug110060_TypePattern();
5076
	setUpBug110060_TypePattern();
5077
	search("AxxA", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
5077
	search("AxxA", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 5079-5092 Link Here
5079
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
5079
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
5080
	);
5080
	);
5081
}
5081
}
5082
public void testBug110060_TypePattern11new() throws CoreException {
5082
public void testBug110060_TypePattern11_SamePartCount() throws CoreException {
5083
	setUpBug110060_TypePattern();
5083
	setUpBug110060_TypePattern();
5084
	search("AxxA", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5084
	search("AxxA", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5085
	assertSearchResults(
5085
	assertSearchResults(
5086
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
5086
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
5087
	);
5087
	);
5088
}
5088
}
5089
/** @deprecated As using a depreciated constant */
5090
public void testBug110060_TypePattern12() throws CoreException {
5089
public void testBug110060_TypePattern12() throws CoreException {
5091
	setUpBug110060_TypePattern();
5090
	setUpBug110060_TypePattern();
5092
	search("AxXA", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
5091
	search("AxXA", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 5094-5113 Link Here
5094
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
5093
		"src/b110060/Test.java b110060.Test.a6 [AxxAyy] EXACT_MATCH"
5095
	);
5094
	);
5096
}
5095
}
5097
public void testBug110060_TypePattern12new() throws CoreException {
5096
public void testBug110060_TypePattern12_SamePartCount() throws CoreException {
5098
	setUpBug110060_TypePattern();
5097
	setUpBug110060_TypePattern();
5099
	search("AxXA", TYPE, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5098
	search("AxXA", TYPE, REFERENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5100
	assertSearchResults("");
5099
	assertSearchResults("");
5101
}
5100
}
5102
5101
5103
// Search all type names requests
5102
// Search all type names requests
5104
/** @deprecated As using a depreciated constant */
5105
public void testBug110060_AllTypeNames01() throws CoreException {
5103
public void testBug110060_AllTypeNames01() throws CoreException {
5106
	setUpBug110060_TypePattern();
5104
	setUpBug110060_TypePattern();
5107
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5105
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5108
	searchAllTypeNames("AA", SearchPattern.R_CAMELCASE_MATCH, requestor);
5106
	searchAllTypeNames("AA", SearchPattern.R_CAMELCASE_MATCH, requestor);
5109
	assertSearchResults(
5107
	assertSearchResults("Unexpected all type names",
5110
		"Unexpected all type names",
5111
		"b110060.AAa\n" + 
5108
		"b110060.AAa\n" + 
5112
		"b110060.AAxx\n" + 
5109
		"b110060.AAxx\n" + 
5113
		"b110060.AaAaAa\n" + 
5110
		"b110060.AaAaAa\n" + 
Lines 5116-5127 Link Here
5116
		"b110060.AxxAyy",
5113
		"b110060.AxxAyy",
5117
		requestor);
5114
		requestor);
5118
}
5115
}
5119
public void testBug110060_AllTypeNames01new() throws CoreException {
5116
public void testBug110060_AllTypeNames01_SamePartCount() throws CoreException {
5120
	setUpBug110060_TypePattern();
5117
	setUpBug110060_TypePattern();
5121
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5118
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5122
	searchAllTypeNames("AA", SearchPattern.R_CAMEL_CASE_MATCH, requestor);
5119
	searchAllTypeNames("AA", SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH, requestor);
5123
	assertSearchResults(
5120
	assertSearchResults("Unexpected all type names",
5124
		"Unexpected all type names",
5125
		"b110060.AAa\n" + 
5121
		"b110060.AAa\n" + 
5126
		"b110060.AAxx\n" + 
5122
		"b110060.AAxx\n" + 
5127
		"b110060.AxA\n" + 
5123
		"b110060.AxA\n" + 
Lines 5131-5170 Link Here
5131
public void testBug110060_AllTypeNames02() throws CoreException {
5127
public void testBug110060_AllTypeNames02() throws CoreException {
5132
	setUpBug110060_TypePattern();
5128
	setUpBug110060_TypePattern();
5133
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5129
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5134
	searchAllTypeNames("AA", SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH, requestor);
5130
	searchAllTypeNames("aaa", SearchPattern.R_CAMELCASE_MATCH, requestor);
5135
	assertSearchResults(
5131
	// Invalid camel case pattern => replace the camel case flag with prefix match one (case insensitive)
5136
		"Unexpected all type names",
5132
	assertSearchResults("Unexpected all type names",
5137
		"b110060.AAa\n" + 
5133
		"b110060.AAa\n" + 
5138
		"b110060.AAxx\n" + 
5139
		"b110060.AaAaAa\n" + 
5134
		"b110060.AaAaAa\n" + 
5140
		"b110060.Aaa\n" + 
5135
		"b110060.Aaa",
5141
		"b110060.AxA\n" + 
5136
		requestor);
5142
		"b110060.AxxAyy",
5137
}
5138
public void testBug110060_AllTypeNames02_SamePartCount() throws CoreException {
5139
	setUpBug110060_TypePattern();
5140
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5141
	searchAllTypeNames("aaa", SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH, requestor);
5142
	// Invalid camel case pattern => replace the camel case flag with prefix match one (case insensitive)
5143
	assertSearchResults("Unexpected all type names",
5144
		"b110060.AAa\n" + 
5145
		"b110060.AaAaAa\n" + 
5146
		"b110060.Aaa",
5143
		requestor);
5147
		requestor);
5144
}
5148
}
5145
public void testBug110060_AllTypeNames03() throws CoreException {
5149
public void testBug110060_AllTypeNames03() throws CoreException {
5146
	setUpBug110060_TypePattern();
5150
	setUpBug110060_TypePattern();
5147
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5151
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5148
	searchAllTypeNames("AAA", SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor);
5152
	searchAllTypeNames("AAa", SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor);
5149
	assertSearchResults(
5153
	assertSearchResults("Unexpected all type names",
5150
		"Unexpected all type names",
5154
		"b110060.AAa\n" + 
5151
		"b110060.AaAaAa",
5155
		"b110060.AaAaAa",
5152
		requestor);
5156
		requestor);
5153
}
5157
}
5154
public void testBug110060_AllTypeNames04() throws CoreException {
5158
public void testBug110060_AllTypeNames03_SamePartCount() throws CoreException {
5155
	setUpBug110060_TypePattern();
5159
	setUpBug110060_TypePattern();
5156
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5160
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5157
	searchAllTypeNames("AA", SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor);
5161
	searchAllTypeNames("AAa", SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor);
5158
	assertSearchResults(
5162
	assertSearchResults("Unexpected all type names",
5159
		"Unexpected all type names",
5163
		"b110060.AAa",
5160
		"b110060.AAa\n" + 
5161
		"b110060.AAxx\n" + 
5162
		"b110060.AaAaAa\n" + 
5163
		"b110060.AxA\n" + 
5164
		"b110060.AxxAyy",
5165
		requestor);
5164
		requestor);
5166
}
5165
}
5167
public void testBug110060_AllTypeNames05() throws CoreException {
5166
public void testBug110060_AllTypeNames04() throws CoreException {
5168
	setUpBug110060_TypePattern();
5167
	setUpBug110060_TypePattern();
5169
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5168
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5170
	searchAllTypeNames("AA", SearchPattern.R_PREFIX_MATCH, requestor);
5169
	searchAllTypeNames("AA", SearchPattern.R_PREFIX_MATCH, requestor);
Lines 5176-5182 Link Here
5176
		"b110060.Aaa",
5175
		"b110060.Aaa",
5177
		requestor);
5176
		requestor);
5178
}
5177
}
5179
public void testBug110060_AllTypeNames06() throws CoreException {
5178
public void testBug110060_AllTypeNames05() throws CoreException {
5180
	setUpBug110060_TypePattern();
5179
	setUpBug110060_TypePattern();
5181
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5180
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5182
	searchAllTypeNames("AAA", SearchPattern.R_CASE_SENSITIVE, requestor);
5181
	searchAllTypeNames("AAA", SearchPattern.R_CASE_SENSITIVE, requestor);
Lines 5185-5191 Link Here
5185
		"",
5184
		"",
5186
		requestor);
5185
		requestor);
5187
}
5186
}
5188
public void testBug110060_AllTypeNames07() throws CoreException {
5187
public void testBug110060_AllTypeNames06() throws CoreException {
5189
	setUpBug110060_TypePattern();
5188
	setUpBug110060_TypePattern();
5190
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5189
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5191
	searchAllTypeNames("AA", SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor);
5190
	searchAllTypeNames("AA", SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor);
Lines 5195-5247 Link Here
5195
		"b110060.AAxx",
5194
		"b110060.AAxx",
5196
		requestor);
5195
		requestor);
5197
}
5196
}
5198
/** @deprecated As using a depreciated constant */
5197
public void testBug110060_AllTypeNames07() throws CoreException {
5199
public void testBug110060_AllTypeNames08() throws CoreException {
5200
	setUpBug110060_TypePattern();
5198
	setUpBug110060_TypePattern();
5201
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5199
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5202
	searchAllTypeNames("aa", SearchPattern.R_CAMELCASE_MATCH, requestor);
5200
	searchAllTypeNames("aaa", SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH, requestor);
5201
	// Invalid camel case pattern => replace the camel case flag with prefix match one (case insensitive)
5203
	assertSearchResults(
5202
	assertSearchResults(
5204
		"Unexpected all type names",
5203
		"Unexpected all type names",
5205
		"b110060.AAa\n" + 
5204
		"b110060.AAa\n" + 
5206
		"b110060.AAxx\n" + 
5207
		"b110060.AaAaAa\n" + 
5205
		"b110060.AaAaAa\n" + 
5208
		"b110060.Aaa",
5206
		"b110060.Aaa",
5209
		requestor);
5207
		requestor);
5210
}
5208
}
5211
public void testBug110060_AllTypeNames08new() throws CoreException {
5209
public void testBug110060_AllTypeNames07_SamePartCount() throws CoreException {
5212
	setUpBug110060_TypePattern();
5210
	setUpBug110060_TypePattern();
5213
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5211
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5214
	searchAllTypeNames("aa", SearchPattern.R_CAMEL_CASE_MATCH, requestor);
5212
	searchAllTypeNames("aaa", SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH | SearchPattern.R_PREFIX_MATCH, requestor);
5213
	// Invalid camel case pattern => replace the camel case flag with prefix match one (case insensitive)
5215
	assertSearchResults(
5214
	assertSearchResults(
5216
		"Unexpected all type names",
5215
		"Unexpected all type names",
5217
		"", // no match as pattern is not a valid camel case
5216
		"b110060.AAa\n" + 
5217
		"b110060.AaAaAa\n" + 
5218
		"b110060.Aaa",
5218
		requestor);
5219
		requestor);
5219
}
5220
}
5220
public void testBug110060_AllTypeNames09() throws CoreException {
5221
public void testBug110060_AllTypeNames08() throws CoreException {
5221
	setUpBug110060_TypePattern();
5222
	setUpBug110060_TypePattern();
5222
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5223
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5223
	searchAllTypeNames("aa", SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH, requestor);
5224
	searchAllTypeNames("aaa", SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor);
5225
	// Invalid camel case pattern => replace the camel case flag with prefix match one keeping case sensitive
5224
	assertSearchResults(
5226
	assertSearchResults(
5225
		"Unexpected all type names",
5227
		"Unexpected all type names",
5226
		"b110060.AAa\n" + 
5228
		"",
5227
		"b110060.AAxx\n" + 
5229
		requestor);
5228
		"b110060.AaAaAa\n" + 
5230
}
5229
		"b110060.Aaa",
5231
public void testBug110060_AllTypeNames08_SamePartCount() throws CoreException {
5232
	setUpBug110060_TypePattern();
5233
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5234
	searchAllTypeNames("aaa", SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor);
5235
	// Invalid camel case pattern => replace the camel case flag with prefix match one keeping case sensitive
5236
	assertSearchResults(
5237
		"Unexpected all type names",
5238
		"",
5230
		requestor);
5239
		requestor);
5231
}
5240
}
5232
public void testBug110060_AllTypeNames10() throws CoreException {
5241
public void testBug110060_AllTypeNames09() throws CoreException {
5233
	setUpBug110060_TypePattern();
5242
	setUpBug110060_TypePattern();
5234
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5243
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5235
	searchAllTypeNames("aa", SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor);
5244
	searchAllTypeNames("aaa", SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor);
5245
	// Invalid camel case pattern => reset the camel case flag keeping prefix match and case sensitive ones
5236
	assertSearchResults(
5246
	assertSearchResults(
5237
		"Unexpected all type names",
5247
		"Unexpected all type names",
5238
		"", // no match as pattern is not a valid camel case
5248
		"",
5239
		requestor);
5249
		requestor);
5240
}
5250
}
5241
public void testBug110060_AllTypeNames11() throws CoreException {
5251
public void testBug110060_AllTypeNames09_SamePartCount() throws CoreException {
5242
	setUpBug110060_TypePattern();
5252
	setUpBug110060_TypePattern();
5243
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5253
	TypeNameRequestor requestor =  new SearchTests.SearchTypeNameRequestor();
5244
	searchAllTypeNames("aa", SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor);
5254
	searchAllTypeNames("aaa", SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE, requestor);
5255
	// Invalid camel case pattern => reset the camel case flag keeping prefix match and case sensitive ones
5245
	assertSearchResults(
5256
	assertSearchResults(
5246
		"Unexpected all type names",
5257
		"Unexpected all type names",
5247
		"",
5258
		"",
Lines 5281-5290 Link Here
5281
// Constructor search
5292
// Constructor search
5282
private void setUpBug110060_ConstructorPattern() throws CoreException {
5293
private void setUpBug110060_ConstructorPattern() throws CoreException {
5283
	workingCopies = new ICompilationUnit[5];
5294
	workingCopies = new ICompilationUnit[5];
5284
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b110060/AA.java",
5295
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b110060/AAAA.java",
5285
		"package b110060;\n" +
5296
		"package b110060;\n" +
5286
		"public class AA {\n" +
5297
		"public class AAAA {\n" +
5287
		"	AA() {}\n" +
5298
		"	AAAA() {}\n" +
5288
		"}\n"
5299
		"}\n"
5289
	);
5300
	);
5290
	workingCopies[1] = getWorkingCopy("/JavaSearchBugs/src/b110060/AAxx.java",
5301
	workingCopies[1] = getWorkingCopy("/JavaSearchBugs/src/b110060/AAxx.java",
Lines 5299-5376 Link Here
5299
		"	AxxAyy() {}\n" +
5310
		"	AxxAyy() {}\n" +
5300
		"}\n"
5311
		"}\n"
5301
	);
5312
	);
5302
	workingCopies[3] = getWorkingCopy("/JavaSearchBugs/src/b110060/AxA.java",
5313
	workingCopies[3] = getWorkingCopy("/JavaSearchBugs/src/b110060/AxAyAz.java",
5303
		"package b110060;\n" +
5314
		"package b110060;\n" +
5304
		"public class AxA {\n" +
5315
		"public class AxAyAz {\n" +
5305
		"	AxA() {}\n" +
5316
		"	AxAyAz() {}\n" +
5306
		"}\n"
5317
		"}\n"
5307
	);
5318
	);
5308
	workingCopies[4] = getWorkingCopy("/JavaSearchBugs/src/b110060/Test.java",
5319
	workingCopies[4] = getWorkingCopy("/JavaSearchBugs/src/b110060/Test.java",
5309
		"package b110060;\n" +
5320
		"package b110060;\n" +
5310
		"public class Test {\n" +
5321
		"public class Test {\n" +
5311
		"	AA aa = new AA();\n" +
5322
		"	AAAA aaaa = new AAAA();\n" +
5312
		"	AAxx aaxx = new AAxx();\n" +
5323
		"	AAxx aaxx = new AAxx();\n" +
5313
		"	AxA axa = new AxA();\n" +
5324
		"	AxAyAz axayaz = new AxAyAz();\n" +
5314
		"	AxxAyy axxayy = new AxxAyy();\n" +
5325
		"	AxxAyy axxayy = new AxxAyy();\n" +
5315
		"}\n"
5326
		"}\n"
5316
	);
5327
	);
5317
}
5328
}
5318
public void testBug110060_ConstructorPattern01() throws CoreException {
5329
public void testBug110060_ConstructorPattern01() throws CoreException {
5319
	setUpBug110060_ConstructorPattern();
5330
	setUpBug110060_ConstructorPattern();
5320
	search("AA", CONSTRUCTOR, REFERENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5331
	search("AA", CONSTRUCTOR, REFERENCES, SearchPattern.R_CAMELCASE_MATCH);
5332
	assertSearchResults(
5333
		"src/b110060/Test.java b110060.Test.aaaa [new AAAA()] EXACT_MATCH\n" +
5334
		"src/b110060/Test.java b110060.Test.aaxx [new AAxx()] EXACT_MATCH\n" +
5335
		"src/b110060/Test.java b110060.Test.axayaz [new AxAyAz()] EXACT_MATCH\n" +
5336
		"src/b110060/Test.java b110060.Test.axxayy [new AxxAyy()] EXACT_MATCH"
5337
	);
5338
}
5339
public void testBug110060_ConstructorPattern01_SamePartCount() throws CoreException {
5340
	setUpBug110060_ConstructorPattern();
5341
	search("AA", CONSTRUCTOR, REFERENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5321
	assertSearchResults(
5342
	assertSearchResults(
5322
		"src/b110060/Test.java b110060.Test.aa [new AA()] EXACT_MATCH\n" +
5323
		"src/b110060/Test.java b110060.Test.aaxx [new AAxx()] EXACT_MATCH\n" +
5343
		"src/b110060/Test.java b110060.Test.aaxx [new AAxx()] EXACT_MATCH\n" +
5324
		"src/b110060/Test.java b110060.Test.axa [new AxA()] EXACT_MATCH\n" +
5325
		"src/b110060/Test.java b110060.Test.axxayy [new AxxAyy()] EXACT_MATCH"
5344
		"src/b110060/Test.java b110060.Test.axxayy [new AxxAyy()] EXACT_MATCH"
5326
	);
5345
	);
5327
}
5346
}
5328
public void testBug110060_ConstructorPattern02() throws CoreException {
5347
public void testBug110060_ConstructorPattern02() throws CoreException {
5329
	setUpBug110060_ConstructorPattern();
5348
	setUpBug110060_ConstructorPattern();
5330
	search("AA", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5349
	search("AA", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5331
	assertSearchResults(
5350
	assertSearchResults(
5332
		"src/b110060/AA.java b110060.AA() [AA] EXACT_MATCH\n" +
5351
		"src/b110060/AAAA.java b110060.AAAA() [AAAA] EXACT_MATCH\n" +
5333
		"src/b110060/AAxx.java b110060.AAxx() [AAxx] EXACT_MATCH\n" +
5352
		"src/b110060/AAxx.java b110060.AAxx() [AAxx] EXACT_MATCH\n" +
5334
		"src/b110060/AxA.java b110060.AxA() [AxA] EXACT_MATCH\n" +
5353
		"src/b110060/AxAyAz.java b110060.AxAyAz() [AxAyAz] EXACT_MATCH\n" +
5335
		"src/b110060/AxxAyy.java b110060.AxxAyy() [AxxAyy] EXACT_MATCH\n" +
5354
		"src/b110060/AxxAyy.java b110060.AxxAyy() [AxxAyy] EXACT_MATCH\n" +
5336
		"src/b110060/Test.java b110060.Test.aa [new AA()] EXACT_MATCH\n" +
5355
		"src/b110060/Test.java b110060.Test.aaaa [new AAAA()] EXACT_MATCH\n" +
5337
		"src/b110060/Test.java b110060.Test.aaxx [new AAxx()] EXACT_MATCH\n" +
5356
		"src/b110060/Test.java b110060.Test.aaxx [new AAxx()] EXACT_MATCH\n" +
5338
		"src/b110060/Test.java b110060.Test.axa [new AxA()] EXACT_MATCH\n" +
5357
		"src/b110060/Test.java b110060.Test.axayaz [new AxAyAz()] EXACT_MATCH\n" +
5358
		"src/b110060/Test.java b110060.Test.axxayy [new AxxAyy()] EXACT_MATCH"
5359
	);
5360
}
5361
public void testBug110060_ConstructorPattern02_SamePartCount() throws CoreException {
5362
	setUpBug110060_ConstructorPattern();
5363
	search("AA", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5364
	assertSearchResults(
5365
		"src/b110060/AAxx.java b110060.AAxx() [AAxx] EXACT_MATCH\n" + 
5366
		"src/b110060/AxxAyy.java b110060.AxxAyy() [AxxAyy] EXACT_MATCH\n" + 
5367
		"src/b110060/Test.java b110060.Test.aaxx [new AAxx()] EXACT_MATCH\n" + 
5339
		"src/b110060/Test.java b110060.Test.axxayy [new AxxAyy()] EXACT_MATCH"
5368
		"src/b110060/Test.java b110060.Test.axxayy [new AxxAyy()] EXACT_MATCH"
5340
	);
5369
	);
5341
}
5370
}
5342
public void testBug110060_ConstructorPattern03() throws CoreException {
5371
public void testBug110060_ConstructorPattern03() throws CoreException {
5343
	setUpBug110060_ConstructorPattern();
5372
	setUpBug110060_ConstructorPattern();
5344
	search("AAx", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5373
	search("AAx", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5345
	assertSearchResults(
5374
	assertSearchResults(
5346
		"" // no match as prefix is not set
5375
		"src/b110060/AAxx.java b110060.AAxx() [AAxx] EXACT_MATCH\n" +
5376
		"src/b110060/Test.java b110060.Test.aaxx [new AAxx()] EXACT_MATCH"
5377
	);
5378
}
5379
public void testBug110060_ConstructorPattern03_SamePartCount() throws CoreException {
5380
	setUpBug110060_ConstructorPattern();
5381
	search("AAx", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5382
	assertSearchResults(
5383
		"src/b110060/AAxx.java b110060.AAxx() [AAxx] EXACT_MATCH\n" +
5384
		"src/b110060/Test.java b110060.Test.aaxx [new AAxx()] EXACT_MATCH"
5347
	);
5385
	);
5348
}
5386
}
5349
public void testBug110060_ConstructorPattern04() throws CoreException {
5387
public void testBug110060_ConstructorPattern04() throws CoreException {
5350
	setUpBug110060_ConstructorPattern();
5388
	setUpBug110060_ConstructorPattern();
5351
	search("Axx", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5389
	search("AxA", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5390
	assertSearchResults(
5391
		"src/b110060/AxAyAz.java b110060.AxAyAz() [AxAyAz] EXACT_MATCH\n" +
5392
		"src/b110060/AxxAyy.java b110060.AxxAyy() [AxxAyy] EXACT_MATCH\n" +
5393
		"src/b110060/Test.java b110060.Test.axayaz [new AxAyAz()] EXACT_MATCH\n" +
5394
		"src/b110060/Test.java b110060.Test.axxayy [new AxxAyy()] EXACT_MATCH"
5395
	);
5396
}
5397
public void testBug110060_ConstructorPattern04_SamePartCount() throws CoreException {
5398
	setUpBug110060_ConstructorPattern();
5399
	search("AxA", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5352
	assertSearchResults(
5400
	assertSearchResults(
5353
		"" // no match as prefix is not set
5401
		"src/b110060/AxxAyy.java b110060.AxxAyy() [AxxAyy] EXACT_MATCH\n" + 
5402
		"src/b110060/Test.java b110060.Test.axxayy [new AxxAyy()] EXACT_MATCH"
5354
	);
5403
	);
5355
}
5404
}
5356
public void testBug110060_ConstructorPattern05() throws CoreException {
5405
public void testBug110060_ConstructorPattern05() throws CoreException {
5357
	setUpBug110060_ConstructorPattern();
5406
	setUpBug110060_ConstructorPattern();
5358
	search("Ax", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5407
	search("A*A*", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5408
	// Invalid camel case pattern => replace the camel case flag with pattern match one (case insensitive)
5359
	assertSearchResults(
5409
	assertSearchResults(
5360
		"" // no match as prefix is not set
5410
		"src/b110060/AAAA.java b110060.AAAA() [AAAA] EXACT_MATCH\n" +
5411
		"src/b110060/AAxx.java b110060.AAxx() [AAxx] EXACT_MATCH\n" +
5412
		"src/b110060/AxAyAz.java b110060.AxAyAz() [AxAyAz] EXACT_MATCH\n" +
5413
		"src/b110060/AxxAyy.java b110060.AxxAyy() [AxxAyy] EXACT_MATCH\n" +
5414
		"src/b110060/Test.java b110060.Test.aaaa [new AAAA()] EXACT_MATCH\n" +
5415
		"src/b110060/Test.java b110060.Test.aaxx [new AAxx()] EXACT_MATCH\n" +
5416
		"src/b110060/Test.java b110060.Test.axayaz [new AxAyAz()] EXACT_MATCH\n" +
5417
		"src/b110060/Test.java b110060.Test.axxayy [new AxxAyy()] EXACT_MATCH"
5361
	);
5418
	);
5362
}
5419
}
5363
public void testBug110060_ConstructorPattern06() throws CoreException {
5420
public void testBug110060_ConstructorPattern05_SamePartCount() throws CoreException {
5364
	setUpBug110060_ConstructorPattern();
5421
	setUpBug110060_ConstructorPattern();
5365
	search("A*A*", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5422
	search("A*A*", CONSTRUCTOR, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5423
	// Invalid camel case pattern => replace the camel case flag with pattern match one (case insensitive)
5366
	assertSearchResults(
5424
	assertSearchResults(
5367
		"src/b110060/AA.java b110060.AA() [AA] EXACT_MATCH\n" +
5425
		"src/b110060/AAAA.java b110060.AAAA() [AAAA] EXACT_MATCH\n" +
5368
		"src/b110060/AAxx.java b110060.AAxx() [AAxx] EXACT_MATCH\n" +
5426
		"src/b110060/AAxx.java b110060.AAxx() [AAxx] EXACT_MATCH\n" +
5369
		"src/b110060/AxA.java b110060.AxA() [AxA] EXACT_MATCH\n" +
5427
		"src/b110060/AxAyAz.java b110060.AxAyAz() [AxAyAz] EXACT_MATCH\n" +
5370
		"src/b110060/AxxAyy.java b110060.AxxAyy() [AxxAyy] EXACT_MATCH\n" +
5428
		"src/b110060/AxxAyy.java b110060.AxxAyy() [AxxAyy] EXACT_MATCH\n" +
5371
		"src/b110060/Test.java b110060.Test.aa [new AA()] EXACT_MATCH\n" +
5429
		"src/b110060/Test.java b110060.Test.aaaa [new AAAA()] EXACT_MATCH\n" +
5372
		"src/b110060/Test.java b110060.Test.aaxx [new AAxx()] EXACT_MATCH\n" +
5430
		"src/b110060/Test.java b110060.Test.aaxx [new AAxx()] EXACT_MATCH\n" +
5373
		"src/b110060/Test.java b110060.Test.axa [new AxA()] EXACT_MATCH\n" +
5431
		"src/b110060/Test.java b110060.Test.axayaz [new AxAyAz()] EXACT_MATCH\n" +
5374
		"src/b110060/Test.java b110060.Test.axxayy [new AxxAyy()] EXACT_MATCH"
5432
		"src/b110060/Test.java b110060.Test.axxayy [new AxxAyy()] EXACT_MATCH"
5375
	);
5433
	);
5376
}
5434
}
Lines 5396-5424 Link Here
5396
		"}\n"
5454
		"}\n"
5397
	);
5455
	);
5398
}
5456
}
5399
/** @deprecated As using a depreciated constant */
5400
public void testBug110060_MethodPattern01() throws CoreException {
5457
public void testBug110060_MethodPattern01() throws CoreException {
5401
	setUpBug110060_MethodPattern();
5458
	setUpBug110060_MethodPattern();
5402
	search("MWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5459
	search("MWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5403
	assertSearchResults("");
5460
	assertSearchResults("");
5404
}
5461
}
5405
public void testBug110060_MethodPattern01new() throws CoreException {
5462
public void testBug110060_MethodPattern01_SamePartCount() throws CoreException {
5406
	setUpBug110060_MethodPattern();
5463
	setUpBug110060_MethodPattern();
5407
	search("MWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5464
	search("MWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5408
	assertSearchResults("");
5465
	assertSearchResults("");
5409
}
5466
}
5410
/** @deprecated As using a depreciated constant */
5411
public void testBug110060_MethodPattern02() throws CoreException {
5467
public void testBug110060_MethodPattern02() throws CoreException {
5412
	setUpBug110060_MethodPattern();
5468
	setUpBug110060_MethodPattern();
5413
	search("AMWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5469
	search("AMWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5414
	assertSearchResults("");
5470
	assertSearchResults("");
5415
}
5471
}
5416
public void testBug110060_MethodPattern02new() throws CoreException {
5472
public void testBug110060_MethodPattern02_SamePartCount() throws CoreException {
5417
	setUpBug110060_MethodPattern();
5473
	setUpBug110060_MethodPattern();
5418
	search("AMWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5474
	search("AMWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5419
	assertSearchResults("");
5475
	assertSearchResults("");
5420
}
5476
}
5421
/** @deprecated As using a depreciated constant */
5422
public void testBug110060_MethodPattern03() throws CoreException {
5477
public void testBug110060_MethodPattern03() throws CoreException {
5423
	setUpBug110060_MethodPattern();
5478
	setUpBug110060_MethodPattern();
5424
	search("aMWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5479
	search("aMWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 5429-5443 Link Here
5429
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1DigitAnd_AnUnderscore()] EXACT_MATCH"
5484
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1DigitAnd_AnUnderscore()] EXACT_MATCH"
5430
	);
5485
	);
5431
}
5486
}
5432
public void testBug110060_MethodPattern03new() throws CoreException {
5487
public void testBug110060_MethodPattern03_SamePartCount() throws CoreException {
5433
	setUpBug110060_MethodPattern();
5488
	setUpBug110060_MethodPattern();
5434
	search("aMWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5489
	search("aMWD", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5435
	assertSearchResults(
5490
	assertSearchResults(
5436
		"src/b110060/Test.java void b110060.Test.aMethodWith1Digit() [aMethodWith1Digit] EXACT_MATCH\n" + 
5491
		"src/b110060/Test.java void b110060.Test.aMethodWith1Digit() [aMethodWith1Digit] EXACT_MATCH\n" + 
5437
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Digit()] EXACT_MATCH"
5492
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Digit()] EXACT_MATCH"
5438
	);
5493
	);
5439
}
5494
}
5440
/** @deprecated As using a depreciated constant */
5441
public void testBug110060_MethodPattern04() throws CoreException {
5495
public void testBug110060_MethodPattern04() throws CoreException {
5442
	setUpBug110060_MethodPattern();
5496
	setUpBug110060_MethodPattern();
5443
	search("aMW", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5497
	search("aMW", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 5452-5465 Link Here
5452
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWithNothingSpecial()] EXACT_MATCH"
5506
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWithNothingSpecial()] EXACT_MATCH"
5453
	);
5507
	);
5454
}
5508
}
5455
public void testBug110060_MethodPattern04new() throws CoreException {
5509
public void testBug110060_MethodPattern04_SamePartCount() throws CoreException {
5456
	setUpBug110060_MethodPattern();
5510
	setUpBug110060_MethodPattern();
5457
	search("aMW", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5511
	search("aMW", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5458
	assertSearchResults(
5512
	assertSearchResults(
5459
		"" // no result as prefix match is not set
5513
		""
5460
	);
5514
	);
5461
}
5515
}
5462
/** @deprecated As using a depreciated constant */
5463
public void testBug110060_MethodPattern05() throws CoreException {
5516
public void testBug110060_MethodPattern05() throws CoreException {
5464
	setUpBug110060_MethodPattern();
5517
	setUpBug110060_MethodPattern();
5465
	search("aMethod", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5518
	search("aMethod", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 5474-5487 Link Here
5474
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWithNothingSpecial()] EXACT_MATCH"
5527
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWithNothingSpecial()] EXACT_MATCH"
5475
	);
5528
	);
5476
}
5529
}
5477
public void testBug110060_MethodPattern05new() throws CoreException {
5530
public void testBug110060_MethodPattern05_SamePartCount() throws CoreException {
5478
	setUpBug110060_MethodPattern();
5531
	setUpBug110060_MethodPattern();
5479
	search("aMethod", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5532
	search("aMethod", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5480
	assertSearchResults(
5533
	assertSearchResults("");
5481
		"" // no result as prefix match is not set
5482
	);
5483
}
5534
}
5484
/** @deprecated As using a depreciated constant */
5485
public void testBug110060_MethodPattern06() throws CoreException {
5535
public void testBug110060_MethodPattern06() throws CoreException {
5486
	setUpBug110060_MethodPattern();
5536
	setUpBug110060_MethodPattern();
5487
	search("aMethodWith1", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5537
	search("aMethodWith1", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 5494-5510 Link Here
5494
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores()] EXACT_MATCH"
5544
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores()] EXACT_MATCH"
5495
	);
5545
	);
5496
}
5546
}
5497
public void testBug110060_MethodPattern06new() throws CoreException {
5547
public void testBug110060_MethodPattern06_SamePartCount() throws CoreException {
5498
	setUpBug110060_MethodPattern();
5548
	setUpBug110060_MethodPattern();
5499
	search("aMethodWith1", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5549
	search("aMethodWith1", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5500
	assertSearchResults(
5550
	assertSearchResults("");
5501
		"" // no result as prefix match is not set
5502
	);
5503
}
5551
}
5504
/** @deprecated As using a depreciated constant */
5505
public void testBug110060_MethodPattern07() throws CoreException {
5552
public void testBug110060_MethodPattern07() throws CoreException {
5506
	setUpBug110060_MethodPattern();
5553
	setUpBug110060_MethodPattern();
5507
	search("*Method*With*A*", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5554
	search("*Method*With*A*", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5555
	// Invalid camel case pattern => replace the camel case flag with pattern match one (case insensitive)
5508
	assertSearchResults(
5556
	assertSearchResults(
5509
		"src/b110060/Test.java void b110060.Test.aMethodWithNothingSpecial() [aMethodWithNothingSpecial] EXACT_MATCH\n" +
5557
		"src/b110060/Test.java void b110060.Test.aMethodWithNothingSpecial() [aMethodWithNothingSpecial] EXACT_MATCH\n" +
5510
		"src/b110060/Test.java void b110060.Test.aMethodWith1DigitAnd_AnUnderscore() [aMethodWith1DigitAnd_AnUnderscore] EXACT_MATCH\n" +
5558
		"src/b110060/Test.java void b110060.Test.aMethodWith1DigitAnd_AnUnderscore() [aMethodWith1DigitAnd_AnUnderscore] EXACT_MATCH\n" +
Lines 5516-5524 Link Here
5516
		"src/b110060/Test.java void b110060.Test.testReferences() [otherMethodWhichStartsWithAnotherLetter()] EXACT_MATCH"
5564
		"src/b110060/Test.java void b110060.Test.testReferences() [otherMethodWhichStartsWithAnotherLetter()] EXACT_MATCH"
5517
	);
5565
	);
5518
}
5566
}
5519
public void testBug110060_MethodPattern07new() throws CoreException {
5567
public void testBug110060_MethodPattern07_SamePartCount() throws CoreException {
5520
	setUpBug110060_MethodPattern();
5568
	setUpBug110060_MethodPattern();
5521
	search("*Method*With*A*", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5569
	search("*Method*With*A*", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5570
	// Invalid camel case pattern => replace the camel case flag with pattern match one (case insensitive)
5522
	assertSearchResults(
5571
	assertSearchResults(
5523
		"src/b110060/Test.java void b110060.Test.aMethodWithNothingSpecial() [aMethodWithNothingSpecial] EXACT_MATCH\n" +
5572
		"src/b110060/Test.java void b110060.Test.aMethodWithNothingSpecial() [aMethodWithNothingSpecial] EXACT_MATCH\n" +
5524
		"src/b110060/Test.java void b110060.Test.aMethodWith1DigitAnd_AnUnderscore() [aMethodWith1DigitAnd_AnUnderscore] EXACT_MATCH\n" +
5573
		"src/b110060/Test.java void b110060.Test.aMethodWith1DigitAnd_AnUnderscore() [aMethodWith1DigitAnd_AnUnderscore] EXACT_MATCH\n" +
Lines 5530-5536 Link Here
5530
		"src/b110060/Test.java void b110060.Test.testReferences() [otherMethodWhichStartsWithAnotherLetter()] EXACT_MATCH"
5579
		"src/b110060/Test.java void b110060.Test.testReferences() [otherMethodWhichStartsWithAnotherLetter()] EXACT_MATCH"
5531
	);
5580
	);
5532
}
5581
}
5533
/** @deprecated As using a depreciated constant */
5534
public void testBug110060_MethodPattern08() throws CoreException {
5582
public void testBug110060_MethodPattern08() throws CoreException {
5535
	setUpBug110060_MethodPattern();
5583
	setUpBug110060_MethodPattern();
5536
	search("aMW1D", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5584
	search("aMW1D", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 5541-5555 Link Here
5541
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1DigitAnd_AnUnderscore()] EXACT_MATCH"
5589
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1DigitAnd_AnUnderscore()] EXACT_MATCH"
5542
	);
5590
	);
5543
}
5591
}
5544
public void testBug110060_MethodPattern08new() throws CoreException {
5592
public void testBug110060_MethodPattern08_SamePartCount() throws CoreException {
5545
	setUpBug110060_MethodPattern();
5593
	setUpBug110060_MethodPattern();
5546
	search("aMW1D", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5594
	search("aMW1D", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5547
	assertSearchResults(
5595
	assertSearchResults(
5548
		"src/b110060/Test.java void b110060.Test.aMethodWith1Digit() [aMethodWith1Digit] EXACT_MATCH\n" + 
5596
		"src/b110060/Test.java void b110060.Test.aMethodWith1Digit() [aMethodWith1Digit] EXACT_MATCH\n" + 
5549
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Digit()] EXACT_MATCH"
5597
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Digit()] EXACT_MATCH"
5550
	);
5598
	);
5551
}
5599
}
5552
/** @deprecated As using a depreciated constant */
5553
public void testBug110060_MethodPattern09() throws CoreException {
5600
public void testBug110060_MethodPattern09() throws CoreException {
5554
	setUpBug110060_MethodPattern();
5601
	setUpBug110060_MethodPattern();
5555
	search("aMWOOODASU", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5602
	search("aMWOOODASU", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 5558-5566 Link Here
5558
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores()] EXACT_MATCH"
5605
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores()] EXACT_MATCH"
5559
	);
5606
	);
5560
}
5607
}
5561
public void testBug110060_MethodPattern09new() throws CoreException {
5608
public void testBug110060_MethodPattern09_SamePartCount() throws CoreException {
5562
	setUpBug110060_MethodPattern();
5609
	setUpBug110060_MethodPattern();
5563
	search("aMWOOODASU", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5610
	search("aMWOOODASU", METHOD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5564
	assertSearchResults(
5611
	assertSearchResults(
5565
		"src/b110060/Test.java void b110060.Test.aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores() [aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores] EXACT_MATCH\n" +
5612
		"src/b110060/Test.java void b110060.Test.aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores() [aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores] EXACT_MATCH\n" +
5566
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores()] EXACT_MATCH"
5613
		"src/b110060/Test.java void b110060.Test.testReferences() [aMethodWith1Or2_Or_3_Or__4__DigitsAnd_Several_Underscores()] EXACT_MATCH"
Lines 5588-5594 Link Here
5588
		"}\n"
5635
		"}\n"
5589
	);
5636
	);
5590
}
5637
}
5591
/** @deprecated As using a depreciated constant */
5592
public void testBug110060_FieldPattern01() throws CoreException {
5638
public void testBug110060_FieldPattern01() throws CoreException {
5593
	setUpBug110060_FieldPattern();
5639
	setUpBug110060_FieldPattern();
5594
	search("aFWSD", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5640
	search("aFWSD", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 5599-5624 Link Here
5599
		"src/b110060/Test.java void b110060.Test.testReferences() [aFieldWith$Several$DollarslAnd1DigitAnd_1Underscore] EXACT_MATCH"
5645
		"src/b110060/Test.java void b110060.Test.testReferences() [aFieldWith$Several$DollarslAnd1DigitAnd_1Underscore] EXACT_MATCH"
5600
	);
5646
	);
5601
}
5647
}
5602
public void testBug110060_FieldPattern01new() throws CoreException {
5648
public void testBug110060_FieldPattern01_SamePartCount() throws CoreException {
5603
	setUpBug110060_FieldPattern();
5649
	setUpBug110060_FieldPattern();
5604
	search("aFWSD", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5650
	search("aFWSD", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5605
	assertSearchResults(
5651
	assertSearchResults(
5606
		"src/b110060/Test.java b110060.Test.aFieldWithS$Dollar [aFieldWithS$Dollar] EXACT_MATCH\n" + 
5652
		"src/b110060/Test.java b110060.Test.aFieldWithS$Dollar [aFieldWithS$Dollar] EXACT_MATCH\n" + 
5607
		"src/b110060/Test.java void b110060.Test.testReferences() [aFieldWithS$Dollar] EXACT_MATCH"
5653
		"src/b110060/Test.java void b110060.Test.testReferences() [aFieldWithS$Dollar] EXACT_MATCH"
5608
	);
5654
	);
5609
}
5655
}
5610
/** @deprecated As using a depreciated constant */
5611
public void testBug110060_FieldPattern02() throws CoreException {
5656
public void testBug110060_FieldPattern02() throws CoreException {
5612
	setUpBug110060_FieldPattern();
5657
	setUpBug110060_FieldPattern();
5613
	search("afwsd", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5658
	search("afwsd", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5614
	assertSearchResults("");
5659
	assertSearchResults("");
5615
}
5660
}
5616
public void testBug110060_FieldPattern02new() throws CoreException {
5661
public void testBug110060_FieldPattern02_SamePartCount() throws CoreException {
5617
	setUpBug110060_FieldPattern();
5662
	setUpBug110060_FieldPattern();
5618
	search("afwsd", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5663
	search("afwsd", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5619
	assertSearchResults("");
5664
	assertSearchResults("");
5620
}
5665
}
5621
/** @deprecated As using a depreciated constant */
5622
public void testBug110060_FieldPattern03() throws CoreException {
5666
public void testBug110060_FieldPattern03() throws CoreException {
5623
	setUpBug110060_FieldPattern();
5667
	setUpBug110060_FieldPattern();
5624
	search("aFWS$", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5668
	search("aFWS$", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 5627-5640 Link Here
5627
		"src/b110060/Test.java void b110060.Test.testReferences() [aFieldWithS$Dollar] EXACT_MATCH"
5671
		"src/b110060/Test.java void b110060.Test.testReferences() [aFieldWithS$Dollar] EXACT_MATCH"
5628
	);
5672
	);
5629
}
5673
}
5630
public void testBug110060_FieldPattern03new() throws CoreException {
5674
public void testBug110060_FieldPattern03_SamePartCount() throws CoreException {
5631
	setUpBug110060_FieldPattern();
5675
	setUpBug110060_FieldPattern();
5632
	search("aFWS$", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5676
	search("aFWS$", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5633
	assertSearchResults(
5677
	assertSearchResults("");
5634
		"" // no result as prefix match is not set
5635
	);
5636
}
5678
}
5637
/** @deprecated As using a depreciated constant */
5638
public void testBug110060_FieldPattern04() throws CoreException {
5679
public void testBug110060_FieldPattern04() throws CoreException {
5639
	setUpBug110060_FieldPattern();
5680
	setUpBug110060_FieldPattern();
5640
	search("aSFWSCD", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5681
	search("aSFWSCD", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 5643-5657 Link Here
5643
		"src/b110060/Test.java void b110060.Test.testReferences() [aStrangeFieldWith$$$$$$$$$$$$$$$SeveraContiguousDollars] EXACT_MATCH"
5684
		"src/b110060/Test.java void b110060.Test.testReferences() [aStrangeFieldWith$$$$$$$$$$$$$$$SeveraContiguousDollars] EXACT_MATCH"
5644
	);
5685
	);
5645
}
5686
}
5646
public void testBug110060_FieldPattern04new() throws CoreException {
5687
public void testBug110060_FieldPattern04_SamePartCount() throws CoreException {
5647
	setUpBug110060_FieldPattern();
5688
	setUpBug110060_FieldPattern();
5648
	search("aSFWSCD", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5689
	search("aSFWSCD", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5649
	assertSearchResults(
5690
	assertSearchResults(
5650
		"src/b110060/Test.java b110060.Test.aStrangeFieldWith$$$$$$$$$$$$$$$SeveraContiguousDollars [aStrangeFieldWith$$$$$$$$$$$$$$$SeveraContiguousDollars] EXACT_MATCH\n" +
5691
		"src/b110060/Test.java b110060.Test.aStrangeFieldWith$$$$$$$$$$$$$$$SeveraContiguousDollars [aStrangeFieldWith$$$$$$$$$$$$$$$SeveraContiguousDollars] EXACT_MATCH\n" +
5651
		"src/b110060/Test.java void b110060.Test.testReferences() [aStrangeFieldWith$$$$$$$$$$$$$$$SeveraContiguousDollars] EXACT_MATCH"
5692
		"src/b110060/Test.java void b110060.Test.testReferences() [aStrangeFieldWith$$$$$$$$$$$$$$$SeveraContiguousDollars] EXACT_MATCH"
5652
	);
5693
	);
5653
}
5694
}
5654
/** @deprecated As using a depreciated constant */
5655
public void testBug110060_FieldPattern05() throws CoreException {
5695
public void testBug110060_FieldPattern05() throws CoreException {
5656
	setUpBug110060_FieldPattern();
5696
	setUpBug110060_FieldPattern();
5657
	search("oF", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
5697
	search("oF", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
Lines 5663-5669 Link Here
5663
}
5703
}
5664
public void testBug110060_FieldPattern05new() throws CoreException {
5704
public void testBug110060_FieldPattern05new() throws CoreException {
5665
	setUpBug110060_FieldPattern();
5705
	setUpBug110060_FieldPattern();
5666
	search("oF", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
5706
	search("oF", FIELD, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
5667
	assertSearchResults(
5707
	assertSearchResults(
5668
		"src/b110060/Test.java b110060.Test.oF [oF] EXACT_MATCH"
5708
		"src/b110060/Test.java b110060.Test.oF [oF] EXACT_MATCH"
5669
	);
5709
	);
Lines 5688-5694 Link Here
5688
}
5728
}
5689
5729
5690
/**
5730
/**
5691
 * @test Bug 110336: [plan][search] Should optionaly return the local variable for type reference
5731
 * @test Bug 110336: [plan][search] Should optionally return the local variable for type reference
5692
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=110336"
5732
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=110336"
5693
 */
5733
 */
5694
public void testBug110336a() throws CoreException {
5734
public void testBug110336a() throws CoreException {
Lines 6455-6717 Link Here
6455
 *	@test Ensure that camel case pattern may use end character
6495
 *	@test Ensure that camel case pattern may use end character
6456
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=124624"
6496
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=124624"
6457
 */
6497
 */
6458
public void testBug124624_HM_new() throws CoreException {
6498
private void setupBug124624() throws JavaModelException {
6459
	workingCopies = new ICompilationUnit[1];
6499
	workingCopies = new ICompilationUnit[1];
6460
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6500
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6461
		"class HashMap {}\n" + 
6501
		"class HashMap {}\n" + 
6462
		"class HtmlMapper {}\n" + 
6502
		"class HtmlMapper {}\n" + 
6463
		"class HashMapEntry {}\n" + 
6503
		"class HashMapEntry {}\n" + 
6464
		"class HatMappage {}\n"
6504
		"class HaxMapxxxx {}\n"
6465
	);
6466
	search("HM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
6467
	assertSearchResults(
6468
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6469
		"src/Test.java HtmlMapper [HtmlMapper] EXACT_MATCH\n" + 
6470
		"src/Test.java HatMappage [HatMappage] EXACT_MATCH"
6471
	);
6505
	);
6472
}
6506
}
6473
/** @deprecated As using a depreciated constant */
6507
public void testBug124624_HM_CamelCase() throws CoreException {
6474
public void testBug124624_HM_old() throws CoreException {
6508
	setupBug124624();
6475
	workingCopies = new ICompilationUnit[1];
6476
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6477
		"class HashMap {}\n" + 
6478
		"class HtmlMapper {}\n" + 
6479
		"class HashMapEntry {}\n" + 
6480
		"class HatMappage {}\n"
6481
	);
6482
	search("HM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6509
	search("HM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6483
	assertSearchResults(
6510
	assertSearchResults(
6484
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6511
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6485
		"src/Test.java HtmlMapper [HtmlMapper] EXACT_MATCH\n" + 
6512
		"src/Test.java HtmlMapper [HtmlMapper] EXACT_MATCH\n" + 
6486
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH\n" + 
6513
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH\n" + 
6487
		"src/Test.java HatMappage [HatMappage] EXACT_MATCH"
6514
		"src/Test.java HaxMapxxxx [HaxMapxxxx] EXACT_MATCH"
6488
	);
6515
	);
6489
}
6516
}
6490
public void testBug124624_HaM_new() throws CoreException {
6517
public void testBug124624_HM_CamelCaseSamePartCount() throws CoreException {
6491
	workingCopies = new ICompilationUnit[1];
6518
	setupBug124624();
6492
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6519
	search("HM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
6493
		"class HashMap {}\n" + 
6494
		"class HtmlMapper {}\n" + 
6495
		"class HashMapEntry {}\n" + 
6496
		"class HatMappage {}\n"
6497
	);
6498
	search("HaM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
6499
	assertSearchResults(
6520
	assertSearchResults(
6500
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6521
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6501
		"src/Test.java HatMappage [HatMappage] EXACT_MATCH"
6522
		"src/Test.java HtmlMapper [HtmlMapper] EXACT_MATCH\n" + 
6523
		"src/Test.java HaxMapxxxx [HaxMapxxxx] EXACT_MATCH"
6502
	);
6524
	);
6503
}
6525
}
6504
/** @deprecated As using a depreciated constant */
6526
public void testBug124624_HaM_CamelCase() throws CoreException {
6505
public void testBug124624_HaM_old() throws CoreException {
6527
	setupBug124624();
6506
	workingCopies = new ICompilationUnit[1];
6507
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6508
		"class HashMap {}\n" + 
6509
		"class HtmlMapper {}\n" + 
6510
		"class HashMapEntry {}\n" + 
6511
		"class HatMappage {}\n"
6512
	);
6513
	search("HaM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6528
	search("HaM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6514
	assertSearchResults(
6529
	assertSearchResults(
6515
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6530
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6516
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH\n" + 
6531
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH\n" + 
6517
		"src/Test.java HatMappage [HatMappage] EXACT_MATCH"
6532
		"src/Test.java HaxMapxxxx [HaxMapxxxx] EXACT_MATCH"
6518
	);
6533
	);
6519
}
6534
}
6520
public void testBug124624_HashM_new() throws CoreException {
6535
public void testBug124624_HaM_CamelCaseSamePartCount() throws CoreException {
6521
	workingCopies = new ICompilationUnit[1];
6536
	setupBug124624();
6522
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6537
	search("HaM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
6523
		"class HashMap {}\n" + 
6524
		"class HtmlMapper {}\n" + 
6525
		"class HashMapEntry {}\n" + 
6526
		"class HatMappage {}\n"
6527
	);
6528
	search("HashM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
6529
	assertSearchResults(
6538
	assertSearchResults(
6530
		"src/Test.java HashMap [HashMap] EXACT_MATCH"
6539
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6540
		"src/Test.java HaxMapxxxx [HaxMapxxxx] EXACT_MATCH"
6531
	);
6541
	);
6532
}
6542
}
6533
/** @deprecated As using a depreciated constant */
6543
public void testBug124624_HashM_CamelCase() throws CoreException {
6534
public void testBug124624_HashM_old() throws CoreException {
6544
	setupBug124624();
6535
	workingCopies = new ICompilationUnit[1];
6536
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6537
		"class HashMap {}\n" + 
6538
		"class HtmlMapper {}\n" + 
6539
		"class HashMapEntry {}\n" + 
6540
		"class HatMappage {}\n"
6541
	);
6542
	search("HashM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6545
	search("HashM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6543
	assertSearchResults(
6546
	assertSearchResults(
6544
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6547
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6545
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH"
6548
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH"
6546
	);
6549
	);
6547
}
6550
}
6548
public void testBug124624_HMa_new() throws CoreException {
6551
public void testBug124624_HashM_CamelCaseSamePartCount() throws CoreException {
6549
	workingCopies = new ICompilationUnit[1];
6552
	setupBug124624();
6550
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6553
	search("HashM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
6551
		"class HashMap {}\n" + 
6554
	assertSearchResults(
6552
		"class HtmlMapper {}\n" + 
6555
		"src/Test.java HashMap [HashMap] EXACT_MATCH"
6553
		"class HashMapEntry {}\n" + 
6554
		"class HatMappage {}\n"
6555
	);
6556
	);
6556
	search("HMa", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
6557
	assertSearchResults("");
6558
}
6557
}
6559
/** @deprecated As using a depreciated constant */
6558
public void testBug124624_HMa_CamelCase() throws CoreException {
6560
public void testBug124624_HMa_old() throws CoreException {
6559
	setupBug124624();
6561
	workingCopies = new ICompilationUnit[1];
6562
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6563
		"class HashMap {}\n" + 
6564
		"class HtmlMapper {}\n" + 
6565
		"class HashMapEntry {}\n" + 
6566
		"class HatMappage {}\n"
6567
	);
6568
	search("HMa", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6560
	search("HMa", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6569
	assertSearchResults(
6561
	assertSearchResults(
6570
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6562
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6571
		"src/Test.java HtmlMapper [HtmlMapper] EXACT_MATCH\n" + 
6563
		"src/Test.java HtmlMapper [HtmlMapper] EXACT_MATCH\n" + 
6572
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH\n" + 
6564
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH\n" + 
6573
		"src/Test.java HatMappage [HatMappage] EXACT_MATCH"
6565
		"src/Test.java HaxMapxxxx [HaxMapxxxx] EXACT_MATCH"
6574
	);
6566
	);
6575
}
6567
}
6576
public void testBug124624_HaMa_new() throws CoreException {
6568
public void testBug124624_HMa_CamelCaseSamePartCount() throws CoreException {
6577
	workingCopies = new ICompilationUnit[1];
6569
	setupBug124624();
6578
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6570
	search("HMa", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
6579
		"class HashMap {}\n" + 
6571
	assertSearchResults(
6580
		"class HtmlMapper {}\n" + 
6572
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6581
		"class HashMapEntry {}\n" + 
6573
		"src/Test.java HtmlMapper [HtmlMapper] EXACT_MATCH\n" + 
6582
		"class HatMappage {}\n"
6574
		"src/Test.java HaxMapxxxx [HaxMapxxxx] EXACT_MATCH"
6583
	);
6575
	);
6584
	search("HaMa", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
6585
	assertSearchResults("");
6586
}
6576
}
6587
/** @deprecated As using a depreciated constant */
6577
public void testBug124624_HaMa_CamelCase() throws CoreException {
6588
public void testBug124624_HaMa_old() throws CoreException {
6578
	setupBug124624();
6589
	workingCopies = new ICompilationUnit[1];
6579
	search("HaMa", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6590
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6591
		"class HashMap {}\n" + 
6592
		"class HtmlMapper {}\n" + 
6593
		"class HashMapEntry {}\n" + 
6594
		"class HatMappage {}\n"
6595
	);
6596
	search("HashMa", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6597
	assertSearchResults(
6580
	assertSearchResults(
6598
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6581
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6599
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH"
6582
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH\n" + 
6583
		"src/Test.java HaxMapxxxx [HaxMapxxxx] EXACT_MATCH"
6600
	);
6584
	);
6601
}
6585
}
6602
public void testBug124624_HashMa_new() throws CoreException {
6586
public void testBug124624_HaMa_CamelCaseSamePartCount() throws CoreException {
6603
	workingCopies = new ICompilationUnit[1];
6587
	setupBug124624();
6604
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6588
	search("HaMa", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
6605
		"class HashMap {}\n" + 
6589
	assertSearchResults(
6606
		"class HtmlMapper {}\n" + 
6590
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6607
		"class HashMapEntry {}\n" + 
6591
		"src/Test.java HaxMapxxxx [HaxMapxxxx] EXACT_MATCH"
6608
		"class HatMappage {}\n"
6609
	);
6592
	);
6610
	search("HashMa", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
6611
	assertSearchResults("");
6612
}
6593
}
6613
/** @deprecated As using a depreciated constant */
6594
public void testBug124624_HashMa_CamelCase() throws CoreException {
6614
public void testBug124624_HashMa_old() throws CoreException {
6595
	setupBug124624();
6615
	workingCopies = new ICompilationUnit[1];
6596
	search("HashMa", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6616
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6617
		"class HashMap {}\n" + 
6618
		"class HtmlMapper {}\n" + 
6619
		"class HashMapEntry {}\n" + 
6620
		"class HatMappage {}\n"
6621
	);
6622
	search("HashM", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6623
	assertSearchResults(
6597
	assertSearchResults(
6624
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6598
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6625
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH"
6599
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH"
6626
	);
6600
	);
6627
}
6601
}
6628
public void testBug124624_HMap_new() throws CoreException {
6602
public void testBug124624_HashMa_CamelCaseSamePartCount() throws CoreException {
6629
	workingCopies = new ICompilationUnit[1];
6603
	setupBug124624();
6630
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6604
	search("HashMa", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
6631
		"class HashMap {}\n" + 
6632
		"class HtmlMapper {}\n" + 
6633
		"class HashMapEntry {}\n" + 
6634
		"class HatMappage {}\n"
6635
	);
6636
	search("HMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
6637
	assertSearchResults(
6605
	assertSearchResults(
6638
		"src/Test.java HashMap [HashMap] EXACT_MATCH"
6606
		"src/Test.java HashMap [HashMap] EXACT_MATCH"
6639
	);
6607
	);
6640
}
6608
}
6641
/** @deprecated As using a depreciated constant */
6609
public void testBug124624_HMap_CamelCase() throws CoreException {
6642
public void testBug124624_HMap_old() throws CoreException {
6610
	setupBug124624();
6643
	workingCopies = new ICompilationUnit[1];
6644
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6645
		"class HashMap {}\n" + 
6646
		"class HtmlMapper {}\n" + 
6647
		"class HashMapEntry {}\n" + 
6648
		"class HatMappage {}\n"
6649
	);
6650
	search("HMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6611
	search("HMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6651
	assertSearchResults(
6612
	assertSearchResults(
6652
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6613
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6653
		"src/Test.java HtmlMapper [HtmlMapper] EXACT_MATCH\n" + 
6614
		"src/Test.java HtmlMapper [HtmlMapper] EXACT_MATCH\n" + 
6654
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH\n" + 
6615
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH\n" + 
6655
		"src/Test.java HatMappage [HatMappage] EXACT_MATCH"
6616
		"src/Test.java HaxMapxxxx [HaxMapxxxx] EXACT_MATCH"
6656
	);
6617
	);
6657
}
6618
}
6658
public void testBug124624_HaMap_new() throws CoreException {
6619
public void testBug124624_HMap_CamelCaseSamePartCount() throws CoreException {
6659
	workingCopies = new ICompilationUnit[1];
6620
	setupBug124624();
6660
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6621
	search("HMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
6661
		"class HashMap {}\n" + 
6662
		"class HtmlMapper {}\n" + 
6663
		"class HashMapEntry {}\n" + 
6664
		"class HatMappage {}\n"
6665
	);
6666
	search("HaMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
6667
	assertSearchResults(
6622
	assertSearchResults(
6668
		"src/Test.java HashMap [HashMap] EXACT_MATCH"
6623
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6624
		"src/Test.java HtmlMapper [HtmlMapper] EXACT_MATCH\n" + 
6625
		"src/Test.java HaxMapxxxx [HaxMapxxxx] EXACT_MATCH"
6669
	);
6626
	);
6670
}
6627
}
6671
/** @deprecated As using a depreciated constant */
6628
public void testBug124624_HaMap_CamelCase() throws CoreException {
6672
public void testBug124624_HaMap_old() throws CoreException {
6629
	setupBug124624();
6673
	workingCopies = new ICompilationUnit[1];
6674
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6675
		"class HashMap {}\n" + 
6676
		"class HtmlMapper {}\n" + 
6677
		"class HashMapEntry {}\n" + 
6678
		"class HatMappage {}\n"
6679
	);
6680
	search("HaMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6630
	search("HaMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6681
	assertSearchResults(
6631
	assertSearchResults(
6682
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6632
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6683
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH\n" + 
6633
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH\n" + 
6684
		"src/Test.java HatMappage [HatMappage] EXACT_MATCH"
6634
		"src/Test.java HaxMapxxxx [HaxMapxxxx] EXACT_MATCH"
6685
	);
6635
	);
6686
}
6636
}
6687
public void testBug124624_HashMap_new() throws CoreException {
6637
public void testBug124624_HaMap_CamelCaseSamePartCount() throws CoreException {
6688
	workingCopies = new ICompilationUnit[1];
6638
	setupBug124624();
6689
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6639
	search("HaMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
6690
		"class HashMap {}\n" + 
6691
		"class HtmlMapper {}\n" + 
6692
		"class HashMapEntry {}\n" + 
6693
		"class HatMappage {}\n"
6694
	);
6695
	search("HashMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
6696
	assertSearchResults(
6640
	assertSearchResults(
6697
		"src/Test.java HashMap [HashMap] EXACT_MATCH"
6641
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6642
		"src/Test.java HaxMapxxxx [HaxMapxxxx] EXACT_MATCH"
6698
	);
6643
	);
6699
}
6644
}
6700
/** @deprecated As using a depreciated constant */
6645
public void testBug124624_HashMap_CamelCase() throws CoreException {
6701
public void testBug124624_HashMap_old() throws CoreException {
6646
	setupBug124624();
6702
	workingCopies = new ICompilationUnit[1];
6703
	workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/Test.java",
6704
		"class HashMap {}\n" + 
6705
		"class HtmlMapper {}\n" + 
6706
		"class HashMapEntry {}\n" + 
6707
		"class HatMappage {}\n"
6708
	);
6709
	search("HashMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6647
	search("HashMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6710
	assertSearchResults(
6648
	assertSearchResults(
6711
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6649
		"src/Test.java HashMap [HashMap] EXACT_MATCH\n" + 
6712
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH"
6650
		"src/Test.java HashMapEntry [HashMapEntry] EXACT_MATCH"
6713
	);
6651
	);
6714
}
6652
}
6653
public void testBug124624_HashMap_CamelCaseSamePartCount() throws CoreException {
6654
	setupBug124624();
6655
	search("HashMap", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
6656
	assertSearchResults(
6657
		"src/Test.java HashMap [HashMap] EXACT_MATCH"
6658
	);
6659
}
6715
6660
6716
/**
6661
/**
6717
 * @test Bug 124645: [search] for implementors does not find subclasses of binary classes
6662
 * @test Bug 124645: [search] for implementors does not find subclasses of binary classes
Lines 6906-6928 Link Here
6906
		"}\n"
6851
		"}\n"
6907
	);
6852
	);
6908
}
6853
}
6909
/** @deprecated As using a depreciated constant */
6854
public void testBug130390_CamelCase() throws CoreException {
6910
public void testBug130390() throws CoreException {
6911
	setUpBug130390();
6855
	setUpBug130390();
6912
	search("NuPoEx", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6856
	search("NuPoEx", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6913
	assertSearchResults(
6857
	assertSearchResults(
6914
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6858
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6915
	);
6859
	);
6916
}
6860
}
6917
public void testBug130390_new() throws CoreException {
6861
public void testBug130390_CamelCaseSamePartCount() throws CoreException {
6918
	setUpBug130390();
6862
	setUpBug130390();
6919
	search("NuPoEx", TYPE, DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
6863
	search("NuPoEx", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
6920
	assertSearchResults(
6864
	assertSearchResults(
6921
		"" // no result as prefix match is not set
6865
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6922
	);
6866
	);
6923
}
6867
}
6924
/** @deprecated As using a depreciated constant */
6868
public void testBug130390b_CamelCase() throws CoreException {
6925
public void testBug130390b() throws CoreException {
6926
	setUpBug130390();
6869
	setUpBug130390();
6927
	search("NPE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6870
	search("NPE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH);
6928
	assertSearchResults(
6871
	assertSearchResults(
Lines 6930-7005 Link Here
6930
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6873
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6931
	);
6874
	);
6932
}
6875
}
6933
public void testBug130390b_new() throws CoreException {
6876
public void testBug130390b_CamelCaseSamePartCount() throws CoreException {
6934
	setUpBug130390();
6877
	setUpBug130390();
6935
	search("NPE", TYPE, DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH);
6878
	search("NPE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
6936
	assertSearchResults(
6879
	assertSearchResults(
6937
		"src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH\n" +
6938
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6880
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6939
	);
6881
	);
6940
}
6882
}
6941
/** @deprecated As using a depreciated constant */
6883
public void testBug130390c_CamelCase() throws CoreException {
6942
public void testBug130390c() throws CoreException {
6943
	setUpBug130390();
6884
	setUpBug130390();
6944
	search("NPE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
6885
	search("NPE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
6945
	assertSearchResults(
6886
	assertSearchResults(
6946
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6887
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6947
	);
6888
	);
6948
}
6889
}
6949
public void testBug130390c_new() throws CoreException {
6890
public void testBug130390c_CamelCaseSamePartCount() throws CoreException {
6950
	setUpBug130390();
6891
	setUpBug130390();
6951
	search("NPE", TYPE, DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
6892
	search("NPE", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH | SearchPattern.R_CASE_SENSITIVE);
6952
	assertSearchResults(
6893
	assertSearchResults(
6953
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6894
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6954
	);
6895
	);
6955
}
6896
}
6956
/** @deprecated As using a depreciated constant */
6897
public void testBug130390d_CamelCase() throws CoreException {
6957
public void testBug130390d() throws CoreException {
6958
	setUpBug130390();
6898
	setUpBug130390();
6959
	search("Npe", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
6899
	search("Npe", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
6960
	assertSearchResults(
6900
	assertSearchResults(
6961
		"src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH"
6901
		"src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH"
6962
	);
6902
	);
6963
}
6903
}
6964
public void testBug130390d_new() throws CoreException {
6904
public void testBug130390d_CamelCaseSamePartCount() throws CoreException {
6965
	setUpBug130390();
6905
	setUpBug130390();
6966
	search("Npe", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
6906
	search("Npe", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
6967
	assertSearchResults(
6907
	assertSearchResults(
6968
		"src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH"
6908
		"src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH"
6969
	);
6909
	);
6970
}
6910
}
6971
/** @deprecated As using a depreciated constant */
6911
public void testBug130390e_CamelCase() throws CoreException {
6972
public void testBug130390e() throws CoreException {
6973
	setUpBug130390();
6912
	setUpBug130390();
6974
	search("Npe", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
6913
	search("Npe", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
6975
	assertSearchResults(
6914
	assertSearchResults(
6976
		"src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH"
6915
		"src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH"
6977
	);
6916
	);
6978
}
6917
}
6979
public void testBug130390e_new() throws CoreException {
6918
public void testBug130390e_CamelCaseSamePartCount() throws CoreException {
6980
	setUpBug130390();
6919
	setUpBug130390();
6981
	search("Npe", TYPE, DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
6920
	search("Npe", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH | SearchPattern.R_CASE_SENSITIVE);
6982
	assertSearchResults(
6921
	assertSearchResults(
6983
		"src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH"
6922
		"src/b130390/Npe.java b130390.Npe [Npe] EXACT_MATCH"
6984
	);
6923
	);
6985
}
6924
}
6986
/** @deprecated As using a depreciated constant */
6925
public void testBug130390f_CamelCase() throws CoreException {
6987
public void testBug130390f() throws CoreException {
6988
	setUpBug130390();
6926
	setUpBug130390();
6989
	search("NullPE", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
6927
	search("NullPE", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_MATCH);
6990
	assertSearchResults(
6928
	assertSearchResults(
6991
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6929
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6992
	);
6930
	);
6993
}
6931
}
6994
public void testBug130390f_new() throws CoreException {
6932
public void testBug130390f_CamelCaseSamePartCount() throws CoreException {
6995
	setUpBug130390();
6933
	setUpBug130390();
6996
	search("NullPE", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMEL_CASE_MATCH);
6934
	search("NullPE", TYPE, ALL_OCCURRENCES, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
6997
	assertSearchResults(
6935
	assertSearchResults(
6998
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6936
		"src/b130390/NullPointerException.java b130390.NullPointerException [NullPointerException] EXACT_MATCH"
6999
	);
6937
	);
7000
}
6938
}
7001
/** @deprecated As using a depreciated constant */
6939
public void testBug130390g_CamelCase() throws CoreException {
7002
public void testBug130390g() throws CoreException {
7003
	setUpBug130390();
6940
	setUpBug130390();
7004
	search("TZ", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
6941
	search("TZ", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
7005
	assertSearchResults(
6942
	assertSearchResults(
Lines 7007-7025 Link Here
7007
		"src/b130390/TimeZone.java b130390.TimeZone [TimeZone] EXACT_MATCH"
6944
		"src/b130390/TimeZone.java b130390.TimeZone [TimeZone] EXACT_MATCH"
7008
	);
6945
	);
7009
}
6946
}
7010
public void testBug130390g_new() throws CoreException {
6947
public void testBug130390g_CamelCaseSamePartCount() throws CoreException {
7011
	setUpBug130390();
6948
	setUpBug130390();
7012
	search("TZ", TYPE, DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
6949
	search("TZ", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH | SearchPattern.R_CASE_SENSITIVE);
7013
	assertSearchResults(
6950
	assertSearchResults(
7014
		"src/b130390/TZ.java b130390.TZ [TZ] EXACT_MATCH\n" +
6951
		"src/b130390/TZ.java b130390.TZ [TZ] EXACT_MATCH\n" +
7015
		"src/b130390/TimeZone.java b130390.TimeZone [TimeZone] EXACT_MATCH"
6952
		"src/b130390/TimeZone.java b130390.TimeZone [TimeZone] EXACT_MATCH"
7016
	);
6953
	);
7017
}
6954
}
7018
public void testBug130390h() throws CoreException {
6955
public void testBug130390h_CamelCase() throws CoreException {
7019
	setUpBug130390();
6956
	setUpBug130390();
7020
	search("TiZo", TYPE, DECLARATIONS, SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
6957
	search("TiZo", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
7021
	assertSearchResults(
6958
	assertSearchResults(
7022
		"" // no result as prefix match is not set
6959
		"src/b130390/TimeZone.java b130390.TimeZone [TimeZone] EXACT_MATCH"
6960
	);
6961
}
6962
public void testBug130390h_CamelCaseSamePartCount() throws CoreException {
6963
	setUpBug130390();
6964
	search("TiZo", TYPE, DECLARATIONS, SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH | SearchPattern.R_CASE_SENSITIVE);
6965
	assertSearchResults(
6966
		"src/b130390/TimeZone.java b130390.TimeZone [TimeZone] EXACT_MATCH"
7023
	);
6967
	);
7024
}
6968
}
7025
6969
Lines 7029-7037 Link Here
7029
 *
6973
 *
7030
 * @bug 137087: Open Type - missing matches when using mixed case pattern
6974
 * @bug 137087: Open Type - missing matches when using mixed case pattern
7031
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=137087"
6975
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=137087"
7032
 * @deprecated As using a depreciated constant
7033
 */
6976
 */
7034
public void testBug137087() throws CoreException {
6977
public void testBug137087_CamelCase() throws CoreException {
7035
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
6978
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7036
	String pattern = "runtimeEx";
6979
	String pattern = "runtimeEx";
7037
	search(pattern, TYPE, DECLARATIONS, matchRule);
6980
	search(pattern, TYPE, DECLARATIONS, matchRule);
Lines 7039-7046 Link Here
7039
		""+ getExternalJCLPathString("1.5") + " java.lang.RuntimeException EXACT_MATCH"
6982
		""+ getExternalJCLPathString("1.5") + " java.lang.RuntimeException EXACT_MATCH"
7040
	);
6983
	);
7041
}
6984
}
7042
/** @deprecated As using a depreciated constant */
6985
public void testBug137087b_CamelCase() throws CoreException {
7043
public void testBug137087b() throws CoreException {
7044
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
6986
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7045
	String pattern = "Runtimeex";
6987
	String pattern = "Runtimeex";
7046
	search(pattern, TYPE, DECLARATIONS, matchRule);
6988
	search(pattern, TYPE, DECLARATIONS, matchRule);
Lines 7048-7065 Link Here
7048
		""+ getExternalJCLPathString("1.5") + " java.lang.RuntimeException EXACT_MATCH"
6990
		""+ getExternalJCLPathString("1.5") + " java.lang.RuntimeException EXACT_MATCH"
7049
	);
6991
	);
7050
}
6992
}
7051
/** @deprecated As using a depreciated constant */
6993
public void testBug137087c_CamelCase() throws CoreException {
7052
public void testBug137087c() throws CoreException {
7053
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
6994
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7054
	String pattern = "runtimeexception";
6995
	String pattern = "runtimeexception";
7055
	search(pattern, TYPE, DECLARATIONS, matchRule);
6996
	search(pattern, TYPE, DECLARATIONS, matchRule);
7056
	assertSearchResults(
6997
	assertSearchResults(
7057
		"" // no result because it's an invalid camel case pattern which is replaced with 
6998
		""+ getExternalJCLPathString("1.5") + " java.lang.RuntimeException EXACT_MATCH"
7058
			// prefix case sensitive match bu SearchPatter.validateMatchRule(...) (old behavior)
7059
	);
6999
	);
7060
}
7000
}
7061
/** @deprecated As using a depreciated constant */
7001
public void testBug137087d_CamelCase() throws CoreException {
7062
public void testBug137087d() throws CoreException {
7063
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7002
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7064
	String pattern = "Runtimexception";
7003
	String pattern = "Runtimexception";
7065
	search(pattern, TYPE, DECLARATIONS, matchRule);
7004
	search(pattern, TYPE, DECLARATIONS, matchRule);
Lines 7067-7074 Link Here
7067
		"" // no match expected as pattern is missing a 'e'
7006
		"" // no match expected as pattern is missing a 'e'
7068
	);
7007
	);
7069
}
7008
}
7070
/** @deprecated As using a depreciated constant */
7009
public void testBug137087e_CamelCase() throws CoreException {
7071
public void testBug137087e() throws CoreException {
7072
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7010
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7073
	String pattern = "IllegalMSException";
7011
	String pattern = "IllegalMSException";
7074
	search(pattern, TYPE, DECLARATIONS, matchRule);
7012
	search(pattern, TYPE, DECLARATIONS, matchRule);
Lines 7076-7083 Link Here
7076
		""+ getExternalJCLPathString("1.5") + " java.lang.IllegalMonitorStateException EXACT_MATCH"
7014
		""+ getExternalJCLPathString("1.5") + " java.lang.IllegalMonitorStateException EXACT_MATCH"
7077
	);
7015
	);
7078
}
7016
}
7079
/** @deprecated As using a depreciated constant */
7017
public void testBug137087f_CamelCase() throws CoreException {
7080
public void testBug137087f() throws CoreException {
7081
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7018
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7082
	String pattern = "illegalMsExceptionSException";
7019
	String pattern = "illegalMsExceptionSException";
7083
	search(pattern, TYPE, DECLARATIONS, matchRule);
7020
	search(pattern, TYPE, DECLARATIONS, matchRule);
Lines 7085-7102 Link Here
7085
		"" // expected no result as uppercase characters in pattern do not match any camelcase ones in existing types
7022
		"" // expected no result as uppercase characters in pattern do not match any camelcase ones in existing types
7086
	);
7023
	);
7087
}
7024
}
7088
/** @deprecated As using a depreciated constant */
7025
public void testBug137087g_CamelCase() throws CoreException {
7089
public void testBug137087g() throws CoreException {
7090
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7026
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7091
	String pattern = "clonenotsupportedex";
7027
	String pattern = "clonenotsupportedex";
7092
	search(pattern, TYPE, DECLARATIONS, matchRule);
7028
	search(pattern, TYPE, DECLARATIONS, matchRule);
7093
	assertSearchResults(
7029
	assertSearchResults(
7094
		"" // no result because it's an invalid camel case pattern which is replaced with 
7030
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
7095
			// prefix case sensitive match bu SearchPatter.validateMatchRule(...) (old behavior)
7096
	);
7031
	);
7097
}
7032
}
7098
/** @deprecated As using a depreciated constant */
7033
public void testBug137087h_CamelCase() throws CoreException {
7099
public void testBug137087h() throws CoreException {
7100
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7034
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7101
	String pattern = "CloneNotSupportedEx";
7035
	String pattern = "CloneNotSupportedEx";
7102
	search(pattern, TYPE, DECLARATIONS, matchRule);
7036
	search(pattern, TYPE, DECLARATIONS, matchRule);
Lines 7104-7111 Link Here
7104
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
7038
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
7105
	);
7039
	);
7106
}
7040
}
7107
/** @deprecated As using a depreciated constant */
7041
public void testBug137087i_CamelCase() throws CoreException {
7108
public void testBug137087i() throws CoreException {
7109
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7042
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7110
	String pattern = "cloneNotsupportedEx";
7043
	String pattern = "cloneNotsupportedEx";
7111
	search(pattern, TYPE, DECLARATIONS, matchRule);
7044
	search(pattern, TYPE, DECLARATIONS, matchRule);
Lines 7113-7120 Link Here
7113
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
7046
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
7114
	);
7047
	);
7115
}
7048
}
7116
/** @deprecated As using a depreciated constant */
7049
public void testBug137087j_CamelCase() throws CoreException {
7117
public void testBug137087j() throws CoreException {
7118
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7050
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7119
	String pattern = "ClonenotSupportedexc";
7051
	String pattern = "ClonenotSupportedexc";
7120
	search(pattern, TYPE, DECLARATIONS, matchRule);
7052
	search(pattern, TYPE, DECLARATIONS, matchRule);
Lines 7122-7129 Link Here
7122
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
7054
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
7123
	);
7055
	);
7124
}
7056
}
7125
/** @deprecated As using a depreciated constant */
7057
public void testBug137087k_CamelCase() throws CoreException {
7126
public void testBug137087k() throws CoreException {
7127
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7058
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7128
	String pattern = "cloneNotSupportedExcep";
7059
	String pattern = "cloneNotSupportedExcep";
7129
	search(pattern, TYPE, DECLARATIONS, matchRule);
7060
	search(pattern, TYPE, DECLARATIONS, matchRule);
Lines 7131-7138 Link Here
7131
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
7062
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
7132
	);
7063
	);
7133
}
7064
}
7134
/** @deprecated As using a depreciated constant */
7065
public void testBug137087l_CamelCase() throws CoreException {
7135
public void testBug137087l() throws CoreException {
7136
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7066
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7137
	String pattern = "Clonenotsupportedexception";
7067
	String pattern = "Clonenotsupportedexception";
7138
	search(pattern, TYPE, DECLARATIONS, matchRule);
7068
	search(pattern, TYPE, DECLARATIONS, matchRule);
Lines 7140-7147 Link Here
7140
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
7070
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
7141
	);
7071
	);
7142
}
7072
}
7143
/** @deprecated As using a depreciated constant */
7073
public void testBug137087m_CamelCase() throws CoreException {
7144
public void testBug137087m() throws CoreException {
7145
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7074
	int matchRule = SearchPattern.R_CAMELCASE_MATCH;
7146
	String pattern = "CloneNotSupportedException";
7075
	String pattern = "CloneNotSupportedException";
7147
	search(pattern, TYPE, DECLARATIONS, matchRule);
7076
	search(pattern, TYPE, DECLARATIONS, matchRule);
Lines 7149-7154 Link Here
7149
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
7078
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
7150
	);
7079
	);
7151
}
7080
}
7081
// Same tests using SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH
7082
public void testBug137087_CamelCaseSamePartCount() throws CoreException {
7083
	int matchRule = SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH;
7084
	String pattern = "runtimeEx";
7085
	search(pattern, TYPE, DECLARATIONS, matchRule);
7086
	assertSearchResults("");
7087
}
7088
public void testBug137087b_CamelCaseSamePartCount() throws CoreException {
7089
	int matchRule = SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH;
7090
	String pattern = "Runtimeex";
7091
	search(pattern, TYPE, DECLARATIONS, matchRule);
7092
	assertSearchResults("");
7093
}
7094
public void testBug137087c_CamelCaseSamePartCount() throws CoreException {
7095
	int matchRule = SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH;
7096
	String pattern = "runtimeexception";
7097
	search(pattern, TYPE, DECLARATIONS, matchRule);
7098
	assertSearchResults(
7099
		""+ getExternalJCLPathString("1.5") + " java.lang.RuntimeException EXACT_MATCH"
7100
	);
7101
}
7102
public void testBug137087d_CamelCaseSamePartCount() throws CoreException {
7103
	int matchRule = SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH;
7104
	String pattern = "Runtimexception";
7105
	search(pattern, TYPE, DECLARATIONS, matchRule);
7106
	assertSearchResults(
7107
		"" // no match expected as pattern is missing a 'e'
7108
	);
7109
}
7110
public void testBug137087e_CamelCaseSamePartCount() throws CoreException {
7111
	int matchRule = SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH;
7112
	String pattern = "IllegalMSException";
7113
	search(pattern, TYPE, DECLARATIONS, matchRule);
7114
	assertSearchResults(
7115
		""+ getExternalJCLPathString("1.5") + " java.lang.IllegalMonitorStateException EXACT_MATCH"
7116
	);
7117
}
7118
public void testBug137087f_CamelCaseSamePartCount() throws CoreException {
7119
	int matchRule = SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH;
7120
	String pattern = "illegalMsExceptionSException";
7121
	search(pattern, TYPE, DECLARATIONS, matchRule);
7122
	assertSearchResults(
7123
		"" // expected no result as uppercase characters in pattern do not match any camelcase ones in existing types
7124
	);
7125
}
7126
public void testBug137087g_CamelCaseSamePartCount() throws CoreException {
7127
	int matchRule = SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH;
7128
	String pattern = "clonenotsupportedex";
7129
	search(pattern, TYPE, DECLARATIONS, matchRule);
7130
	assertSearchResults(
7131
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
7132
	);
7133
}
7134
public void testBug137087h_CamelCaseSamePartCount() throws CoreException {
7135
	int matchRule = SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH;
7136
	String pattern = "CloneNotSupportedEx";
7137
	search(pattern, TYPE, DECLARATIONS, matchRule);
7138
	assertSearchResults(
7139
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
7140
	);
7141
}
7142
public void testBug137087i_CamelCaseSamePartCount() throws CoreException {
7143
	int matchRule = SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH;
7144
	String pattern = "cloneNotsupportedEx";
7145
	search(pattern, TYPE, DECLARATIONS, matchRule);
7146
	assertSearchResults("");
7147
}
7148
public void testBug137087j_CamelCaseSamePartCount() throws CoreException {
7149
	int matchRule = SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH;
7150
	String pattern = "ClonenotSupportedexc";
7151
	search(pattern, TYPE, DECLARATIONS, matchRule);
7152
	assertSearchResults("");
7153
}
7154
public void testBug137087k_CamelCaseSamePartCount() throws CoreException {
7155
	int matchRule = SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH;
7156
	String pattern = "cloneNotSupportedExcep";
7157
	search(pattern, TYPE, DECLARATIONS, matchRule);
7158
	assertSearchResults("");
7159
}
7160
public void testBug137087l_CamelCaseSamePartCount() throws CoreException {
7161
	int matchRule = SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH;
7162
	String pattern = "Clonenotsupportedexception";
7163
	search(pattern, TYPE, DECLARATIONS, matchRule);
7164
	assertSearchResults("");
7165
}
7166
public void testBug137087m_CamelCaseSamePartCount() throws CoreException {
7167
	int matchRule = SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH;
7168
	String pattern = "CloneNotSupportedException";
7169
	search(pattern, TYPE, DECLARATIONS, matchRule);
7170
	assertSearchResults(
7171
		""+ getExternalJCLPathString("1.5") + " java.lang.CloneNotSupportedException EXACT_MATCH"
7172
	);
7173
}
7152
7174
7153
/**
7175
/**
7154
 * Bug 137984: [search] Field references not found when type is a qualified member type [regression]
7176
 * Bug 137984: [search] Field references not found when type is a qualified member type [regression]
Lines 8844-8891 Link Here
8844
 * @test Ensure that indexing still works properly after close/restart
8866
 * @test Ensure that indexing still works properly after close/restart
8845
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=201064"
8867
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=201064"
8846
 */
8868
 */
8847
public void testBug201064() throws CoreException {
8869
public void testBug201064a_CamelCase() throws CoreException {
8870
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8871
	searchAllTypeNames("CCase", SearchPattern.R_CAMELCASE_MATCH, collector);
8872
	assertSearchResults(
8873
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8874
		"CamelCaseEntry (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" +
8875
		"CamelCasexxEntry (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" +
8876
		"CatCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8877
		"CatCasexx (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8878
		"CxxCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" +
8879
		"CxxxxCasexx (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
8880
		collector
8881
	);
8882
}
8883
public void testBug201064b_CamelCase() throws CoreException {
8884
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8885
	searchAllTypeNames("CaCase", SearchPattern.R_CAMELCASE_MATCH, collector);
8886
	assertSearchResults(
8887
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8888
		"CamelCaseEntry (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" +
8889
		"CamelCasexxEntry (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" +
8890
		"CatCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8891
		"CatCasexx (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
8892
		collector
8893
	);
8894
}
8895
public void testBug201064c_CamelCase() throws CoreException {
8896
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8897
	searchAllTypeNames("CamelCase", SearchPattern.R_CAMELCASE_MATCH, collector);
8898
	assertSearchResults(
8899
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8900
		"CamelCaseEntry (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" +
8901
		"CamelCasexxEntry (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
8902
		collector
8903
	);
8904
}
8905
public void testBug201064d_CamelCase() throws CoreException {
8906
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8907
	searchAllTypeNames("CC", SearchPattern.R_CAMELCASE_MATCH, collector);
8908
	assertSearchResults(
8909
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8910
		"CamelCaseEntry (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" +
8911
		"CamelCasexxEntry (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" +
8912
		"CatCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8913
		"CatCasexx (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8914
		"CxxCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" +
8915
		"CxxxxCasexx (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
8916
		collector
8917
	);
8918
}
8919
public void testBug201064e_CamelCase() throws CoreException {
8920
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8921
	searchAllTypeNames("CaC", SearchPattern.R_CAMELCASE_MATCH, collector);
8922
	assertSearchResults(
8923
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8924
		"CamelCaseEntry (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" +
8925
		"CamelCasexxEntry (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" +
8926
		"CatCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8927
		"CatCasexx (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
8928
		collector
8929
	);
8930
}
8931
public void testBug201064f_CamelCase() throws CoreException {
8932
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8933
	searchAllTypeNames("CamelC", SearchPattern.R_CAMELCASE_MATCH, collector);
8934
	assertSearchResults(
8935
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8936
		"CamelCaseEntry (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" +
8937
		"CamelCasexxEntry (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
8938
		collector
8939
	);
8940
}
8941
public void testBug201064g_CamelCase() throws CoreException {
8942
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8943
	searchAllTypeNames("CCa", SearchPattern.R_CAMELCASE_MATCH, collector);
8944
	assertSearchResults(
8945
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8946
		"CamelCaseEntry (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" +
8947
		"CamelCasexxEntry (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" +
8948
		"CatCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8949
		"CatCasexx (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8950
		"CxxCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" +
8951
		"CxxxxCasexx (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
8952
		collector
8953
	);
8954
}
8955
public void testBug201064h_CamelCase() throws CoreException {
8956
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8957
	searchAllTypeNames("CaCa", SearchPattern.R_CAMELCASE_MATCH, collector);
8958
	assertSearchResults(
8959
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8960
		"CamelCaseEntry (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" +
8961
		"CamelCasexxEntry (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" +
8962
		"CatCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8963
		"CatCasexx (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
8964
		collector
8965
	);
8966
}
8967
public void testBug201064i_CamelCase() throws CoreException {
8968
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8969
	searchAllTypeNames("CamelCa", SearchPattern.R_CAMELCASE_MATCH, collector);
8970
	assertSearchResults(
8971
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8972
		"CamelCaseEntry (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" +
8973
		"CamelCasexxEntry (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
8974
		collector
8975
	);
8976
}
8977
// Same tests using SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH
8978
public void testBug201064a_CamelCaseSamePartCount() throws CoreException {
8848
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8979
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8849
	searchAllTypeNames("CCase", SearchPattern.R_CAMEL_CASE_MATCH, collector);
8980
	searchAllTypeNames("CCase", SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH, collector);
8850
	assertSearchResults(
8981
	assertSearchResults(
8851
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8982
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8852
		"CatCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8983
		"CatCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8853
		"CxxCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
8984
		"CatCasexx (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8985
		"CxxCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" +
8986
		"CxxxxCasexx (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
8854
		collector
8987
		collector
8855
	);
8988
	);
8856
}
8989
}
8857
public void testBug201064b() throws CoreException {
8990
public void testBug201064b_CamelCaseSamePartCount() throws CoreException {
8858
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8991
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8859
	searchAllTypeNames("CaCase", SearchPattern.R_CAMEL_CASE_MATCH, collector);
8992
	searchAllTypeNames("CaCase", SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH, collector);
8860
	assertSearchResults(
8993
	assertSearchResults(
8861
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8994
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8862
		"CatCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
8995
		"CatCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8996
		"CatCasexx (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
8863
		collector
8997
		collector
8864
	);
8998
	);
8865
}
8999
}
8866
public void testBug201064c() throws CoreException {
9000
public void testBug201064c_CamelCaseSamePartCount() throws CoreException {
8867
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
9001
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8868
	searchAllTypeNames("CamelCase", SearchPattern.R_CAMEL_CASE_MATCH, collector);
9002
	searchAllTypeNames("CamelCase", SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH, collector);
8869
	assertSearchResults(
9003
	assertSearchResults(
8870
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
9004
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
8871
		collector
9005
		collector
8872
	);
9006
	);
8873
}
9007
}
8874
public void testBug201064d() throws CoreException {
9008
public void testBug201064d_CamelCaseSamePartCount() throws CoreException {
8875
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
9009
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8876
	searchAllTypeNames("CC", SearchPattern.R_CAMEL_CASE_MATCH, collector);
9010
	searchAllTypeNames("CC", SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH, collector);
8877
	assertSearchResults(
9011
	assertSearchResults(
8878
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
9012
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8879
		"CatCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
9013
		"CatCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8880
		"CatCasexx (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
9014
		"CatCasexx (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8881
		"CxxCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
9015
		"CxxCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" +
8882
		"CxxxxCasexx (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
9016
		"CxxxxCasexx (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
8883
		collector
9017
		collector
8884
	);
9018
	);
8885
}
9019
}
8886
public void testBug201064e() throws CoreException {
9020
public void testBug201064e_CamelCaseSamePartCount() throws CoreException {
8887
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
9021
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8888
	searchAllTypeNames("CaC", SearchPattern.R_CAMEL_CASE_MATCH, collector);
9022
	searchAllTypeNames("CaC", SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH, collector);
8889
	assertSearchResults(
9023
	assertSearchResults(
8890
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
9024
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
8891
		"CatCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
9025
		"CatCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
Lines 8893-8920 Link Here
8893
		collector
9027
		collector
8894
	);
9028
	);
8895
}
9029
}
8896
public void testBug201064f() throws CoreException {
9030
public void testBug201064f_CamelCaseSamePartCount() throws CoreException {
8897
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
9031
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8898
	searchAllTypeNames("CamelC", SearchPattern.R_CAMEL_CASE_MATCH, collector);
9032
	searchAllTypeNames("CamelC", SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH, collector);
8899
	assertSearchResults(
9033
	assertSearchResults(
8900
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
9034
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
8901
		collector
9035
		collector
8902
	);
9036
	);
8903
}
9037
}
8904
public void testBug201064g() throws CoreException {
9038
public void testBug201064g_CamelCaseSamePartCount() throws CoreException {
8905
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
9039
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8906
	searchAllTypeNames("CCa", SearchPattern.R_CAMEL_CASE_MATCH, collector);
9040
	searchAllTypeNames("CCa", SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH, collector);
8907
	assertSearchResults("", collector);
9041
	assertSearchResults(
9042
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
9043
		"CatCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
9044
		"CatCasexx (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
9045
		"CxxCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" +
9046
		"CxxxxCasexx (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
9047
		collector
9048
	);
8908
}
9049
}
8909
public void testBug201064h() throws CoreException {
9050
public void testBug201064h_CamelCaseSamePartCount() throws CoreException {
8910
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
9051
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8911
	searchAllTypeNames("CaCa", SearchPattern.R_CAMEL_CASE_MATCH, collector);
9052
	searchAllTypeNames("CaCa", SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH, collector);
8912
	assertSearchResults("", collector);
9053
	assertSearchResults(
9054
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
9055
		"CatCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]\n" + 
9056
		"CatCasexx (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
9057
		collector
9058
	);
8913
}
9059
}
8914
public void testBug201064i() throws CoreException {
9060
public void testBug201064i_CamelCaseSamePartCount() throws CoreException {
8915
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
9061
	TypeNameMatchCollector collector = new TypeNameMatchCollector();
8916
	searchAllTypeNames("CamelCa", SearchPattern.R_CAMEL_CASE_MATCH, collector);
9062
	searchAllTypeNames("CamelCa", SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH, collector);
8917
	assertSearchResults("", collector);
9063
	assertSearchResults(
9064
		"CamelCase (not open) [in CamelCase.java [in b201064 [in src [in JavaSearchBugs]]]]",
9065
		collector
9066
	);
8918
}
9067
}
8919
9068
8920
/**
9069
/**
Lines 8928-8943 Link Here
8928
	try {
9077
	try {
8929
		addLibraryEntry(javaProject, new Path("/JavaSearchBugs/b204652.jar"), false/*not exported*/);
9078
		addLibraryEntry(javaProject, new Path("/JavaSearchBugs/b204652.jar"), false/*not exported*/);
8930
		TypeNameMatchCollector collector = new TypeNameMatchCollector();
9079
		TypeNameMatchCollector collector = new TypeNameMatchCollector();
8931
		new SearchEngine().searchAllTypeNames(
9080
		searchAllTypeNames("b204652", null, SearchPattern.R_PREFIX_MATCH, collector);
8932
			"b204652".toCharArray(),
8933
			SearchPattern.R_EXACT_MATCH,
8934
			null,
8935
			SearchPattern.R_PREFIX_MATCH,
8936
			IJavaSearchConstants.TYPE,
8937
			getJavaSearchScope(),
8938
			collector,
8939
			IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
8940
			null);
8941
		IPackageFragment pkg = getPackage("/JavaSearchBugs/b204652.jar/b204652");
9081
		IPackageFragment pkg = getPackage("/JavaSearchBugs/b204652.jar/b204652");
8942
		pkg.open(null);
9082
		pkg.open(null);
8943
		IType result = (IType) collector.matches.get(0);
9083
		IType result = (IType) collector.matches.get(0);
Lines 8946-8950 Link Here
8946
		javaProject.setRawClasspath(originalRawClasspath, null);
9086
		javaProject.setRawClasspath(originalRawClasspath, null);
8947
	}
9087
	}
8948
}
9088
}
8949
8950
}
9089
}
(-)src/org/eclipse/jdt/core/tests/model/SearchTests.java (-27 / +20 lines)
Lines 1022-1036 Link Here
1022
		SearchPattern.R_PATTERN_MATCH | SearchPattern.R_PREFIX_MATCH,
1022
		SearchPattern.R_PATTERN_MATCH | SearchPattern.R_PREFIX_MATCH,
1023
		SearchPattern.R_PREFIX_MATCH);
1023
		SearchPattern.R_PREFIX_MATCH);
1024
}
1024
}
1025
/** @deprecated As using a depreciated constant */
1026
public void testSearchPatternValidMatchRule05() {
1025
public void testSearchPatternValidMatchRule05() {
1027
	assertValidMatchRule("foo",
1026
	assertValidMatchRule("foo",
1028
		SearchPattern.R_CAMELCASE_MATCH,
1027
		SearchPattern.R_CAMELCASE_MATCH,
1029
		SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE);
1028
		SearchPattern.R_PREFIX_MATCH);
1030
}
1029
}
1031
public void testSearchPatternValidMatchRule06() {
1030
public void testSearchPatternValidMatchRule06() {
1032
	assertValidMatchRule("foo",
1031
	assertValidMatchRule("foo",
1033
		SearchPattern.R_CAMEL_CASE_MATCH,
1032
		SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH,
1034
		SearchPattern.R_PREFIX_MATCH);
1033
		SearchPattern.R_PREFIX_MATCH);
1035
}
1034
}
1036
public void testSearchPatternValidMatchRule10() {
1035
public void testSearchPatternValidMatchRule10() {
Lines 1053-1059 Link Here
1053
		SearchPattern.R_PATTERN_MATCH | SearchPattern.R_PREFIX_MATCH,
1052
		SearchPattern.R_PATTERN_MATCH | SearchPattern.R_PREFIX_MATCH,
1054
		SearchPattern.R_PATTERN_MATCH);
1053
		SearchPattern.R_PATTERN_MATCH);
1055
}
1054
}
1056
/** @deprecated As using a depreciated constant */
1057
public void testSearchPatternValidMatchRule14() {
1055
public void testSearchPatternValidMatchRule14() {
1058
	assertValidMatchRule("CP*P",
1056
	assertValidMatchRule("CP*P",
1059
		SearchPattern.R_CAMELCASE_MATCH,
1057
		SearchPattern.R_CAMELCASE_MATCH,
Lines 1061-1162 Link Here
1061
}
1059
}
1062
public void testSearchPatternValidMatchRule15() {
1060
public void testSearchPatternValidMatchRule15() {
1063
	assertValidMatchRule("CP*P",
1061
	assertValidMatchRule("CP*P",
1064
		SearchPattern.R_CAMEL_CASE_MATCH,
1062
		SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH,
1065
		SearchPattern.R_PATTERN_MATCH);
1063
		SearchPattern.R_PATTERN_MATCH);
1066
}
1064
}
1067
/** @deprecated As using a depreciated constant */
1068
public void testSearchPatternValidMatchRule20() {
1065
public void testSearchPatternValidMatchRule20() {
1069
	assertValidMatchRule("NPE", 
1066
	assertValidMatchRule("NPE", 
1070
		SearchPattern.R_CAMELCASE_MATCH);
1067
		SearchPattern.R_CAMELCASE_MATCH);
1071
}
1068
}
1072
/** @deprecated As using a depreciated constant */
1073
public void testSearchPatternValidMatchRule21() {
1069
public void testSearchPatternValidMatchRule21() {
1074
	assertValidMatchRule("NPE",
1070
	assertValidMatchRule("NPE",
1075
		SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE,
1071
		SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE,
1076
		SearchPattern.R_CAMELCASE_MATCH);
1072
		SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
1077
}
1073
}
1078
/** @deprecated As using a depreciated constant */
1079
public void testSearchPatternValidMatchRule22() {
1074
public void testSearchPatternValidMatchRule22() {
1080
	assertValidMatchRule("nPE",
1075
	assertValidMatchRule("nPE",
1081
		SearchPattern.R_CAMELCASE_MATCH);
1076
		SearchPattern.R_CAMELCASE_MATCH);
1082
}
1077
}
1083
/** @deprecated As using a depreciated constant */
1084
public void testSearchPatternValidMatchRule23() {
1078
public void testSearchPatternValidMatchRule23() {
1085
	assertValidMatchRule("NuPoEx", 
1079
	assertValidMatchRule("NuPoEx", 
1086
		SearchPattern.R_CAMELCASE_MATCH);
1080
		SearchPattern.R_CAMELCASE_MATCH);
1087
}
1081
}
1088
/** @deprecated As using a depreciated constant */
1089
public void testSearchPatternValidMatchRule24() {
1082
public void testSearchPatternValidMatchRule24() {
1090
	assertValidMatchRule("oF",
1083
	assertValidMatchRule("oF",
1091
		SearchPattern.R_CAMELCASE_MATCH);
1084
		SearchPattern.R_CAMELCASE_MATCH);
1092
}
1085
}
1093
public void testSearchPatternValidMatchRule30() {
1086
public void testSearchPatternValidMatchRule30() {
1094
	assertValidMatchRule("NPE",
1087
	assertValidMatchRule("NPE",
1095
		SearchPattern.R_CAMEL_CASE_MATCH);
1088
		SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
1096
}
1089
}
1097
public void testSearchPatternValidMatchRule31() {
1090
public void testSearchPatternValidMatchRule31() {
1098
	assertValidMatchRule("NPE",
1091
	assertValidMatchRule("NPE",
1099
		SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH);
1092
		SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH | SearchPattern.R_PREFIX_MATCH,
1093
		SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
1100
}
1094
}
1101
public void testSearchPatternValidMatchRule32() {
1095
public void testSearchPatternValidMatchRule32() {
1102
	assertValidMatchRule("NPE",
1096
	assertValidMatchRule("NPE",
1103
		SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_CASE_SENSITIVE);
1097
		SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH | SearchPattern.R_CASE_SENSITIVE);
1104
}
1098
}
1105
public void testSearchPatternValidMatchRule33() {
1099
public void testSearchPatternValidMatchRule33() {
1106
	assertValidMatchRule("NPE",
1100
	assertValidMatchRule("NPE",
1107
		SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE);
1101
		SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH | SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE,
1102
		SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH | SearchPattern.R_CASE_SENSITIVE);
1108
}
1103
}
1109
public void testSearchPatternValidMatchRule34() {
1104
public void testSearchPatternValidMatchRule34() {
1110
	assertValidMatchRule("nPE",
1105
	assertValidMatchRule("nPE",
1111
		SearchPattern.R_CAMEL_CASE_MATCH);
1106
		SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
1112
}
1107
}
1113
public void testSearchPatternValidMatchRule35() {
1108
public void testSearchPatternValidMatchRule35() {
1114
	assertValidMatchRule("NuPoEx", 
1109
	assertValidMatchRule("NuPoEx", 
1115
		SearchPattern.R_CAMEL_CASE_MATCH);
1110
		SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
1116
}
1111
}
1117
public void testSearchPatternValidMatchRule36() {
1112
public void testSearchPatternValidMatchRule36() {
1118
	assertValidMatchRule("oF",
1113
	assertValidMatchRule("oF",
1119
		SearchPattern.R_CAMEL_CASE_MATCH);
1114
		SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
1120
}
1115
}
1121
/** @deprecated As using a depreciated constant */
1122
public void testSearchPatternValidMatchRule40() {
1116
public void testSearchPatternValidMatchRule40() {
1123
	assertValidMatchRule("Nu/Po/Ex",
1117
	assertValidMatchRule("Nu/Po/Ex",
1124
		SearchPattern.R_CAMELCASE_MATCH,
1118
		SearchPattern.R_CAMELCASE_MATCH,
1125
		SearchPattern.R_PREFIX_MATCH | SearchPattern.R_CASE_SENSITIVE);
1119
		SearchPattern.R_PREFIX_MATCH);
1126
}
1120
}
1127
/** @deprecated As using a depreciated constant */
1128
public void testSearchPatternValidMatchRule41() {
1121
public void testSearchPatternValidMatchRule41() {
1129
	assertValidMatchRule("Nu.Po.Ex",
1122
	assertValidMatchRule("Nu.Po.Ex",
1130
		SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH,
1123
		SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_PREFIX_MATCH,
1131
		SearchPattern.R_PREFIX_MATCH);
1124
		SearchPattern.R_PREFIX_MATCH);
1132
}
1125
}
1133
/** @deprecated As using a depreciated constant */
1134
public void testSearchPatternValidMatchRule42() {
1126
public void testSearchPatternValidMatchRule42() {
1135
	assertValidMatchRule("hashMap",
1127
	assertValidMatchRule("hashMap",
1136
		SearchPattern.R_CAMELCASE_MATCH);
1128
		SearchPattern.R_CAMELCASE_MATCH);
1137
}
1129
}
1138
/** @deprecated As using a depreciated constant */
1139
public void testSearchPatternValidMatchRule43() {
1130
public void testSearchPatternValidMatchRule43() {
1140
	assertValidMatchRule("Hashmap",
1131
	assertValidMatchRule("Hashmap",
1132
		SearchPattern.R_CAMELCASE_MATCH,
1141
		SearchPattern.R_CAMELCASE_MATCH);
1133
		SearchPattern.R_CAMELCASE_MATCH);
1142
}
1134
}
1143
public void testSearchPatternValidMatchRule44() {
1135
public void testSearchPatternValidMatchRule44() {
1144
	assertValidMatchRule("Nu/Po/Ex",
1136
	assertValidMatchRule("Nu/Po/Ex",
1145
		SearchPattern.R_CAMEL_CASE_MATCH,
1137
		SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH,
1146
		SearchPattern.R_PREFIX_MATCH);
1138
		SearchPattern.R_PREFIX_MATCH);
1147
}
1139
}
1148
public void testSearchPatternValidMatchRule45() {
1140
public void testSearchPatternValidMatchRule45() {
1149
	assertValidMatchRule("Nu.Po.Ex",
1141
	assertValidMatchRule("Nu.Po.Ex",
1150
		SearchPattern.R_CAMEL_CASE_MATCH | SearchPattern.R_PREFIX_MATCH,
1142
		SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH | SearchPattern.R_PREFIX_MATCH,
1151
		SearchPattern.R_PREFIX_MATCH);
1143
		SearchPattern.R_PREFIX_MATCH);
1152
}
1144
}
1153
public void testSearchPatternValidMatchRule46() {
1145
public void testSearchPatternValidMatchRule46() {
1154
	assertValidMatchRule("hashMap",
1146
	assertValidMatchRule("hashMap",
1155
		SearchPattern.R_CAMEL_CASE_MATCH);
1147
		SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
1156
}
1148
}
1157
public void testSearchPatternValidMatchRule47() {
1149
public void testSearchPatternValidMatchRule47() {
1158
	assertValidMatchRule("Hashmap",
1150
	assertValidMatchRule("Hashmap",
1159
		SearchPattern.R_CAMEL_CASE_MATCH);
1151
		SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH,
1152
		SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH);
1160
}
1153
}
1161
1154
1162
/**
1155
/**
(-)src/org/eclipse/jdt/core/tests/model/AbstractJavaSearchTests.java (-2 / +5 lines)
Lines 659-668 Link Here
659
		);
659
		);
660
	}
660
	}
661
	protected void searchAllTypeNames(String pattern, int matchRule, TypeNameMatchCollector collector) throws JavaModelException {
661
	protected void searchAllTypeNames(String pattern, int matchRule, TypeNameMatchCollector collector) throws JavaModelException {
662
		searchAllTypeNames(null, pattern, matchRule, collector);
663
	}
664
	protected void searchAllTypeNames(String packagePattern, String typePattern, int matchRule, TypeNameMatchCollector collector) throws JavaModelException {
662
		new SearchEngine(this.workingCopies).searchAllTypeNames(
665
		new SearchEngine(this.workingCopies).searchAllTypeNames(
663
			null,
666
			packagePattern==null ? null : packagePattern.toCharArray(),
664
			SearchPattern.R_EXACT_MATCH,
667
			SearchPattern.R_EXACT_MATCH,
665
			pattern.toCharArray(),
668
			typePattern==null ? null : typePattern.toCharArray(),
666
			matchRule,
669
			matchRule,
667
			TYPE,
670
			TYPE,
668
			getJavaSearchScope(),
671
			getJavaSearchScope(),
(-)src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java (-8 / +6 lines)
Lines 923-929 Link Here
923
 * @bug 199392: [search] Type Dialog Error 'Items filtering ... Reason: Class file name must end with .class'
923
 * @bug 199392: [search] Type Dialog Error 'Items filtering ... Reason: Class file name must end with .class'
924
 * @test Ensure that types are found even in project which name ends either with ".jar" or ".zip"
924
 * @test Ensure that types are found even in project which name ends either with ".jar" or ".zip"
925
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=199392"
925
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=199392"
926
 * @deprecated As using a depreciated constant
927
 */
926
 */
928
public void testBug199392_Jar() throws CoreException {
927
public void testBug199392_Jar() throws CoreException {
929
	try {
928
	try {
Lines 961-967 Link Here
961
		deleteProject("Test.jar");
960
		deleteProject("Test.jar");
962
	}
961
	}
963
}
962
}
964
public void testBug199392_Jar_new() throws CoreException {
963
public void testBug199392_Jar_SamePartCount() throws CoreException {
965
	try {
964
	try {
966
		IJavaProject project = createJavaProject("Test.jar");
965
		IJavaProject project = createJavaProject("Test.jar");
967
		createFolder("/Test.jar/test");
966
		createFolder("/Test.jar/test");
Lines 983-1003 Link Here
983
			null,
982
			null,
984
			SearchPattern.R_EXACT_MATCH,
983
			SearchPattern.R_EXACT_MATCH,
985
			new char[] { 'M', 'y' },
984
			new char[] { 'M', 'y' },
986
			SearchPattern.R_CAMEL_CASE_MATCH,
985
			SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH,
987
			IJavaSearchConstants.TYPE,
986
			IJavaSearchConstants.TYPE,
988
			scope,
987
			scope,
989
			collector,
988
			collector,
990
			IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
989
			IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
991
			null);
990
			null);
992
		assertEquals("Found types sounds not to be correct", 
991
		assertEquals("Found types sounds not to be correct", 
993
			"", // no result as prefix match is not set
992
			"",
994
			collector.toString()
993
			collector.toString()
995
		);
994
		);
996
	} finally {
995
	} finally {
997
		deleteProject("Test.jar");
996
		deleteProject("Test.jar");
998
	}
997
	}
999
}
998
}
1000
/** @deprecated As using a depreciated constant */
1001
public void testBug199392_Zip() throws CoreException {
999
public void testBug199392_Zip() throws CoreException {
1002
	try {
1000
	try {
1003
		IJavaProject project = createJavaProject("Test.zip");
1001
		IJavaProject project = createJavaProject("Test.zip");
Lines 1034-1040 Link Here
1034
		deleteProject("Test.zip");
1032
		deleteProject("Test.zip");
1035
	}
1033
	}
1036
}
1034
}
1037
public void testBug199392_Zip_new() throws CoreException {
1035
public void testBug199392_Zip_SamePartCount() throws CoreException {
1038
	try {
1036
	try {
1039
		IJavaProject project = createJavaProject("Test.zip");
1037
		IJavaProject project = createJavaProject("Test.zip");
1040
		createFolder("/Test.zip/test");
1038
		createFolder("/Test.zip/test");
Lines 1056-1069 Link Here
1056
			null,
1054
			null,
1057
			SearchPattern.R_EXACT_MATCH,
1055
			SearchPattern.R_EXACT_MATCH,
1058
			new char[] { 'M', 'y' },
1056
			new char[] { 'M', 'y' },
1059
			SearchPattern.R_CAMEL_CASE_MATCH,
1057
			SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH,
1060
			IJavaSearchConstants.TYPE,
1058
			IJavaSearchConstants.TYPE,
1061
			scope,
1059
			scope,
1062
			collector,
1060
			collector,
1063
			IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
1061
			IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
1064
			null);
1062
			null);
1065
		assertEquals("Found types sounds not to be correct", 
1063
		assertEquals("Found types sounds not to be correct", 
1066
			"", // no result as prefix match is not set
1064
			"",
1067
			collector.toString()
1065
			collector.toString()
1068
		);
1066
		);
1069
	} finally {
1067
	} finally {
(-)src/org/eclipse/jdt/core/tests/compiler/regression/UtilTest.java (-63 / +63 lines)
Lines 37-43 Link Here
37
 * If result is invalid then store warning in buffer and display it.
37
 * If result is invalid then store warning in buffer and display it.
38
 */
38
 */
39
void assertCamelCase(String pattern, String name, boolean match) {
39
void assertCamelCase(String pattern, String name, boolean match) {
40
	assertCamelCase(pattern, name, true /*prefix match*/, match);
40
	assertCamelCase(pattern, name, false /* name may have more parts*/, match);
41
}
41
}
42
/**
42
/**
43
 * Assert that a pattern and a name matches or not.
43
 * Assert that a pattern and a name matches or not.
Lines 619-673 Link Here
619
619
620
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=109695
620
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=109695
621
public void test70() throws CoreException {
621
public void test70() throws CoreException {
622
	assertCamelCase("IDE3", "IDocumentExtension", false /*no prefix match*/, false /* should not match */);
622
	assertCamelCase("IDE3", "IDocumentExtension", true /*same part count*/, false /* should not match */);
623
	assertCamelCase("IDE3", "IDocumentExtension2", false /*no prefix match*/, false /* should not match */);
623
	assertCamelCase("IDE3", "IDocumentExtension2", true /*same part count*/, false /* should not match */);
624
	assertCamelCase("IDE3", "IDocumentExtension3", false /*no prefix match*/, true /* should match */);
624
	assertCamelCase("IDE3", "IDocumentExtension3", true /*same part count*/, true /* should match */);
625
	assertCamelCase("IDE3", "IDocumentExtension135", false /*no prefix match*/, true /* should match */);
625
	assertCamelCase("IDE3", "IDocumentExtension135", true /*same part count*/, true /* should match */);
626
	assertCamelCase("IDE3", "IDocumentExtension315", false /*no prefix match*/, true /* should match */);
626
	assertCamelCase("IDE3", "IDocumentExtension315", true /*same part count*/, true /* should match */);
627
	assertCamelCase("IDPE3", "IDocumentProviderExtension", false /*no prefix match*/, false /* should not match */);
627
	assertCamelCase("IDPE3", "IDocumentProviderExtension", true /*same part count*/, false /* should not match */);
628
	assertCamelCase("IDPE3", "IDocumentProviderExtension2", false /*no prefix match*/, false /* should not match */);
628
	assertCamelCase("IDPE3", "IDocumentProviderExtension2", true /*same part count*/, false /* should not match */);
629
	assertCamelCase("IDPE3", "IDocumentProviderExtension4", false /*no prefix match*/, false /* should not match */);
629
	assertCamelCase("IDPE3", "IDocumentProviderExtension4", true /*same part count*/, false /* should not match */);
630
	assertCamelCase("IDPE3", "IDocumentProviderExtension3", false /*no prefix match*/, true /* should match */);
630
	assertCamelCase("IDPE3", "IDocumentProviderExtension3", true /*same part count*/, true /* should match */);
631
	assertCamelCase("IDPE3", "IDocumentProviderExtension5", false /*no prefix match*/, false /* should not match */);
631
	assertCamelCase("IDPE3", "IDocumentProviderExtension5", true /*same part count*/, false /* should not match */);
632
	assertCamelCase("IDPE3", "IDocumentProviderExtension54321", false /*no prefix match*/, true /* should match */);
632
	assertCamelCase("IDPE3", "IDocumentProviderExtension54321", true /*same part count*/, true /* should match */);
633
	assertCamelCase("IDPE3", "IDocumentProviderExtension12345", false /*no prefix match*/, true /* should match */);
633
	assertCamelCase("IDPE3", "IDocumentProviderExtension12345", true /*same part count*/, true /* should match */);
634
	assertCamelCase("IPL3", "IPerspectiveListener", false /*no prefix match*/, false /* should not match */);
634
	assertCamelCase("IPL3", "IPerspectiveListener", true /*same part count*/, false /* should not match */);
635
	assertCamelCase("IPL3", "IPerspectiveListener2", false /*no prefix match*/, false /* should not match */);
635
	assertCamelCase("IPL3", "IPerspectiveListener2", true /*same part count*/, false /* should not match */);
636
	assertCamelCase("IPL3", "IPerspectiveListener3", false /*no prefix match*/, true /* should match */);
636
	assertCamelCase("IPL3", "IPerspectiveListener3", true /*same part count*/, true /* should match */);
637
	assertCamelCase("IPS2", "IPropertySource", false /*no prefix match*/, false /* should not match */);
637
	assertCamelCase("IPS2", "IPropertySource", true /*same part count*/, false /* should not match */);
638
	assertCamelCase("IPS2", "IPropertySource2", false /*no prefix match*/, true /* should match */);
638
	assertCamelCase("IPS2", "IPropertySource2", true /*same part count*/, true /* should match */);
639
	assertCamelCase("IWWPD2", "IWorkbenchWindowPulldownDelegate", false /*no prefix match*/, false /* should not match */);
639
	assertCamelCase("IWWPD2", "IWorkbenchWindowPulldownDelegate", true /*same part count*/, false /* should not match */);
640
	assertCamelCase("IWWPD2", "IWorkbenchWindowPulldownDelegate2", false /*no prefix match*/, true /* should match */);
640
	assertCamelCase("IWWPD2", "IWorkbenchWindowPulldownDelegate2", true /*same part count*/, true /* should match */);
641
	assertCamelCase("UTF16DSS", "UTF16DocumentScannerSupport", false /*no prefix match*/, true /* should match */);
641
	assertCamelCase("UTF16DSS", "UTF16DocumentScannerSupport", true /*same part count*/, true /* should match */);
642
	assertCamelCase("UTF16DSS", "UTF1DocScannerSupport", false /*no prefix match*/, false /* should not match */);
642
	assertCamelCase("UTF16DSS", "UTF1DocScannerSupport", true /*same part count*/, false /* should not match */);
643
	assertCamelCase("UTF16DSS", "UTF6DocScannerSupport", false /*no prefix match*/, false /* should not match */);
643
	assertCamelCase("UTF16DSS", "UTF6DocScannerSupport", true /*same part count*/, false /* should not match */);
644
	assertCamelCase("UTF16DSS", "UTFDocScannerSupport", false /*no prefix match*/, false /* should not match */);
644
	assertCamelCase("UTF16DSS", "UTFDocScannerSupport", true /*same part count*/, false /* should not match */);
645
	assertCamelCase("UTF1DSS", "UTF16DocumentScannerSupport", false /*no prefix match*/, true /* should match */);
645
	assertCamelCase("UTF1DSS", "UTF16DocumentScannerSupport", true /*same part count*/, true /* should match */);
646
	assertCamelCase("UTF1DSS", "UTF1DocScannerSupport", false /*no prefix match*/, true /* should match */);
646
	assertCamelCase("UTF1DSS", "UTF1DocScannerSupport", true /*same part count*/, true /* should match */);
647
	assertCamelCase("UTF1DSS", "UTF6DocScannerSupport", false /*no prefix match*/, false /* should not match */);
647
	assertCamelCase("UTF1DSS", "UTF6DocScannerSupport", true /*same part count*/, false /* should not match */);
648
	assertCamelCase("UTF1DSS", "UTFDocScannerSupport", false /*no prefix match*/, false /* should not match */);
648
	assertCamelCase("UTF1DSS", "UTFDocScannerSupport", true /*same part count*/, false /* should not match */);
649
	assertCamelCase("UTF6DSS", "UTF16DocumentScannerSupport", false /*no prefix match*/, true /* should match */);
649
	assertCamelCase("UTF6DSS", "UTF16DocumentScannerSupport", true /*same part count*/, true /* should match */);
650
	assertCamelCase("UTF6DSS", "UTF1DocScannerSupport", false /*no prefix match*/, false /* should not match */);
650
	assertCamelCase("UTF6DSS", "UTF1DocScannerSupport", true /*same part count*/, false /* should not match */);
651
	assertCamelCase("UTF6DSS", "UTF6DocScannerSupport", false /*no prefix match*/, true /* should match */);
651
	assertCamelCase("UTF6DSS", "UTF6DocScannerSupport", true /*same part count*/, true /* should match */);
652
	assertCamelCase("UTF6DSS", "UTFDocScannerSupport", false /*no prefix match*/, false /* should not match */);
652
	assertCamelCase("UTF6DSS", "UTFDocScannerSupport", true /*same part count*/, false /* should not match */);
653
	assertCamelCase("UTFDSS", "UTF16DocumentScannerSupport", false /*no prefix match*/, true /* should match */);
653
	assertCamelCase("UTFDSS", "UTF16DocumentScannerSupport", true /*same part count*/, true /* should match */);
654
	assertCamelCase("UTFDSS", "UTF1DocScannerSupport", false /*no prefix match*/, true /* should match */);
654
	assertCamelCase("UTFDSS", "UTF1DocScannerSupport", true /*same part count*/, true /* should match */);
655
	assertCamelCase("UTFDSS", "UTF6DocScannerSupport", false /*no prefix match*/, true /* should match */);
655
	assertCamelCase("UTFDSS", "UTF6DocScannerSupport", true /*same part count*/, true /* should match */);
656
	assertCamelCase("UTFDSS", "UTFDocScannerSupport", false /*no prefix match*/, true /* should match */);
656
	assertCamelCase("UTFDSS", "UTFDocScannerSupport", true /*same part count*/, true /* should match */);
657
	// Verify that there were no unexpected results
657
	// Verify that there were no unexpected results
658
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
658
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
659
}
659
}
660
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=124624
660
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=124624
661
public void test71() {
661
public void test71() {
662
	assertCamelCase("HM", "HashMap", false /*no prefix match*/, true /*should match*/);
662
	assertCamelCase("HM", "HashMap", true /*same count of parts expected*/, true /*should match*/);
663
	assertCamelCase("HM", "HtmlMapper", false /*no prefix match*/, true /*should match*/);
663
	assertCamelCase("HM", "HtmlMapper", true /*same count of parts expected*/, true /*should match*/);
664
	assertCamelCase("HM", "HashMapEntry", false /*no prefix match*/, false /* should not match */);
664
	assertCamelCase("HM", "HashMapEntry", true /*same count of parts expected*/, false /* should not match */);
665
	assertCamelCase("HaM", "HashMap", false /*no prefix match*/, true /* should match */);
665
	assertCamelCase("HaM", "HashMap", true /*same count of parts expected*/, true /* should match */);
666
	assertCamelCase("HaM", "HtmlMapper", false /*no prefix match*/, false /* should not match */);
666
	assertCamelCase("HaM", "HtmlMapper", true /*same count of parts expected*/, false /* should not match */);
667
	assertCamelCase("HaM", "HashMapEntry", false /*no prefix match*/, false /* should not match */);
667
	assertCamelCase("HaM", "HashMapEntry", true /*same count of parts expected*/, false /* should not match */);
668
	assertCamelCase("HashM", "HashMap", false /*no prefix match*/, true /* should match */);
668
	assertCamelCase("HashM", "HashMap", true /*same count of parts expected*/, true /* should match */);
669
	assertCamelCase("HashM", "HtmlMapper", false /*no prefix match*/, false /* should not match */);
669
	assertCamelCase("HashM", "HtmlMapper", true /*same count of parts expected*/, false /* should not match */);
670
	assertCamelCase("HashM", "HashMapEntry", false /*no prefix match*/, false /* should not match */);
670
	assertCamelCase("HashM", "HashMapEntry", true /*same count of parts expected*/, false /* should not match */);
671
	// Verify that there were no unexpected results
671
	// Verify that there were no unexpected results
672
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
672
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
673
}
673
}
Lines 686-700 Link Here
686
}
686
}
687
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=124624
687
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=124624
688
public void test72() {
688
public void test72() {
689
	assertCamelCase("HMa", "HashMap", false /*no prefix match*/, false /* should not match */);
689
	assertCamelCase("HMa", "HashMap", true /*same count of parts expected*/, true /* should match */);
690
	assertCamelCase("HMa", "HtmlMapper", false /*no prefix match*/, false /* should not match */);
690
	assertCamelCase("HMa", "HtmlMapper", true /*same count of parts expected*/, true /* should match */);
691
	assertCamelCase("HMa", "HashMapEntry", false /*no prefix match*/, false /* should not match */);
691
	assertCamelCase("HMa", "HashMapEntry", true /*same count of parts expected*/, false /* should not match */);
692
	assertCamelCase("HaMa", "HashMap", false /*no prefix match*/, false /* should not match */);
692
	assertCamelCase("HaMa", "HashMap", true /*same count of parts expected*/, true /* should match */);
693
	assertCamelCase("HaMa", "HtmlMapper", false /*no prefix match*/, false /* should not match */);
693
	assertCamelCase("HaMa", "HtmlMapper", true /*same count of parts expected*/, false /* should not match */);
694
	assertCamelCase("HaMa", "HashMapEntry", false /*no prefix match*/, false /* should not match */);
694
	assertCamelCase("HaMa", "HashMapEntry", true /*same count of parts expected*/, false /* should not match */);
695
	assertCamelCase("HashMa", "HashMap", false /*no prefix match*/, false /* should not match */);
695
	assertCamelCase("HashMa", "HashMap", true /*same count of parts expected*/, true /* should match */);
696
	assertCamelCase("HashMa", "HtmlMapper", false /*no prefix match*/, false /* should not match */);
696
	assertCamelCase("HashMa", "HtmlMapper", true /*same count of parts expected*/, false /* should not match */);
697
	assertCamelCase("HashMa", "HashMapEntry", false /*no prefix match*/, false /* should not match */);
697
	assertCamelCase("HashMa", "HashMapEntry", true /*same count of parts expected*/, false /* should not match */);
698
	// Verify that there were no unexpected results
698
	// Verify that there were no unexpected results
699
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
699
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
700
}
700
}
Lines 713-727 Link Here
713
}
713
}
714
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=124624
714
// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=124624
715
public void test73() {
715
public void test73() {
716
	assertCamelCase("HMap", "HashMap", false /*no prefix match*/, true /*should match*/);
716
	assertCamelCase("HMap", "HashMap", true /*same count of parts expected*/, true /*should match*/);
717
	assertCamelCase("HMap", "HtmlMapper", false /*no prefix match*/, false /* should not match */);
717
	assertCamelCase("HMap", "HtmlMapper", true /*same count of parts expected*/, true /* should not match */);
718
	assertCamelCase("HMap", "HashMapEntry", false /*no prefix match*/, false /* should not match */);
718
	assertCamelCase("HMap", "HashMapEntry", true /*same count of parts expected*/, false /* should not match */);
719
	assertCamelCase("HaMap", "HashMap", false /*no prefix match*/, true /* should match */);
719
	assertCamelCase("HaMap", "HashMap", true /*same count of parts expected*/, true /* should match */);
720
	assertCamelCase("HaMap", "HtmlMapper", false /*no prefix match*/, false /* should not match */);
720
	assertCamelCase("HaMap", "HtmlMapper", true /*same count of parts expected*/, false /* should not match */);
721
	assertCamelCase("HaMap", "HashMapEntry", false /*no prefix match*/, false /* should not match */);
721
	assertCamelCase("HaMap", "HashMapEntry", true /*same count of parts expected*/, false /* should not match */);
722
	assertCamelCase("HashMap", "HashMap", false /*no prefix match*/, true /* should match */);
722
	assertCamelCase("HashMap", "HashMap", true /*same count of parts expected*/, true /* should match */);
723
	assertCamelCase("HashMap", "HtmlMapper", false /*no prefix match*/, false /* should not match */);
723
	assertCamelCase("HashMap", "HtmlMapper", true /*same count of parts expected*/, false /* should not match */);
724
	assertCamelCase("HashMap", "HashMapEntry", false /*no prefix match*/, false /* should not match */);
724
	assertCamelCase("HashMap", "HashMapEntry", true /*same count of parts expected*/, false /* should not match */);
725
	// Verify that there were no unexpected results
725
	// Verify that there were no unexpected results
726
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
726
    assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0);
727
}
727
}

Return to bug 201426