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

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/BinaryMethod.java (-2 / +2 lines)
Lines 157-163 Link Here
157
	IType type = (IType) getParent();
157
	IType type = (IType) getParent();
158
	SourceMapper mapper = getSourceMapper();
158
	SourceMapper mapper = getSourceMapper();
159
	if (mapper != null) {
159
	if (mapper != null) {
160
		char[][] paramNames = mapper.getMethodParameterNames(this);
160
		char[][] paramNames = mapper.getMethodParameterNames(this.name, this.parameterTypes);
161
161
162
		// map source and try to find parameter names
162
		// map source and try to find parameter names
163
		if(paramNames == null) {
163
		if(paramNames == null) {
Lines 166-172 Link Here
166
			if (source != null){
166
			if (source != null){
167
				mapper.mapSource(type, source, info);
167
				mapper.mapSource(type, source, info);
168
			}
168
			}
169
			paramNames = mapper.getMethodParameterNames(this);
169
			paramNames = mapper.getMethodParameterNames(this.name, this.parameterTypes);
170
		}
170
		}
171
171
172
		// if parameter names exist, convert parameter names to String array
172
		// if parameter names exist, convert parameter names to String array
(-)model/org/eclipse/jdt/internal/core/SourceMapper.java (+37 lines)
Lines 77-82 Link Here
77
	implements ISourceElementRequestor, SuffixConstants {
77
	implements ISourceElementRequestor, SuffixConstants {
78
78
79
	public static boolean VERBOSE = false;
79
	public static boolean VERBOSE = false;
80
81
	private static char PARAM_TYPE_SEPARATOR = ';';
82
80
	/**
83
	/**
81
	 * Specifies the location of the package fragment roots within
84
	 * Specifies the location of the package fragment roots within
82
	 * the zip (empty specifies the default root). <code>null</code> is
85
	 * the zip (empty specifies the default root). <code>null</code> is
Lines 105-110 Link Here
105
	 * Keys are the method handles, entries are <code>char[][]</code>.
108
	 * Keys are the method handles, entries are <code>char[][]</code>.
106
	 */
109
	 */
107
	protected HashMap parameterNames;
110
	protected HashMap parameterNames;
111
	
112
	/**
113
	 * Table that maps the method details in in String form
114
	 * and method handles. The key is a locally constructed String
115
	 * in the form [methodName];[paramtype1];[paramtype2]
116
	 */
117
	protected HashMap parameterTypesMap;
108
118
109
	/**
119
	/**
110
	 * Table that maps a binary element to its <code>SourceRange</code>s.
120
	 * Table that maps a binary element to its <code>SourceRange</code>s.
Lines 210-215 Link Here
210
		this.sourcePath = sourcePath;
220
		this.sourcePath = sourcePath;
211
		this.sourceRanges = new HashMap();
221
		this.sourceRanges = new HashMap();
212
		this.parameterNames = new HashMap();
222
		this.parameterNames = new HashMap();
223
		this.parameterTypesMap = new HashMap();
213
		this.importsTable = new HashMap();
224
		this.importsTable = new HashMap();
214
		this.importsCounterTable = new HashMap();
225
		this.importsCounterTable = new HashMap();
215
	}
226
	}
Lines 693-698 Link Here
693
	public void enterMethod(MethodInfo methodInfo) {
704
	public void enterMethod(MethodInfo methodInfo) {
694
		enterAbstractMethod(methodInfo);
705
		enterAbstractMethod(methodInfo);
695
	}
706
	}
707
	
708
	/**
709
	 * Returns parameters names for the method with the given name and parameter types.
710
	 * Returns null if no method can be found with the given details or no parameter 
711
	 * names are known for the method.
712
	 */
713
	public char[][] getMethodParameterNames(String name, String[] paramTypes) {
714
		IMethod method = (IMethod)this.parameterTypesMap.get(constructParamTypesString(name, paramTypes));
715
		if (method != null)
716
			return getMethodParameterNames(method);
717
		return null;
718
	}
719
	
720
	private String constructParamTypesString(String methodName, String[] paramTypes){
721
		StringBuffer buffer = new StringBuffer(methodName).append(';');
722
		if (paramTypes != null) {
723
			for (int index=0; index < paramTypes.length; index++) {
724
				buffer.append(paramTypes[index]);
725
				if (index < paramTypes.length)
726
					buffer.append(PARAM_TYPE_SEPARATOR);
727
			}
728
		}
729
		return buffer.toString();
730
	}
696
	private void enterAbstractMethod(MethodInfo methodInfo) {
731
	private void enterAbstractMethod(MethodInfo methodInfo) {
697
		if (this.typeDepth >= 0) {
732
		if (this.typeDepth >= 0) {
698
			this.memberName[this.typeDepth] = new String(methodInfo.name);
733
			this.memberName[this.typeDepth] = new String(methodInfo.name);
Lines 734-739 Link Here
734
					this.memberName[this.typeDepth],
769
					this.memberName[this.typeDepth],
735
					convertTypeNamesToSigs(this.methodParameterTypes[this.typeDepth]));
770
					convertTypeNamesToSigs(this.methodParameterTypes[this.typeDepth]));
736
771
772
			this.parameterTypesMap.put(constructParamTypesString(this.memberName[this.typeDepth], convertTypeNamesToSigs(parameterTypes)), method);
773
737
			// type parameters
774
			// type parameters
738
			if (methodInfo.typeParameters != null) {
775
			if (methodInfo.typeParameters != null) {
739
				for (int i = 0, length = methodInfo.typeParameters.length; i < length; i++) {
776
				for (int i = 0, length = methodInfo.typeParameters.length; i < length; i++) {

Return to bug 316937