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

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/BinaryMethod.java (-2 / +61 lines)
Lines 25-31 Link Here
25
 */
25
 */
26
26
27
/* package */ class BinaryMethod extends BinaryMember implements IMethod {
27
/* package */ class BinaryMethod extends BinaryMember implements IMethod {
28
29
	/**
28
	/**
30
	 * The parameter type signatures of the method - stored locally
29
	 * The parameter type signatures of the method - stored locally
31
	 * to perform equality test. <code>null</code> indicates no
30
	 * to perform equality test. <code>null</code> indicates no
Lines 243-249 Link Here
243
							javadocContents.substring(indexOfOpenParen + 1, indexOfClosingParen).toCharArray(),
242
							javadocContents.substring(indexOfOpenParen + 1, indexOfClosingParen).toCharArray(),
244
							"&nbsp;".toCharArray(), //$NON-NLS-1$
243
							"&nbsp;".toCharArray(), //$NON-NLS-1$
245
							new char[] {' '});
244
							new char[] {' '});
246
					final char[][] params = CharOperation.splitOn(',', paramsSource);
245
					final char[][] params = splitParameters(paramsSource, paramCount);
247
					final int paramsLength = params.length;
246
					final int paramsLength = params.length;
248
					this.parameterNames = new String[paramsLength];
247
					this.parameterNames = new String[paramsLength];
249
					for (int i = 0; i < paramsLength; i++) {
248
					for (int i = 0; i < paramsLength; i++) {
Lines 263-268 Link Here
263
	// if still no parameter names, produce fake ones
262
	// if still no parameter names, produce fake ones
264
	return this.parameterNames = getRawParameterNames(paramCount);
263
	return this.parameterNames = getRawParameterNames(paramCount);
265
}
264
}
265
private char[][] splitParameters(char[] parametersSource, int paramCount) {
266
	// we have generic types as one of the parameter types
267
	char[][] params = new char[paramCount][];
268
	int paramIndex = 0;
269
	int index = 0;
270
	int balance = 0;
271
	int length = parametersSource.length;
272
	int start = 0;
273
	while(index < length) {
274
		switch (parametersSource[index]) {
275
			case '<':
276
				balance++;
277
				index++;
278
				while(index < length && parametersSource[index] != '>') {
279
					index++;
280
				}
281
				break;
282
			case '>' :
283
				balance--;
284
				index++;
285
				break;
286
			case ',' :
287
				if (balance == 0 && paramIndex < paramCount) {
288
					params[paramIndex++] = CharOperation.subarray(parametersSource, start, index);
289
					start = index + 1;
290
				}
291
				index++;
292
				break;
293
			case '&' :
294
				if ((index + 4) < length) {
295
					if (parametersSource[index + 1] == 'l'
296
							&& parametersSource[index + 2] == 't'
297
							&& parametersSource[index + 3] == ';') {
298
						balance++;
299
						index += 4;
300
					} else if (parametersSource[index + 1] == 'g'
301
							&& parametersSource[index + 2] == 't'
302
							&& parametersSource[index + 3] == ';') {
303
						balance--;
304
						index += 4;
305
					} else {
306
						index++;
307
					}
308
				} else {
309
					index++;
310
				}
311
				break;
312
			default:
313
				index++;
314
		}
315
	}
316
	if (paramIndex < paramCount) {
317
		params[paramIndex++] = CharOperation.subarray(parametersSource, start, index);
318
	}
319
	if (paramIndex != paramCount) {
320
		// happens only for constructors with synthetic enclosing type in the signature
321
		System.arraycopy(params, 0, (params = new char[paramIndex][]), 0, paramIndex);
322
	}
323
	return params;
324
}
266
/*
325
/*
267
 * @see IMethod
326
 * @see IMethod
268
 */
327
 */

Return to bug 138672