### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: model/org/eclipse/jdt/internal/core/BinaryMethod.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java,v retrieving revision 1.88 diff -u -r1.88 BinaryMethod.java --- model/org/eclipse/jdt/internal/core/BinaryMethod.java 26 Apr 2006 14:41:03 -0000 1.88 +++ model/org/eclipse/jdt/internal/core/BinaryMethod.java 27 Apr 2006 15:19:02 -0000 @@ -25,7 +25,6 @@ */ /* package */ class BinaryMethod extends BinaryMember implements IMethod { - /** * The parameter type signatures of the method - stored locally * to perform equality test. null indicates no @@ -243,7 +242,7 @@ javadocContents.substring(indexOfOpenParen + 1, indexOfClosingParen).toCharArray(), " ".toCharArray(), //$NON-NLS-1$ new char[] {' '}); - final char[][] params = CharOperation.splitOn(',', paramsSource); + final char[][] params = splitParameters(paramsSource, paramCount); final int paramsLength = params.length; this.parameterNames = new String[paramsLength]; for (int i = 0; i < paramsLength; i++) { @@ -263,6 +262,66 @@ // if still no parameter names, produce fake ones return this.parameterNames = getRawParameterNames(paramCount); } +private char[][] splitParameters(char[] parametersSource, int paramCount) { + // we have generic types as one of the parameter types + char[][] params = new char[paramCount][]; + int paramIndex = 0; + int index = 0; + int balance = 0; + int length = parametersSource.length; + int start = 0; + while(index < length) { + switch (parametersSource[index]) { + case '<': + balance++; + index++; + while(index < length && parametersSource[index] != '>') { + index++; + } + break; + case '>' : + balance--; + index++; + break; + case ',' : + if (balance == 0 && paramIndex < paramCount) { + params[paramIndex++] = CharOperation.subarray(parametersSource, start, index); + start = index + 1; + } + index++; + break; + case '&' : + if ((index + 4) < length) { + if (parametersSource[index + 1] == 'l' + && parametersSource[index + 2] == 't' + && parametersSource[index + 3] == ';') { + balance++; + index += 4; + } else if (parametersSource[index + 1] == 'g' + && parametersSource[index + 2] == 't' + && parametersSource[index + 3] == ';') { + balance--; + index += 4; + } else { + index++; + } + } else { + index++; + } + break; + default: + index++; + } + } + if (paramIndex < paramCount) { + params[paramIndex++] = CharOperation.subarray(parametersSource, start, index); + } + if (paramIndex != paramCount) { + // happens only for constructors with synthetic enclosing type in the signature + System.arraycopy(params, 0, (params = new char[paramIndex][]), 0, paramIndex); + } + return params; +} /* * @see IMethod */