Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2000, 2009 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2010 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
Lines 436-483
Link Here
|
436 |
// fall thru if its a constructor with a synthetic argument... find it the slower way |
436 |
// fall thru if its a constructor with a synthetic argument... find it the slower way |
437 |
ClassFileReader reader = classFileReader(type); |
437 |
ClassFileReader reader = classFileReader(type); |
438 |
if (reader != null) { |
438 |
if (reader != null) { |
439 |
IBinaryMethod[] methods = reader.getMethods(); |
439 |
// build arguments names |
440 |
if (methods != null) { |
440 |
boolean firstIsSynthetic = false; |
441 |
// build arguments names |
441 |
if (reader.isMember() && method.isConstructor() && !Flags.isStatic(reader.getModifiers())) { // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=48261 |
442 |
boolean firstIsSynthetic = false; |
442 |
firstIsSynthetic = true; |
443 |
if (reader.isMember() && method.isConstructor() && !Flags.isStatic(reader.getModifiers())) { // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=48261 |
443 |
argCount++; |
444 |
firstIsSynthetic = true; |
444 |
} |
445 |
argCount++; |
445 |
char[][] argumentTypeNames = new char[argCount][]; |
446 |
} |
446 |
for (int i = 0; i < argCount; i++) { |
447 |
char[][] argumentTypeNames = new char[argCount][]; |
447 |
char[] typeName = null; |
448 |
for (int i = 0; i < argCount; i++) { |
448 |
if (i == 0 && firstIsSynthetic) { |
449 |
char[] typeName = null; |
449 |
typeName = type.getDeclaringType().getFullyQualifiedName().toCharArray(); |
450 |
if (i == 0 && firstIsSynthetic) { |
450 |
} else if (arguments != null) { |
451 |
typeName = type.getDeclaringType().getFullyQualifiedName().toCharArray(); |
451 |
TypeReference typeRef = arguments[firstIsSynthetic ? i - 1 : i].type; |
452 |
} else if (arguments != null) { |
452 |
typeName = CharOperation.concatWith(typeRef.getTypeName(), '.'); |
453 |
TypeReference typeRef = arguments[firstIsSynthetic ? i - 1 : i].type; |
453 |
for (int k = 0, dim = typeRef.dimensions(); k < dim; k++) |
454 |
typeName = CharOperation.concatWith(typeRef.getTypeName(), '.'); |
454 |
typeName = CharOperation.concat(typeName, new char[] {'[', ']'}); |
455 |
for (int k = 0, dim = typeRef.dimensions(); k < dim; k++) |
455 |
} |
456 |
typeName = CharOperation.concat(typeName, new char[] {'[', ']'}); |
456 |
if (typeName == null) { |
457 |
} |
457 |
// invalid type name |
458 |
if (typeName == null) { |
458 |
return null; |
459 |
// invalid type name |
459 |
} |
460 |
return null; |
460 |
argumentTypeNames[i] = typeName; |
461 |
} |
461 |
} |
462 |
argumentTypeNames[i] = typeName; |
462 |
// return binary method |
463 |
} |
463 |
IMethod binaryMethod = createBinaryMethodHandle(type, method.selector, argumentTypeNames); |
464 |
|
464 |
if (binaryMethod == null) { |
465 |
// return binary method |
465 |
// when first attempt fails, try with similar matches if any... |
466 |
IMethod binaryMethod = createBinaryMethodHandle(type, method.selector, argumentTypeNames); |
466 |
PossibleMatch similarMatch = this.currentPossibleMatch.getSimilarMatch(); |
467 |
if (binaryMethod == null) { |
467 |
while (similarMatch != null) { |
468 |
// when first attempt fails, try with similar matches if any... |
468 |
type = ((ClassFile)similarMatch.openable).getType(); |
469 |
PossibleMatch similarMatch = this.currentPossibleMatch.getSimilarMatch(); |
469 |
binaryMethod = createBinaryMethodHandle(type, method.selector, argumentTypeNames); |
470 |
while (similarMatch != null) { |
470 |
if (binaryMethod != null) { |
471 |
type = ((ClassFile)similarMatch.openable).getType(); |
471 |
return binaryMethod; |
472 |
binaryMethod = createBinaryMethodHandle(type, method.selector, argumentTypeNames); |
|
|
473 |
if (binaryMethod != null) { |
474 |
return binaryMethod; |
475 |
} |
476 |
similarMatch = similarMatch.getSimilarMatch(); |
477 |
} |
472 |
} |
|
|
473 |
similarMatch = similarMatch.getSimilarMatch(); |
478 |
} |
474 |
} |
479 |
return binaryMethod; |
|
|
480 |
} |
475 |
} |
|
|
476 |
return binaryMethod; |
477 |
} |
478 |
if (BasicSearchEngine.VERBOSE) { |
479 |
System.out.println("Not able to createHandle for the method " + //$NON-NLS-1$ |
480 |
CharOperation.charToString(method.selector) + " May miss some results"); //$NON-NLS-1$ |
481 |
} |
481 |
} |
482 |
return null; |
482 |
return null; |
483 |
} |
483 |
} |
Lines 2145-2151
Link Here
|
2145 |
if (enclosingElement == null) { |
2145 |
if (enclosingElement == null) { |
2146 |
enclosingElement = createHandle(method, parent); |
2146 |
enclosingElement = createHandle(method, parent); |
2147 |
} |
2147 |
} |
2148 |
reportMatching(typeParameters, enclosingElement, parent, method.binding, nodeSet); |
2148 |
if (enclosingElement != null) { |
|
|
2149 |
reportMatching(typeParameters, enclosingElement, parent, method.binding, nodeSet); |
2150 |
} |
2149 |
} |
2151 |
} |
2150 |
|
2152 |
|
2151 |
// report annotations |
2153 |
// report annotations |
Lines 2153-2159
Link Here
|
2153 |
if (enclosingElement == null) { |
2155 |
if (enclosingElement == null) { |
2154 |
enclosingElement = createHandle(method, parent); |
2156 |
enclosingElement = createHandle(method, parent); |
2155 |
} |
2157 |
} |
2156 |
reportMatching(method.annotations, enclosingElement, null, method.binding, nodeSet, true, true); |
2158 |
if (enclosingElement != null) { |
|
|
2159 |
reportMatching(method.annotations, enclosingElement, null, method.binding, nodeSet, true, true); |
2160 |
} |
2157 |
} |
2161 |
} |
2158 |
|
2162 |
|
2159 |
// references in this method |
2163 |
// references in this method |