### 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.105
diff -u -r1.105 BinaryMethod.java
--- model/org/eclipse/jdt/internal/core/BinaryMethod.java 7 Mar 2009 00:58:57 -0000 1.105
+++ model/org/eclipse/jdt/internal/core/BinaryMethod.java 23 Jun 2010 04:44:12 -0000
@@ -157,7 +157,7 @@
IType type = (IType) getParent();
SourceMapper mapper = getSourceMapper();
if (mapper != null) {
- char[][] paramNames = mapper.getMethodParameterNames(this);
+ char[][] paramNames = mapper.getMethodParameterNames(this.name, this.parameterTypes);
// map source and try to find parameter names
if(paramNames == null) {
@@ -166,7 +166,7 @@
if (source != null){
mapper.mapSource(type, source, info);
}
- paramNames = mapper.getMethodParameterNames(this);
+ paramNames = mapper.getMethodParameterNames(this.name, this.parameterTypes);
}
// if parameter names exist, convert parameter names to String array
Index: model/org/eclipse/jdt/internal/core/SourceMapper.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java,v
retrieving revision 1.149
diff -u -r1.149 SourceMapper.java
--- model/org/eclipse/jdt/internal/core/SourceMapper.java 10 Dec 2009 16:00:06 -0000 1.149
+++ model/org/eclipse/jdt/internal/core/SourceMapper.java 23 Jun 2010 04:44:13 -0000
@@ -77,6 +77,9 @@
implements ISourceElementRequestor, SuffixConstants {
public static boolean VERBOSE = false;
+
+ private static char PARAM_TYPE_SEPARATOR = ';';
+
/**
* Specifies the location of the package fragment roots within
* the zip (empty specifies the default root). null
is
@@ -105,6 +108,13 @@
* Keys are the method handles, entries are char[][]
.
*/
protected HashMap parameterNames;
+
+ /**
+ * Table that maps the method details in in String form
+ * and method handles. The key is a locally constructed String
+ * in the form [methodName];[paramtype1];[paramtype2]
+ */
+ protected HashMap parameterTypesMap;
/**
* Table that maps a binary element to its SourceRange
s.
@@ -210,6 +220,7 @@
this.sourcePath = sourcePath;
this.sourceRanges = new HashMap();
this.parameterNames = new HashMap();
+ this.parameterTypesMap = new HashMap();
this.importsTable = new HashMap();
this.importsCounterTable = new HashMap();
}
@@ -693,6 +704,30 @@
public void enterMethod(MethodInfo methodInfo) {
enterAbstractMethod(methodInfo);
}
+
+ /**
+ * Returns parameters names for the method with the given name and parameter types.
+ * Returns null if no method can be found with the given details or no parameter
+ * names are known for the method.
+ */
+ public char[][] getMethodParameterNames(String name, String[] paramTypes) {
+ IMethod method = (IMethod)this.parameterTypesMap.get(constructParamTypesString(name, paramTypes));
+ if (method != null)
+ return getMethodParameterNames(method);
+ return null;
+ }
+
+ private String constructParamTypesString(String methodName, String[] paramTypes){
+ StringBuffer buffer = new StringBuffer(methodName).append(';');
+ if (paramTypes != null) {
+ for (int index=0; index < paramTypes.length; index++) {
+ buffer.append(paramTypes[index]);
+ if (index < paramTypes.length)
+ buffer.append(PARAM_TYPE_SEPARATOR);
+ }
+ }
+ return buffer.toString();
+ }
private void enterAbstractMethod(MethodInfo methodInfo) {
if (this.typeDepth >= 0) {
this.memberName[this.typeDepth] = new String(methodInfo.name);
@@ -734,6 +769,8 @@
this.memberName[this.typeDepth],
convertTypeNamesToSigs(this.methodParameterTypes[this.typeDepth]));
+ this.parameterTypesMap.put(constructParamTypesString(this.memberName[this.typeDepth], convertTypeNamesToSigs(parameterTypes)), method);
+
// type parameters
if (methodInfo.typeParameters != null) {
for (int i = 0, length = methodInfo.typeParameters.length; i < length; i++) {