the result function
@return the function
@throws MethodAmbiguouslyDefinedException more than one method is found
777713
public ResultFunction<M, G, R> resultFunction() throws
                                                  MethodAmbiguouslyDefinedException {
    final MasterClass masterClass = new MasterClass(this.master.getClass());
    final GuestClass guestClass = new GuestClass(this.guest.getClass());
    final GenericsContext context = GenericsResolver.resolve(this.getClass())
                                                    .type(Dispatch.class);
    // final Class<?> masterClassRestriction = context.generics().get(0); // Class M for right method searching
    // final Class<?> guestClassRestriction = context.generics().get(1); // Class G for right method searching
    final ReturnClass returnClass = new ReturnClass(context.generics()
                                                           .get(2)); // Class R for right method searching
    ResultFunction<M, G, R> method;
    final Set<Method> methods = new ByParameterClass(masterClass,
                                                     guestClass,
                                                     this.methodName,
                                                     returnClass,
                                                     new ByParameterInterfaces(masterClass,
                                                                               guestClass,
                                                                               this.methodName,
                                                                               returnClass,
                                                                               new ByParameterSuperClass(masterClass,
                                                                                                         guestClass,
                                                                                                         this.methodName,
                                                                                                         returnClass,
                                                                                                         new EmptyMethods()))).findMethods();
    if (methods.isEmpty()) {
      method = new ResultFunction<M, G, R>() {
        @Override
        public String toString() {
          return "default method";
        }

        @Override
        public R apply(final M m,
                       final G g) {
          return Dispatch.this.defaultMethod.apply(m,
                                                   g);
        }
      };
    } else {
      final Iterator<Method> iterator = methods.iterator();
      MethodRepresentation currentMethod = new OneMethod(iterator.next());
      while (iterator.hasNext()) {
        final MethodRepresentation nextMethod = new OneMethod(iterator.next());
        currentMethod = new OneOfTwoMethods(currentMethod,
                                            nextMethod);
      }
      final Method finalMethod = currentMethod.toMethod();
      method = new MethodFunction<>(finalMethod);
    }
    return method;
  }
447990
protected String getResult() {
        // Until read end
        while (!isDone) {
            try {
                Thread.sleep(500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

        // Get return value
        if (mResult.length() == 0)
            return null;
        else
            return mResult.toString();
    }
749835
public static String methodKey(Method m)
    {
        StringBuffer result = new StringBuffer(m.getName());

        result.append("(");

        Class<?> argTypes[] = m.getParameterTypes();
        for (int i = 0; i < argTypes.length; i++) {
            result.append(argTypes[i].getName());
            result.append(",");
        }
        result.append(")");
        return result.toString();
    }
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();
      }
    };
  }
186837
public FunctionInfo getFunction(String methodDesc) {

        methodDesc = methodDesc.replace('.', '$');
        int paramsStartPos = methodDesc.indexOf('(');
        int firstSep = methodDesc.indexOf('$');
        String prefix = firstSep != -1 && firstSep < paramsStartPos ? methodDesc.substring(0, firstSep) : "";
        methodDesc = prefix.length() > 0 ? methodDesc.substring(prefix.length() + 1) : methodDesc;
        FunctionInfo[] f = getFunctions();

        for (int i = 0; i < f.length; i++) {
            String p = f[i].getProvider() != null ? f[i].getProvider().getContextPrefixName().trim() : "";
            p = p.endsWith("$") ? p.substring(0, p.length() - 1) : p;
            if (("".equals(prefix) || prefix.equals(p)) &&
                    new TemplateCallExtractor.AppMethodInfo(f[i].getDescriptor().getMethod()).equals(
                    new TemplateCallExtractor.AppMethodInfo(methodDesc)))
            return f[i];
        }

        return null;

    }
1000149
@Override
  public Method getMethod(String methodName, int parameterCount) {
    for (Method method : methods) {
      if (method.getName().equals(methodName) && method.getParameters().size() == parameterCount) {
        return method;
      }
    }
    if (extending != null) {
      return extending.getMethod(methodName, parameterCount);
    }
    return null;
  }
1216523
public String getMethodSignature() {
        if (method != null) {
            String methodSignature = method.toString();
            return methodSignature.replaceFirst("public void ", "");
        }
        return null;
    }
1121356
@SuppressWarnings("null")
    public static Method getMethod(EvaluationContext ctx, Object base, Object property,
            Class<?>[] paramTypes, Object[] paramValues)
            throws MethodNotFoundException {
        if (base == null || property == null) {
            throw new MethodNotFoundException(MessageFactory.get(
                    "error.method.notfound", base, property,
                    paramString(paramTypes)));
        }

        String methodName = (property instanceof String) ? (String) property
                : property.toString();

        int paramCount;
        if (paramTypes == null) {
            paramCount = 0;
        } else {
            paramCount = paramTypes.length;
        }

        Method[] methods = base.getClass().getMethods();
        Map<Method,MatchResult> candidates = new HashMap<>();

        for (Method m : methods) {
            if (!m.getName().equals(methodName)) {
                // Method name doesn't match
                continue;
            }

            Class<?>[] mParamTypes = m.getParameterTypes();
            //149852 - This was removed due to a findBugs error we felt was worthy of a change.
            //m.getParameterTypes will ALWAYS return an array, it may be of length 0 though
            int mParamCount = mParamTypes.length;

            // Check the number of parameters
            if (!(paramCount == mParamCount ||
                    (m.isVarArgs() && paramCount >= mParamCount))) {
                // Method has wrong number of parameters
                continue;
            }

            // Check the parameters match
            int exactMatch = 0;
            int assignableMatch = 0;
            int coercibleMatch = 0;
            boolean noMatch = false;
            for (int i = 0; i < mParamCount; i++) {
                // Can't be null
                if (mParamTypes[i].equals(paramTypes[i])) {
                    exactMatch++;
                } else if (i == (mParamCount - 1) && m.isVarArgs()) {
                    Class<?> varType = mParamTypes[i].getComponentType();
                    for (int j = i; j < paramCount; j++) {
                        if (isAssignableFrom(paramTypes[j], varType)) {
                            assignableMatch++;
                        } else {
                            if (paramValues == null) {
                                noMatch = true;
                                break;
                            } else {
                                if (isCoercibleFrom(ctx, paramValues[j], varType)) {
                                    coercibleMatch++;
                                } else {
                                    noMatch = true;
                                    break;
                                }
                            }
                        }
                        // Don't treat a varArgs match as an exact match, it can
                        // lead to a varArgs method matching when the result
                        // should be ambiguous
                    }
                } else if (isAssignableFrom(paramTypes[i], mParamTypes[i])) {
                    assignableMatch++;
                } else {
                    if (paramValues == null) {
                        noMatch = true;
                        break;
                    } else {
                        if (isCoercibleFrom(ctx, paramValues[i], mParamTypes[i])) {
                            coercibleMatch++;
                        } else {
                            noMatch = true;
                            break;
                        }
                    }
                }
            }
            if (noMatch) {
                continue;
            }

            // If a method is found where every parameter matches exactly,
            // return it
            if (exactMatch == paramCount) {
                return getMethod(base.getClass(), m);
            }

            candidates.put(m, new MatchResult(
                    exactMatch, assignableMatch, coercibleMatch, m.isBridge()));
        }

        // Look for the method that has the highest number of parameters where
        // the type matches exactly
        MatchResult bestMatch = new MatchResult(0, 0, 0, false);
        Method match = null;
        boolean multiple = false;
        for (Map.Entry<Method, MatchResult> entry : candidates.entrySet()) {
            int cmp = entry.getValue().compareTo(bestMatch);
            if (cmp > 0 || match == null) {
                bestMatch = entry.getValue();
                match = entry.getKey();
                multiple = false;
            } else if (cmp == 0) {
                multiple = true;
            }
        }
        if (multiple) {
            if (bestMatch.getExact() == paramCount - 1) {
                // Only one parameter is not an exact match - try using the
                // super class
                match = resolveAmbiguousMethod(candidates.keySet(), paramTypes);
            } else {
                match = null;
            }

            if (match == null) {
                // If multiple methods have the same matching number of parameters
                // the match is ambiguous so throw an exception
                throw new MethodNotFoundException(MessageFactory.get(
                        "error.method.ambiguous", base, property,
                        paramString(paramTypes)));
                }
        }

        // Handle case where no match at all was found
        if (match == null) {
            throw new MethodNotFoundException(MessageFactory.get(
                        "error.method.notfound", base, property,
                        paramString(paramTypes)));
        }

        return getMethod(base.getClass(), match);
    }
1155607
public static <R> Function<Object,R[]> arrayOf(final Type<R> resultType, final String methodName, final Object... optionalParameters) {
        return methodForArrayOf(resultType, methodName, optionalParameters);
    }
36041
public A getResult() {
		final InvocationHandler handler = new XAnnotationInvocationHandler(this);

		@SuppressWarnings("unchecked")
		final A annotation = (A) Proxy.newProxyInstance(
				annotationClass.getClassLoader(),
				new Class[] { annotationClass }, handler);

		return annotation;
	}
492320
public static <B> Function<Example<?, B>, B> outputGetter() {
    return new Function<Example<?, B>, B>() {
      @Override
      public B apply(Example<?, B> item) {
        return item.getOutput();
      }
    };
  }
1336662
@GwtIncompatible("incompatible method")
    private static Throwable getCauseUsingMethodName(final Throwable throwable, final String methodName) {
        Method method = null;
        try {
            method = throwable.getClass().getMethod(methodName);
        } catch (final NoSuchMethodException | SecurityException ignored) { // NOPMD
            // exception ignored
        }

        if (method != null && Throwable.class.isAssignableFrom(method.getReturnType())) {
            try {
                return (Throwable) method.invoke(throwable);
            } catch (final IllegalAccessException | IllegalArgumentException | InvocationTargetException ignored) { // NOPMD
                // exception ignored
            }
        }
        return null;
    }
733855
public Object initResult()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
	  SibTr.entry(tc, "initResult");  	

    Set theResults = new HashSet();
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
	  SibTr.exit(tc, "initResult");
    return theResults;
  }
966406
public static <R> MethodResult<R> internalFailure(Throwable failure) {
        return new MethodResult<R>(null, failure, true);
    }
1082179
public void returnValue(Local<?> result) {
        if (!result.type.equals(method.returnType)) {
            // TODO: this is probably too strict.
            throw new IllegalArgumentException("declared " + method.returnType
                    + " but returned " + result.type);
        }
        addInstruction(new PlainInsn(Rops.opReturn(result.type.ropType), sourcePosition,
                null, RegisterSpecList.make(result.spec())));
    }
1167985
public function getMethodName()
    {
        if (!empty($this->methodRef)) {
            return substr($this->methodRef, strpos($this->methodRef, ':') + 1);
        }

        return null;
    }
517010
static Method getMethod(Class<?> type, Method m) {
        if (m == null || Modifier.isPublic(type.getModifiers())) {
            return m;
        }
        Class<?>[] inf = type.getInterfaces();
        Method mp = null;
        for (int i = 0; i < inf.length; i++) {
            try {
                mp = inf[i].getMethod(m.getName(), m.getParameterTypes());
                mp = getMethod(mp.getDeclaringClass(), mp);
                if (mp != null) {
                    return mp;
                }
            } catch (NoSuchMethodException e) {
                // Ignore
            }
        }
        Class<?> sup = type.getSuperclass();
        if (sup != null) {
            try {
                mp = sup.getMethod(m.getName(), m.getParameterTypes());
                mp = getMethod(mp.getDeclaringClass(), mp);
                if (mp != null) {
                    return mp;
                }
            } catch (NoSuchMethodException e) {
                // Ignore
            }
        }
        return null;
    }