* Creates an IMethod from the given method declaration and type.
*/
protected IJavaElement createHandle(AbstractMethodDeclaration method, IJavaElement parent) {
if (!(parent instanceof IType)) return parent;
IType type = (IType) parent;
Argument[] arguments = method.arguments;
int argCount = arguments == null ? 0 : arguments.length;
if (type.isBinary()) {
// don't cache the methods of the binary type
// fall thru if its a constructor with a synthetic argument... find it the slower way
ClassFileReader reader = classFileReader(type);
if (reader != null) {
IBinaryMethod[] methods = reader.getMethods();
if (methods != null) {
// build arguments names
boolean firstIsSynthetic = false;
if (reader.isMember() && method.isConstructor() && !Flags.isStatic(reader.getModifiers())) { // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=48261
firstIsSynthetic = true;
argCount++;
}
char[][] argumentTypeNames = new char[argCount][];
for (int i = 0; i < argCount; i++) {
char[] typeName = null;
if (i == 0 && firstIsSynthetic) {
typeName = type.getDeclaringType().getFullyQualifiedName().toCharArray();
} else if (arguments != null) {
TypeReference typeRef = arguments[firstIsSynthetic ? i - 1 : i].type;
typeName = CharOperation.concatWith(typeRef.getTypeName(), '.');
for (int k = 0, dim = typeRef.dimensions(); k < dim; k++)
typeName = CharOperation.concat(typeName, new char[] {'[', ']'});