Lines 390-395
Link Here
|
390 |
return result; |
390 |
return result; |
391 |
} |
391 |
} |
392 |
|
392 |
|
|
|
393 |
private static char[] getTypeName(TypeReference typeReference) { |
394 |
char[] typeName = CharOperation.concatWith(typeReference.getTypeName(), '.'); |
395 |
int dims = typeReference.dimensions(); |
396 |
if (dims > 0) { |
397 |
int length = typeName.length; |
398 |
int newLength = length + (dims*2); |
399 |
System.arraycopy(typeName, 0, typeName = new char[newLength], 0, length); |
400 |
for (int k = length; k < newLength; k += 2) { |
401 |
typeName[k] = '['; |
402 |
typeName[k+1] = ']'; |
403 |
} |
404 |
} |
405 |
|
406 |
return typeName; |
407 |
} |
408 |
|
393 |
private static boolean hasStaticMemberTypes(ReferenceBinding typeBinding, SourceTypeBinding invocationType, CompilationUnitScope unitScope) { |
409 |
private static boolean hasStaticMemberTypes(ReferenceBinding typeBinding, SourceTypeBinding invocationType, CompilationUnitScope unitScope) { |
394 |
ReferenceBinding[] memberTypes = typeBinding.memberTypes(); |
410 |
ReferenceBinding[] memberTypes = typeBinding.memberTypes(); |
395 |
int length = memberTypes == null ? 0 : memberTypes.length; |
411 |
int length = memberTypes == null ? 0 : memberTypes.length; |
Lines 5244-5284
Link Here
|
5244 |
guessedType = ref.resolveType((ClassScope)scope); |
5260 |
guessedType = ref.resolveType((ClassScope)scope); |
5245 |
break; |
5261 |
break; |
5246 |
} |
5262 |
} |
5247 |
} finally { |
5263 |
|
5248 |
this.lookupEnvironment.nameEnvironment = oldNameEnvironment; |
|
|
5249 |
} |
5250 |
|
5264 |
|
5251 |
if (guessedType != null && guessedType.isValidBinding()) { |
5265 |
if (guessedType != null && guessedType.isValidBinding()) { |
5252 |
if (guessedType instanceof SourceTypeBinding) { |
5266 |
if (guessedType instanceof SourceTypeBinding) { |
5253 |
SourceTypeBinding refBinding = (SourceTypeBinding) guessedType; |
5267 |
SourceTypeBinding refBinding = (SourceTypeBinding) guessedType; |
5254 |
|
|
|
5255 |
refBinding.methods(); // force resolution |
5256 |
if (refBinding.scope == null || refBinding.scope.referenceContext == null) return null; |
5257 |
TypeDeclaration typeDeclaration = refBinding.scope.referenceContext; |
5258 |
AbstractMethodDeclaration[] methods = typeDeclaration.methods; |
5259 |
next : for (int i = 0; i < methods.length; i++) { |
5260 |
AbstractMethodDeclaration method = methods[i]; |
5261 |
|
5268 |
|
5262 |
if (method.binding == null || !method.isConstructor()) continue next; |
5269 |
if (refBinding.scope == null || refBinding.scope.referenceContext == null) return null; |
5263 |
|
5270 |
|
5264 |
Argument[] arguments = method.arguments; |
5271 |
TypeDeclaration typeDeclaration = refBinding.scope.referenceContext; |
5265 |
int argumentsLength = arguments == null ? 0 : arguments.length; |
5272 |
AbstractMethodDeclaration[] methods = typeDeclaration.methods; |
5266 |
if (parameterCount != argumentsLength) continue next; |
|
|
5267 |
|
5273 |
|
5268 |
for (int j = 0; j < argumentsLength; j++) { |
5274 |
next : for (int i = 0; i < methods.length; i++) { |
5269 |
if (!CharOperation.equals(CharOperation.concatWith(arguments[j].type.getTypeName(), '.'), parameterTypes[j])) { |
5275 |
AbstractMethodDeclaration method = methods[i]; |
5270 |
continue next; |
5276 |
|
|
|
5277 |
if (!method.isConstructor()) continue next; |
5278 |
|
5279 |
Argument[] arguments = method.arguments; |
5280 |
int argumentsLength = arguments == null ? 0 : arguments.length; |
5281 |
|
5282 |
if (parameterCount != argumentsLength) continue next; |
5283 |
|
5284 |
for (int j = 0; j < argumentsLength; j++) { |
5285 |
char[] argumentTypeName = getTypeName(arguments[j].type); |
5286 |
|
5287 |
if (!CharOperation.equals(argumentTypeName, parameterTypes[j])) { |
5288 |
continue next; |
5289 |
} |
5271 |
} |
5290 |
} |
|
|
5291 |
|
5292 |
refBinding.resolveTypesFor(method.binding); // force resolution |
5293 |
if (method.binding == null) continue next; |
5294 |
return getSignature(method.binding); |
5272 |
} |
5295 |
} |
5273 |
|
|
|
5274 |
return getSignature(method.binding); |
5275 |
} |
5296 |
} |
5276 |
} |
5297 |
} |
|
|
5298 |
} finally { |
5299 |
this.lookupEnvironment.nameEnvironment = oldNameEnvironment; |
5277 |
} |
5300 |
} |
5278 |
|
5301 |
|
5279 |
return null; |
5302 |
return null; |
5280 |
} |
5303 |
} |
5281 |
|
5304 |
|
5282 |
private void findConstructorsOrAnonymousTypes( |
5305 |
private void findConstructorsOrAnonymousTypes( |
5283 |
ReferenceBinding currentType, |
5306 |
ReferenceBinding currentType, |
5284 |
Scope scope, |
5307 |
Scope scope, |
Lines 7066-7073
Link Here
|
7066 |
if(proposeMethod && !insideAnnotationAttribute) { |
7089 |
if(proposeMethod && !insideAnnotationAttribute) { |
7067 |
MethodBinding methodBinding = (MethodBinding)binding; |
7090 |
MethodBinding methodBinding = (MethodBinding)binding; |
7068 |
if ((exactMatch && CharOperation.equals(token, methodBinding.selector)) || |
7091 |
if ((exactMatch && CharOperation.equals(token, methodBinding.selector)) || |
7069 |
!exactMatch && CharOperation.prefixEquals(token, methodBinding.selector)) { |
7092 |
!exactMatch && CharOperation.prefixEquals(token, methodBinding.selector) || |
7070 |
|
7093 |
(this.options.camelCaseMatch && CharOperation.camelCaseMatch(token, methodBinding.selector))) { |
7071 |
findLocalMethodsFromStaticImports( |
7094 |
findLocalMethodsFromStaticImports( |
7072 |
methodBinding.selector, |
7095 |
methodBinding.selector, |
7073 |
methodBinding.declaringClass.methods(), |
7096 |
methodBinding.declaringClass.methods(), |