Returns the descriptor corresponding to the given method.

@param m
a {@link Method Method} object.
@return the descriptor of the given method.
180821
public static String getMethodDescriptor(final Method m) {
        Class<?>[] parameters = m.getParameterTypes();
		StringBuilder sb = new StringBuilder();
        sb.append('(');
        for (int i = 0; i < parameters.length; ++i) {
            getDescriptor(sb, parameters[i]);
        }
        sb.append(')');
        getDescriptor(sb, m.getReturnType());
        return sb.toString();
    }
311819
private void printMethodDeclaration(MethodDeclaration m, boolean isCompanionClass) {
    ExecutableElement methodElement = m.getExecutableElement();
    TypeElement typeElement = ElementUtil.getDeclaringClass(methodElement);

    if (typeElement.getKind().isInterface()) {
      // isCompanion and isStatic must be both false (i.e. this prints a non-static method decl
      // in @protocol) or must both be true (i.e. this prints a static method decl in the
      // companion class' @interface).
      if (isCompanionClass != ElementUtil.isStatic(methodElement)) {
        return;
      }
    }

    newline();
    JavadocGenerator.printDocComment(getBuilder(), m.getJavadoc());

    String methodSignature = getMethodSignature(m);

    // In order to properly map the method name from the entire signature, we must isolate it from
    // associated type and parameter declarations.  The method name is guaranteed to be between the
    // first closing parenthesis and first colon (for methods with arguments), or the entirety of
    // the declaration after the first closing parenthesis (for methods with no arguments).
    int identifierStartIndex = methodSignature.indexOf(')') + 1;
    int identifierEndIndex =
        methodSignature.contains(":") ? methodSignature.indexOf(':') : methodSignature.length();
    generatedSourceMappings.addMethodMapping(
        m /* methodDeclaration */,
        getBuilder().length() + identifierStartIndex /* targetBegin */,
        identifierEndIndex - identifierStartIndex /* length */);

    print(methodSignature);

    String methodName = nameTable.getMethodSelector(methodElement);
    if (!m.isConstructor() && NameTable.needsObjcMethodFamilyNoneAttribute(methodName)) {
      // Getting around a clang warning.
      // clang assumes that methods with names starting with new, alloc or copy
      // return objects of the same type as the receiving class, regardless of
      // the actual declared return type. This attribute tells clang to not do
      // that, please.
      // See http://clang.llvm.org/docs/AutomaticReferenceCounting.html
      // Sections 5.1 (Explicit method family control)
      // and 5.2.2 (Related result types)
      print(" OBJC_METHOD_FAMILY_NONE");
    }

    if (needsDeprecatedAttribute(m.getAnnotations())) {
      print(" " + DEPRECATED_ATTRIBUTE);
    }
    if (m.isUnavailable()) {
      print(" NS_UNAVAILABLE");
    }
    println(";");
  }
156634
public static String extractMethodName(final MethodDescriptor<?, ?> method) {
        // This method is the equivalent of MethodDescriptor.extractFullServiceName
        final String fullMethodName = method.getFullMethodName();
        final int index = fullMethodName.lastIndexOf('/');
        if (index == -1) {
            return fullMethodName;
        }
        return fullMethodName.substring(index + 1);
    }
1218990
public JavaMethod getMethod(String name)
  {
    ArrayList<JavaMethod> methodList = getMethodList();
    
    for (int i = 0; i < methodList.size(); i++) {
      JavaMethod method = methodList.get(i);

      if (method.getName().equals(name))
        return method;
    }

    return null;
  }
148525
public String getMethodName(Method method) {
        String name;
        if (ClassUtils.isBooleanGetter(method)) {
            name = extractMethodName(method, 2);
        } else {
            name = extractMethodName(method, 3);
        }
        return name;
    }
542158
public static int getFirstRegisterSlot(Method m) {
        Type[] parms = m.getArgumentTypes();

        int first = m.isStatic() ? 0 : 1;
        for (Type t : parms) {
            first += getSignatureSize(t.getSignature());
        }

        return first;
    }
1200400
public Collection<TypeQualifierValue<?>> getDirectlyRelevantTypeQualifiers(MethodDescriptor m) {
        Collection<TypeQualifierValue<?>> result = methodToDirectlyRelevantQualifiersMap.get(m);
        if (result != null) {
            return result;
        }
        return Collections.<TypeQualifierValue<?>> emptyList();
    }
511071
public static MBeanParameterInfo[] extractParameterInfo(Method m) {
        Class<?>[] types = m.getParameterTypes();
        Annotation[][] annotations = m.getParameterAnnotations();
        MBeanParameterInfo[] params = new MBeanParameterInfo[types.length];
        for(int i = 0; i < params.length; i++) {
            boolean hasAnnotation = false;
            for(int j = 0; j < annotations[i].length; j++) {
                if(annotations[i][j] instanceof JmxParam) {
                    JmxParam param = (JmxParam) annotations[i][j];
                    params[i] = new MBeanParameterInfo(param.name(),
                                                       types[i].getName(),
                                                       param.description());
                    hasAnnotation = true;
                    break;
                }
            }
            if(!hasAnnotation) {
                params[i] = new MBeanParameterInfo("", types[i].getName(), "");
            }
        }

        return params;
    }
409693
private String getMethodArgs(Method m)
    {
        StringBuffer sb = new StringBuffer();
        Class [] argTypes = m.getParameterTypes();
        for (int i = 0; i < argTypes.length; i++)
        {
            if (i != 0) sb.append(",");
            sb.append(argTypes[i].toString());
        }
        return sb.toString();
    }
528691
private Object getGetDescriptorMethodCode() {
        StringBuilder code = new StringBuilder();

        String descriptorClsName = ClassHelper.getInternalName(Descriptor.class.getCanonicalName());
        code.append("public ").append(descriptorClsName);
        code.append(" getDescriptor() throws IOException {").append(LINE_BREAK);
        code.append("if (this.descriptor != null) {").append(LINE_BREAK);
        code.append("return this.descriptor").append(JAVA_LINE_BREAK);
        code.append("}").append(LINE_BREAK);
        code.append(descriptorClsName).append(" descriptor = ");
        code.append("CodedConstant.getDescriptor(").append(ClassHelper.getInternalName(cls.getCanonicalName()))
                .append(JAVA_CLASS_FILE_SUFFIX).append(")").append(JAVA_LINE_BREAK);
        code.append("return (this.descriptor = descriptor)").append(JAVA_LINE_BREAK);
        code.append("}").append(LINE_BREAK);
        return code.toString();
    }
421300
static String getMethodFQN(Method m) {
        return m == null ? null
                         : m.getDeclaringClass().getName() + '.' + m.getName();
    }
805585
public static int getParameterCount(String methodDescriptor) {
		int pos = 1; // after the '('
		int count = 0;
		char ch;
		while ((ch = methodDescriptor.charAt(pos)) != ')') {
			// Either 'L' or '[' or primitive
			if (ch == 'L') {
				// skip to ';'
				pos = methodDescriptor.indexOf(';', pos + 1);
			}
			else if (ch == '[') {
				while (methodDescriptor.charAt(++pos) == '[') {
				}
				if (methodDescriptor.charAt(pos) == 'L') {
					// reference array like [[Ljava/lang/String;
					pos = methodDescriptor.indexOf(';', pos + 1);
				}
			}
			count++;
			pos++;
		}
		return count;
	}
475460
private static String getStatisticsName(Method m)
   {
      StringBuilder sb = new StringBuilder();
      sb.append(m.getName());
      sb.append('(');
      Class<?>[] types = m.getParameterTypes();
      if (types != null)
      {
         boolean first = true;
         for (Class<?> type : types)
         {
            if (first)
            {
               first = false;
            }
            else
            {
               sb.append(", ");
            }
            sb.append(type.getSimpleName());
         }
      }
      sb.append(')');
      return sb.toString();
   }
411089
private static MethodRef getPutMethod(FieldDescriptor descriptor) {
    Preconditions.checkState(descriptor.isMapField());
    List<FieldDescriptor> mapFields = descriptor.getMessageType().getFields();
    TypeInfo builder = builderRuntimeType(descriptor.getContainingType());
    return MethodRef.createInstanceMethod(
        builder,
        new Method(
            "put" + getFieldName(descriptor, true),
            builder.type(),
            new Type[] {getRuntimeType(mapFields.get(0)), getRuntimeType(mapFields.get(1))}));
  }
837551
private static Method getCachedMethod(MethodDescriptor md) {
        if (CACHE_METHODS) {
            Reference<Method> methodRef = cache.get(md);
            if (methodRef != null) {
                return methodRef.get();
            }
        }
        return null;
    }
1285150
public Method getExecutorMethod(MethodMember methodMember) {
		String executorDescriptor;
		String name;

		//What to search for:
		if (methodMember.isConstructor()) {
			name = Constants.mInitializerName;
		}
		else {
			name = methodMember.getName();
		}
		executorDescriptor = getExecutorDescriptor(methodMember);

		//Search for it:
		if (executorClass != null) {
			Method[] executorMethods = executorClass.getDeclaredMethods();
			for (Method executor : executorMethods) {
				if (executor.getName().equals(name) && Type.getMethodDescriptor(executor).equals(executorDescriptor)) {
					return executor;
				}
			}
		}
		return null;
	}
1236304
public MethodDocImpl getMethodDoc(MethodSymbol meth) {
        assert !meth.isConstructor() : "not expecting a constructor symbol";
        MethodDocImpl result = (MethodDocImpl)methodMap.get(meth);
        if (result != null) return result;
        result = new MethodDocImpl(this, meth);
        methodMap.put(meth, result);
        return result;
    }