Method declaration
422591
private void initGUI() {

        Font fFont = new Font("Dialog", Font.PLAIN, 12);

        setLayout(new BorderLayout());

        Panel p = new Panel();

        p.setBackground(SystemColor.control);
        p.setLayout(new GridLayout(16, 1));

        tSourceTable = new TextField();

        tSourceTable.setEnabled(false);

        tDestTable = new TextField();

        tDestTable.addActionListener(this);

        tDestDrop = new TextField();

        tDestDrop.addActionListener(this);

        tDestCreate = new TextField();

        tDestCreate.addActionListener(this);

        tDestDelete = new TextField();

        tDestDelete.addActionListener(this);

        tDestCreateIndex = new TextField();

        tDestCreateIndex.addActionListener(this);

        tDestDropIndex = new TextField();

        tDestDropIndex.addActionListener(this);

        tSourceSelect = new TextField();

        tSourceSelect.addActionListener(this);

        tDestInsert = new TextField();

        tDestInsert.addActionListener(this);

        tDestAlter = new TextField();

        tDestAlter.addActionListener(this);

        cTransfer = new Checkbox("Transfer to destination table", true);

        cTransfer.addItemListener(this);

        cDrop = new Checkbox("Drop destination table (ignore error)", true);

        cDrop.addItemListener(this);

        cCreate = new Checkbox("Create destination table", true);

        cCreate.addItemListener(this);

        cDropIndex = new Checkbox("Drop destination index (ignore error)",
                                  true);

        cDropIndex.addItemListener(this);

        cIdxForced = new Checkbox("force Idx_ prefix for indexes names",
                                  false);

        cIdxForced.addItemListener(this);

        cCreateIndex = new Checkbox("Create destination index", true);

        cCreateIndex.addItemListener(this);

        cDelete = new Checkbox("Delete rows in destination table", true);

        cDelete.addItemListener(this);

        cInsert = new Checkbox("Insert into destination", true);

        cInsert.addItemListener(this);

        cFKForced = new Checkbox("force FK_ prefix for foreign key names",
                                 false);

        cFKForced.addItemListener(this);

        cAlter = new Checkbox("Alter destination table", true);

        cAlter.addItemListener(this);
        p.add(createLabel("Source table"));
        p.add(tSourceTable);
        p.add(cTransfer);
        p.add(tDestTable);
        p.add(cDrop);
        p.add(tDestDrop);
        p.add(cCreate);
        p.add(tDestCreate);
        p.add(cDropIndex);
        p.add(tDestDropIndex);
        p.add(cCreateIndex);
        p.add(tDestCreateIndex);
        p.add(cDelete);
        p.add(tDestDelete);
        p.add(cAlter);
        p.add(tDestAlter);
        p.add(createLabel("Select source records"));
        p.add(tSourceSelect);
        p.add(cInsert);
        p.add(tDestInsert);
        p.add(createLabel(""));
        p.add(createLabel(""));
        p.add(cIdxForced);
        p.add(cFKForced);
        p.add(createLabel(""));
        p.add(createLabel(""));

        if (iTransferMode == TRFM_TRANSFER) {
            bStart    = new Button("Start Transfer");
            bContinue = new Button("Continue Transfer");

            bContinue.setEnabled(false);
        } else if (iTransferMode == Transfer.TRFM_DUMP) {
            bStart = new Button("Start Dump");
        } else if (iTransferMode == Transfer.TRFM_RESTORE) {
            bStart = new Button("Start Restore");
        }

        bStart.addActionListener(this);
        p.add(bStart);

        if (iTransferMode == TRFM_TRANSFER) {
            bContinue.addActionListener(this);
            p.add(bContinue);
        }

        bStart.setEnabled(false);
        fMain.add("Center", createBorderPanel(p));

        lTable = new java.awt.List(10);

        lTable.addItemListener(this);
        fMain.add("West", createBorderPanel(lTable));

        tMessage = new TextField();

        Panel pMessage = createBorderPanel(tMessage);

        fMain.add("South", pMessage);
    }
248758
public void visitPreDestroyMethod(Object declaringType,
                                      String methodName) {
        visitPreDestroyMethod(declaringType, Void.TYPE, methodName);
    }
799581
@Descriptor("Gets info about the declarations available")
    public void declarations(@Descriptor("declarations [--type import|export]") String... parameters) {
        String type = getArgumentValue("--type", parameters);
        try {
            if ((type == null) || "import".equals(type)) {
                List<ServiceReference> allServiceRef = getAllServiceRefs(ImportDeclaration.class);
                displayDeclarationList(allServiceRef);
            }

            if ((type == null) || "export".equals(type)) {
                List<ServiceReference> allServiceRef = getAllServiceRefs(ExportDeclaration.class);
                displayDeclarationList(allServiceRef);
            }
        } catch (Exception e) {
            LOG.error("failed to execute command", e);
            print("failed to execute the command");
        }
    }
363614
public final Invokable<T, Object> method(Method method) {
    checkArgument(of(method.getDeclaringClass()).isAssignableFrom(this),
        "%s not declared by %s", method, this);
    return new Invokable.MethodInvokable<T>(method) {
      @Override Type getGenericReturnType() {
        return resolveType(super.getGenericReturnType()).getType();
      }
      @Override Type[] getGenericParameterTypes() {
        return resolveInPlace(super.getGenericParameterTypes());
      }
      @Override Type[] getGenericExceptionTypes() {
        return resolveInPlace(super.getGenericExceptionTypes());
      }
      @Override public TypeToken<T> getOwnerType() {
        return TypeToken.this;
      }
      @Override public String toString() {
        return getOwnerType() + "." + super.toString();
      }
    };
  }
908361
public void setMethod(String method) {
	method = method.toLowerCase();
	if (method.equals("loop")) this.method = MODE_LOOP;
	else if (method.equals("exittag")) this.method = MODE_EXIT_TAG;
	else if (method.equals("exittemplate")) this.method = MODE_EXIT_TEMPLATE;
    }
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(";");
  }
619384
function() {

        // Get the "declaration" part of the method.
        var prefix = this['super']('toString').split(':')[0],
            body   = '[Function',
            args   = this.getParameters(),
            is_var = this.usesVariadicArguments();

        if (args.length > 0 && typeof (args[0]) === 'object') {
            // right now, this is spitting out every overload's signature one after another, each on a new line.
            // should probably find a better way to do this
            for (var idx = 0; idx < args.length; idx++) {
                var function_parameters_meta = args[idx];

                body += ' (';

                var first_time = true;
                for (var i = 0; i < function_parameters_meta.length; i++) {
                    if (!first_time) {
                        body += ', ';
                    }
                    first_time = false;
                    body += function_parameters_meta[i].type;
                    if (function_parameters_meta[i].name !== null) {
                        body += " " + function_parameters_meta[i].name;
                        is_var = true;
                    }
                }


                var data = this.reflector.getProto().__joii__.metadata[this.name].overloads[idx].fn.toString();
                is_var = data.match(/[\(|\.|\ ](arguments)[\)|\.|\,|\ |]/g);

                if (is_var) {
                    body += ', ...';
                }
                body += ')\n';
            }
        } else if (args.length > 0) {
            body += ' (' + args.join(', ');
            if (is_var) {
                body += ', ...';
            }
            body += ')';
        } else if (args.length === 0 && is_var) {
            body += ' (...)';
        }

        body += ']';
        return prefix + ': ' + body;
    }
1047684
private static void setAction(Method method, Object handlerBean) {
        Class<?>[] paramTypes = method.getParameterTypes();
        Class<?> returnType = method.getReturnType();
        Condition condition = Condition.newInstance(paramTypes[0], returnType);

        Handler existHandler = ACTION_MAP.get(condition);
        if (Objects.nonNull(existHandler)) {
            String message = "\n{method：" + method.getDeclaringClass().getName() + "." + method.getName()
                    + "}\n{method：" + existHandler.getMethod().getDeclaringClass().getName() + "."
                    + existHandler.getMethod().getName() + "} convert source and target is the same ";
            throw NonUniqueConverterException.of(message);
        }

        log.info("Mapped \"{sourceClass = {},targetClass = {}}\" onto {}", condition.getSourceClass(), returnType,
                method);
        Handler handler = Handler.newInstance(handlerBean, method);
        ACTION_MAP.put(condition, handler);
    }
1069800
public void addToMethod(DexMaker dexMaker, MethodId<?, ?> method) {
        if (annotatedElement != ElementType.METHOD) {
            throw new IllegalStateException("This annotation is not for method");
        }

        if (!method.declaringType.equals(declaringType)) {
            throw new IllegalArgumentException("Method" + method + "'s declaring type is inconsistent with" + this);
        }

        ClassDefItem classDefItem = dexMaker.getTypeDeclaration(declaringType).toClassDefItem();

        if (classDefItem == null) {
            throw new NullPointerException("No class defined item is found");
        } else {
            CstMethodRef cstMethodRef = method.constant;

            if (cstMethodRef == null) {
                throw new NullPointerException("Method reference is NULL");
            } else {
                // Generate CstType
                CstType cstType = CstType.intern(type.ropType);

                // Generate Annotation
                Annotation annotation = new Annotation(cstType, AnnotationVisibility.RUNTIME);

                // Add generated annotation
                Annotations annotations = new Annotations();
                for (NameValuePair nvp : elements.values()) {
                    annotation.add(nvp);
                }
                annotations.add(annotation);
                classDefItem.addMethodAnnotations(cstMethodRef, annotations, dexMaker.getDexFile());
            }
        }
    }
1187190
public void check(Declaration decl, AnnotationProcessorEnvironment env) {

        _locale = Locale.getDefault();

        if (decl instanceof TypeDeclaration) {

            //
            // Check method annotations
            //
            Collection<? extends MethodDeclaration> methods = ((TypeDeclaration) decl).getMethods();
            for (MethodDeclaration method : methods) {
                checkSQL(method, env);

            }
        } else if (decl instanceof FieldDeclaration) {

            //
            // NOOP
            //
        } else {

            //
            // NOOP
            //
        }
    }
1106169
private void defineWriteStructMethod()
    {
        MethodDefinition write = new MethodDefinition(
                a(PUBLIC),
                "write",
                null,
                arg("struct", structType),
                arg("protocol", TProtocol.class)
        );

        classDefinition.addMethod(write);

        // TProtocolReader reader = new TProtocolReader(protocol);
        write.addLocalVariable(type(TProtocolWriter.class), "writer");
        write.newObject(TProtocolWriter.class);
        write.dup();
        write.loadVariable("protocol");
        write.invokeConstructor(type(TProtocolWriter.class), type(TProtocol.class));
        write.storeVariable("writer");

        LocalVariableDefinition protocol = write.getLocalVariable("writer");

        // protocol.writeStructBegin("bonk");
        write.loadVariable(protocol)
                .loadConstant(metadata.getStructName())
                .invokeVirtual(TProtocolWriter.class, "writeStructBegin", void.class, String.class);

        // write fields
        for (ThriftFieldMetadata field : metadata.getFields(THRIFT_FIELD)) {
            writeField(write, protocol, field);
        }

        write.loadVariable(protocol)
                .invokeVirtual(TProtocolWriter.class, "writeStructEnd", void.class);

        write.ret();
    }
1137982
@SuppressWarnings("unchecked")
  private void registerValueMethod(Class type, Method method) {
    executor.register(type, wrapValueMethod(method));
  }
1219982
public static void stubMethod(Class<?> declaringClass, String methodName, Object returnObject) {
		if (declaringClass == null) {
			throw new IllegalArgumentException("declaringClass cannot be null");
		}
		if (methodName == null || methodName.length() == 0) {
			throw new IllegalArgumentException("methodName cannot be empty");
		}
		Method[] methods = Whitebox.getMethods(declaringClass, methodName);
		if (methods.length == 0) {
			throw new MethodNotFoundException(String.format("Couldn't find a method with name %s in the class hierarchy of %s", methodName,
					declaringClass.getName()));
		} else if (methods.length > 1) {
			throw new TooManyMethodsFoundException(String.format("Found %d methods with name %s in the class hierarchy of %s.", methods.length,
					methodName, declaringClass.getName()));
		}

		MockRepository.putMethodToStub(methods[0], returnObject);
	}
970686
def define(m)
      if m.is_a?(Method)
        @methods[m.name.to_sym] = m
      elsif m.is_a?(Signal)
        @signals[m.name.to_sym] = m
      end
    end
1127699
private void addMethodInfo(ExecutableElement method, Content dl) {
        TypeElement enclosing = utils.getEnclosingTypeElement(method);
        List<? extends TypeMirror> intfacs = enclosing.getInterfaces();
        ExecutableElement overriddenMethod = utils.overriddenMethod(method);
        // Check whether there is any implementation or overridden info to be
        // printed. If no overridden or implementation info needs to be
        // printed, do not print this section.
        if ((!intfacs.isEmpty()
                && new ImplementedMethods(method, this.configuration).build().isEmpty() == false)
                || overriddenMethod != null) {
            MethodWriterImpl.addImplementsInfo(this, method, dl);
            if (overriddenMethod != null) {
                MethodWriterImpl.addOverridden(this,
                        utils.overriddenType(method),
                        overriddenMethod,
                        dl);
            }
        }
    }
501255
private static String createSig(Method m) {
        return m.getName() + ':' + MethodDesc.forMethod(m).getDescriptor();
    }
1092974
function (method, handler) {
            if (!method || !handler) {
                return;
            }
            if (!this.handlers[method]) {
                //initialize array
                this.handlers[method] = [];
            }
            // add handler to the stack
            this.handlers[method].push(handler);
        }