### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java,v retrieving revision 1.121 diff -u -r1.121 BinaryTypeBinding.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 17 Aug 2009 16:14:46 -0000 1.121 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java 10 Sep 2009 14:10:49 -0000 @@ -302,7 +302,9 @@ char[] methodDescriptor = binaryType.getEnclosingMethod(); if (methodDescriptor != null) { MethodBinding enclosingMethod = findMethod(methodDescriptor, missingTypeNames); - typeVars = enclosingMethod.typeVariables; + if (enclosingMethod != null) { + typeVars = enclosingMethod.typeVariables; + } } // attempt to find the superclass if it exists in the cache (otherwise - resolve it when requested) @@ -681,6 +683,7 @@ TypeBinding[] parameters = Binding.NO_PARAMETERS; int numOfParams = 0; char nextChar; + int paramStart = index; while ((nextChar = methodDescriptor[++index]) != ')') { if (nextChar != '[') { numOfParams++; @@ -688,27 +691,41 @@ while ((nextChar = methodDescriptor[++index]) != ';'){/*empty*/} } } - - int startIndex = 0; if (numOfParams > 0) { parameters = new TypeBinding[numOfParams]; - index = 1; - int end = 0; // first character is always '(' so skip it + index = paramStart + 1; + int end = paramStart; // first character is always '(' so skip it for (int i = 0; i < numOfParams; i++) { while ((nextChar = methodDescriptor[++end]) == '['){/*empty*/} if (nextChar == 'L') while ((nextChar = methodDescriptor[++end]) != ';'){/*empty*/} - if (i >= startIndex) { // skip the synthetic arg if necessary - parameters[i - startIndex] = this.environment.getTypeFromSignature(methodDescriptor, index, end, false, this, missingTypeNames); + TypeBinding param = this.environment.getTypeFromSignature(methodDescriptor, index, end, false, this, missingTypeNames); + if (param instanceof UnresolvedReferenceBinding) { + param = resolveType(param, this.environment, true /* raw conversion */); } + parameters[i] = param; index = end + 1; } } - return CharOperation.equals(selector, TypeConstants.INIT) - ? this.enclosingType.getExactConstructor(parameters) - : this.enclosingType.getExactMethod(selector, parameters, null); + int parameterLength = parameters.length; + MethodBinding[] methods2 = this.enclosingType.getMethods(selector, parameterLength); + // find matching method using parameters + loop: for (int i = 0, max = methods2.length; i < max; i++) { + MethodBinding currentMethod = methods2[i]; + TypeBinding[] parameters2 = currentMethod.parameters; + int currentMethodParameterLength = parameters2.length; + if (parameterLength == currentMethodParameterLength) { + for (int j = 0; j < currentMethodParameterLength; j++) { + if (parameters[j] != parameters2[j] && parameters[j].erasure() != parameters2[j].erasure()) { + continue loop; + } + } + return currentMethod; + } + } + return null; } /**