Create a MethodDoc for this MethodSymbol.
Should be called only on symbols representing methods.
328514
protected void makeMethodDoc(MethodSymbol meth, TreePath treePath) {
        MethodDocImpl result = (MethodDocImpl)methodMap.get(meth);
        if (result != null) {
            if (treePath != null) result.setTreePath(treePath);
        } else {
            result = new MethodDocImpl(this, meth, treePath);
            methodMap.put(meth, result);
        }
    }
842529
public MethodInfo addMethod(Method method) {
        Modifiers modifiers = new Modifiers(method.getModifiers());
        modifiers.setAbstract(this.getModifiers().isInterface());

        TypeVariableDesc[] typeParams = lookupTypeVariables(method);
        TypeDesc ret = TypeDesc.forClass(method.getReturnType(),
                                         method.getGenericReturnType());

        MethodDescriptor methodDescriptor = lookupMethodDescriptor(method);

        Class<?>[] paramClasses = method.getParameterTypes();
        Type[] paramTypes = method.getGenericParameterTypes();
        TypeDesc[] params = new TypeDesc[paramClasses.length];
        String[] paramNames = new String[paramClasses.length];
        for (int i = 0; i < paramClasses.length; i++) {
            params[i] = TypeDesc.forClass(paramClasses[i], paramTypes[i]);
            if(methodDescriptor != null) {
                paramNames[i] =
                    methodDescriptor.getParameterDescriptors()[i].getName();
            } else {
                paramNames[i] = "param$" + i;
            }
        }

        MethodInfo mi = addMethod(modifiers, method.getName(), typeParams,
                                  ret, params, paramNames);

        // exception stuff...
        // TODO: generic exceptions
        Class<?>[] exceptions = method.getExceptionTypes();
        for (int i=0; i<exceptions.length; i++) {
            mi.addException(exceptions[i].getName());
        }

        return mi;
    }
1249590
protected void makeClassDoc(ClassSymbol clazz, TreePath treePath) {
        ClassDocImpl result = classMap.get(clazz);
        if (result != null) {
            if (treePath != null) result.setTreePath(treePath);
            return;
        }
        if (isAnnotationType((JCClassDecl) treePath.getLeaf())) {   // flags of clazz may not yet be set
            result = new AnnotationTypeDocImpl(this, clazz, treePath);
        } else {
            result = new ClassDocImpl(this, clazz, treePath);
        }
        classMap.put(clazz, result);
    }
443678
public static PropertyDoc[] create(RootDoc root,
                                       MethodDoc[] docs) {

        if (docs == null) {
            return null;
        }

        // Vector of the PropertyDocs to be returned by this method
        Vector propertyDocVector = new Vector();

        // HashMap that maps propertyName to PropertyDoc object.  This is
        // used to ensure that a single PropertyDoc instance contains
        // both the "get" and the "set" MethodDoc (if both exist).
        HashMap propertyMap = new HashMap();

        for (int i = 0; i < docs.length; i++) {

            MethodDoc method = docs[i];

            if (!method.isPublic() ||
                method.isStatic() || method.isExcluded()) {
                continue;
            }

            String methodName = method.getName();
            Parameter[] params = method.getParameters();
            Type returnType = method.getReturnType();
            String typeName = returnType.getQualifiedTypeName();
            if (typeName != null) {
                String dimension = returnType.getDimension();
                if (dimension != null && dimension.length() > 0) {
                    typeName += dimension;
                }
            }

            //
            // Look for JavaBeans naming patterns
            //

            String propertyName = null;
            boolean isReadMethod = true;

            if (params == null || (params.length == 0)) {
                // Accepts no params, might be a "get" method

                if (methodName.startsWith("get") && methodName.length() > 3) {

                    propertyName =
                        Introspector.decapitalize(methodName.substring(3));
                }
                else if (methodName.startsWith("is") &&
                         methodName.length() > 2) {

                    if ("boolean".equalsIgnoreCase(typeName)) {
                        propertyName =
                            Introspector.decapitalize(methodName.substring(2));
                    }
                }
            }
            else if (params != null && (params.length == 1)) {
                // Accepts a single param, might be a "set" method

                if (methodName.startsWith("set") && methodName.length() > 3) {

                    propertyName =
                        Introspector.decapitalize(methodName.substring(3));
                    isReadMethod = false;
                }
            }

            if (propertyName == null) {
                // Was neither a "get" nor a "set"
                continue;
            }

            PropertyDoc pd = (PropertyDoc) propertyMap.get(propertyName);
            if (pd != null) {
                MethodDoc readMethod = pd.getReadMethod();
                if (readMethod == null) {
                    pd.setReadMethod(method);
                }
                else {
                    MethodDoc writeMethod = pd.getWriteMethod();
                    if (writeMethod == null) {
                        pd.setWriteMethod(method);
                    }
                }
            }
            else {
                pd = new PropertyDoc(root, method, isReadMethod);
                pd.setName(propertyName);
                propertyMap.put(propertyName, pd);
                propertyDocVector.addElement(pd);
            }

        }

        PropertyDoc[] propertyDocs = new PropertyDoc[propertyDocVector.size()];
        propertyDocVector.copyInto(propertyDocs);

        return propertyDocs;
    }
357640
def create_method(self):
        
        n_indents = 1 if self.target_language in ['java', 'js',
                                                  'php', 'ruby'] else 0
        return self.temp('separated.method', n_indents=n_indents,
                         skipping=True).format(**self.__dict__)
1237562
function addSourceMethods() {
        $methodBindingArray = $this->implementWeaveInfo->getMethodBindingArray();
        $methods = $this->sourceClassReflection->getMethods();
        foreach ($methods as $sourceMethod) {
            
            if ($sourceMethod->getName() === '__construct') {
                continue;
            }
            
            $methodBindingToApply = null;
            foreach ($methodBindingArray as $methodBinding) {
                if ($methodBinding->matchesMethod($sourceMethod->getName()) ) {
                    $methodBindingToApply = $methodBinding;
                    break;
                }
            }

            if ($methodBindingToApply != null) {
                $decoratorMethod = $methodBindingToApply->getMethod();
                $decoratorMethodReflection = $this->decoratorReflection->getMethod($decoratorMethod);
                $this->addDecoratedMethod($sourceMethod, $decoratorMethodReflection);
            }
            else {
                $this->addPlainMethod($sourceMethod);
            }
        }
    }
764691
function _createMethod(definition, method){
        var slice = Array.prototype.slice;
        
        return function(){
            var l = arguments.length, callback, message = {
                method: method
            };
            
            if (l > 0 && typeof arguments[l - 1] === "function") {
                //with callback, procedure
                if (l > 1 && typeof arguments[l - 2] === "function") {
                    // two callbacks, success and error
                    callback = {
                        success: arguments[l - 2],
                        error: arguments[l - 1]
                    };
                    message.params = slice.call(arguments, 0, l - 2);
                }
                else {
                    // single callback, success
                    callback = {
                        success: arguments[l - 1]
                    };
                    message.params = slice.call(arguments, 0, l - 1);
                }
                _callbacks["" + (++_callbackCounter)] = callback;
                message.id = _callbackCounter;
            }
            else {
                // no callbacks, a notification
                message.params = slice.call(arguments, 0);
            }
            if (definition.namedParams && message.params.length === 1) {
                message.params = message.params[0];
            }
            // Send the method request
            _send(message);
        };
    }
501255
private static String createSig(Method m) {
        return m.getName() + ':' + MethodDesc.forMethod(m).getDescriptor();
    }
1036644
def AddMethod(self, function, name=None):
        
        method = MethodWrapper(self, function, name)
        self.added_methods.append(method)
834238
public DocumentSymbol toDocumentSymbol(final EObject object) {
    DocumentSymbol _documentSymbol = new DocumentSymbol();
    final Procedure1<DocumentSymbol> _function = (DocumentSymbol it) -> {
      final String objectName = this.nameProvider.getName(object);
      if ((objectName != null)) {
        it.setName(objectName);
      }
      final SymbolKind objectKind = this.kindProvider.getSymbolKind(object);
      if ((objectKind != null)) {
        it.setKind(objectKind);
      }
      final Range objectRange = this.rangeProvider.getRange(object);
      if ((objectRange != null)) {
        it.setRange(objectRange);
      }
      final Range objectSelectionRange = this.rangeProvider.getSelectionRange(object);
      if ((objectSelectionRange != null)) {
        it.setSelectionRange(objectSelectionRange);
      }
      it.setDetail(this.detailsProvider.getDetails(object));
      it.setDeprecated(Boolean.valueOf(this.deprecationInfoProvider.isDeprecated(object)));
      it.setChildren(CollectionLiterals.<DocumentSymbol>newArrayList());
    };
    return ObjectExtensions.<DocumentSymbol>operator_doubleArrow(_documentSymbol, _function);
  }
1347499
public static MethodMetadata build(Method method) {
        return new MethodMetadata(method.getName(), method.getDeclaringClass(), method,
            method.getParameterTypes());
    }
155618
def generate_method_definition(func):
    
    indent = 4

    # initial definition
    method_definition = (" " * indent) + "def " + func["name"]

    # Here we just create a queue and put all the parameters
    # into the queue in the order that they were given,
    params_required = [
        param for param in func["arguments"] if param["is_required"]
    ]
    params_optional = [
        param for param in func["arguments"]
        if not param["is_required"]
    ]

    # Open the parameter definitions
    method_definition += "(self, "

    for param in params_required:
        # Put the parameter into the queue

        method_definition += param["name"]
        method_definition += ", "

    for param in params_optional:
        method_definition += param["name"]

        # Default methods not required
        method_definition += "=None, "

    # Peel off the final ", " and close off the parameter definition
    method_definition = method_definition.rstrip(", ") + "):\n"

    indent += 4

    # re-indent
    method_definition += " " * indent

    # Begin with description.

    method_definition += '"""' + func["description"]

    # re-indent
    method_definition += "\n\n" + " " * indent

    # Go through each parameter and insert description & type hint
    for param in params_required + params_optional:
        # Add the type
        method_definition += ":param " + DTYPE_MAPPING[param["type"].lower()]

        # Add the name
        method_definition += " " + param["name"] + ": "

        # Add the description
        method_definition += param["description"]

        # Add optionality & reindent
        method_definition += "\n" if param[
            "is_required"] else " (Optional)\n"

        method_definition += " " * indent

    open_index = func["returns"].find('(')
    close_index = func["returns"].find(
        ')', (open_index if open_index > -1 else 0))

    func["returns"] = func["returns"].replace("\t", " " * 4)
    return_string = func["returns"].replace("\n", "")

    if open_index < close_index and func["returns"][
                                    open_index + 1:close_index] in DTYPE_MAPPING:
        method_definition += ":rtype: " + DTYPE_MAPPING[
            func["returns"][open_index + 1:close_index]]

        func["returns"] = func["returns"].replace(
            func["returns"][open_index:close_index + 1], "")

        method_definition += "\n" + " " * indent

    method_definition += ":return: " + return_string

    for i in range(0, len(return_string) + 1, 80 - (indent + 2)):
        method_definition += return_string[i:i + (
                80 - (indent + 2))] + "\n" + " " * indent

    # Close it off & reindent
    method_definition += '"""' + "\n" + " " * indent

    # Create the params map
    params_map = "__params_map = {"

    # Save the indent
    params_indent, num_params = len(
        params_map), len(params_required) + len(params_optional)

    # Append the map to the method_definition
    method_definition += params_map

    # Go through the required parameters first
    for i, param in enumerate(params_required + params_optional):

        # append the methods to the map
        method_definition += "'" + param["name"] + "': " + param["name"]

        if not param["is_required"]:
            method_definition + " if " + param[
                "name"] + "is not None else None"

        # add commas or ending bracket if needed & reindent correctly
        method_definition += ",\n" + " " * indent + ' ' * params_indent if i + 1 < num_params else ""

    method_definition += '}\n\n' + ' ' * indent

    method_definition += "return self.make_request(SERVER_ADDRESS, '" + func["name"] + "', " \
                         + params_map.rstrip(" = {") + ", timeout=self.timeout)\n\n"

    return method_definition
609956
private MethodRefActive createMethodRefActive(ServiceRefAmp serviceRef)
  {
    MethodRefAmp methodRef;
    
    if (_type != null) {
      methodRef = serviceRef.methodByName(_name, _type);
    }
    else {
      methodRef = serviceRef.methodByName(_name);
    }
    
    MethodShim methodShim;
    
    ClassLoader methodLoader = methodRef.serviceRef().classLoader();
    
    //System.out.println("SR: " + serviceRef + " " + serviceRef.getActor());
    
    if (methodLoader == _sourceLoader
        || serviceRef.stub() instanceof StubLink) {
      //methodShim = new MethodShimIdentity(methodRef.getMethod());
      methodShim = new MethodShimIdentity(methodRef, 
                                          isLocalService(serviceRef));
    }
    else {
      PodImport importContext; 
      
      importContext = PodImportContext.create(_sourceLoader).getPodImport(methodLoader);
      //importContext = ImportContext.create(methodLoader).getModuleImport(_sourceLoader);

      //methodShim = new MethodShimImport(methodRef.getMethod(), importContext);
      methodShim = new MethodShimImport(methodRef, importContext, 
                                        isLocalService(serviceRef));
    }
    
  
    return new MethodRefActive(serviceRef, 
                               methodRef,
                               methodShim);
  }
1108789
@Nullable
  public static MethodSymbol getSymbol(MethodInvocationTree tree) {
    Symbol sym = ASTHelpers.getSymbol(tree.getMethodSelect());
    if (!(sym instanceof MethodSymbol)) {
      // Defensive. Would only occur if there are errors in the AST.
      return null;
    }
    return (MethodSymbol) sym;
  }
101586
protected void writeSimpleMethodSignature(Writer out, int indent, String javadoc, String signature)
         throws IOException
   {
      writeWithIndent(out, indent, "/**\n");
      writeIndent(out, indent);
      out.write(javadoc);
      writeEol(out);
      writeWithIndent(out, indent, " */\n");

      writeIndent(out, indent);
      out.write(signature);
   }
244779
private static String getMethodName(MethodSymbol methodSym) {
    return String.format("%s#%s", methodSym.owner, methodSym.getSimpleName());
  }
335426
def addMethod(self, m):
        
        if m.nargs == -1:
            m.nargs = len([a for a in marshal.genCompleteTypes(m.sigIn)])
            m.nret = len([a for a in marshal.genCompleteTypes(m.sigOut)])
        self.methods[m.name] = m
        self._xml = None