Defensive implemented method to determine if method has a return type.

@param method
@return true if and only if it is not a void method.
425872
public static boolean hasReturnType(final Method method) {
        if (method == null) {
            return false;
        }
        if (method.getReturnType() == null) {
            return false;
        }
        if (Void.class.equals(method.getReturnType())) {
            return false;
        }
        return !Void.TYPE.equals(method.getReturnType());
    }
2057
public static void assertReturnValue(ReflectionMethod method, Class<?> expectedReturnType) {
        final Class<?> returnType = method.getReturnType();
        if (returnType != expectedReturnType) {
            final String message = "Class='"+method.getDeclaringClass()+"', method='"+method.getName()+"': Must return a value of type '"+expectedReturnType+"'!";
            throw new IllegalArgumentException(message);
        }
    }
922407
static boolean isSetterMethod(final Method method) {
        return method.getName().startsWith(SETTER_METHOD_PREFIX)
                &&
                Builder.class.isAssignableFrom(method.getReturnType())
                &&
                !method.isVarArgs()
                &&
                method.getParameterTypes().length == 1;
    }
292641
public static boolean isParticleMethod(FrameworkMethod method) {
        return ((null != method.getAnnotation(Test.class)) ||
                (null != method.getAnnotation(Before.class)) ||
                (null != method.getAnnotation(After.class)) ||
                (null != method.getAnnotation(BeforeClass.class)) ||
                (null != method.getAnnotation(AfterClass.class)));
    }
880435
protected static boolean isEqualsMethod(Method method) {
        return method.getReturnType() == boolean.class && method.getParameterTypes().length == 1 &&
                method.getParameterTypes()[0] == Object.class && method.getName().equals("equals");
    }
207584
private static boolean isGetterMethod(Method method) {
		return !Modifier.isStatic(method.getModifiers())
			&& (method.getName().startsWith("get") || method.getName().startsWith("is"))
			&& method.getParameterTypes().length == 0;
	}
427696
private boolean isFeatureMethod(MethodNode method) {
    for (Statement stat : AstUtil.getStatements(method)) {
      String label = stat.getStatementLabel();
      if (label == null) continue;

      // assertion: is (meant to be) a feature method, so we'll return true in the end
      if (method.isStatic())
        errorReporter.error(method, "Feature methods must not be static");

      return true;
    }

    return false;
  }
966867
public static boolean hasMethod(Class<?> targetClass, String methodName, Class... parameterTypes) {
        try {
            targetClass.getMethod(methodName, parameterTypes);
            return true;
        } catch (NoSuchMethodException e) {
            return false;
        }
    }
561072
public static void validateMethodOrThrow(Method method) {
    Class<?> returnType = method.getReturnType();
    if (returnType.equals(Void.TYPE)) {
      return;
    } else if (!Publisher.class.isAssignableFrom(returnType)) {
      throw new UnsupportedOperationException("Service method return type can be Publisher only");
    }
    if (method.getParameterCount() > 1) {
      throw new UnsupportedOperationException("Service method can accept 0 or 1 parameters only");
    }
  }
1096805
private static TypeName annotatedReturnType(ExecutableElement method) {
    TypeMirror returnType = method.getReturnType();
    List<AnnotationSpec> annotations =
        returnType.getAnnotationMirrors().stream()
            .map(AnnotationSpec::get)
            .collect(toList());
    return TypeName.get(returnType).annotated(annotations);
  }
289596
private boolean prescreen(Method method) {
        BitSet bytecodeSet = getClassContext().getBytecodeSet(method);
        return (bytecodeSet != null) && (bytecodeSet.get(Const.IINC)) && (bytecodeSet.get(Const.GOTO) || bytecodeSet.get(Const.GOTO_W));
    }
156842
private boolean prescreen(Method method) {
        BitSet bytecodeSet = getClassContext().getBytecodeSet(method);
        return (bytecodeSet != null) && bytecodeSet.intersects(arrayLoadOps);
    }
1074953
def method_has_integration(self, method):
        
        for method_definition in self.get_method_contents(method):
            if self.method_definition_has_integration(method_definition):
                return True
        return False
736052
private boolean isHandlerMethod(final Method method) {
        boolean isHandler = false;

        if (hasStartSagaAnnotation(method) || hasHandlerAnnotation(method)) {
            if (method.getReturnType().equals(Void.TYPE)) {
                Class<?>[] parameterTypes = method.getParameterTypes();
                if (parameterTypes.length == 1) {
                    isHandler = true;
                } else {
                    LOG.warn("Method {}.{} marked for saga does not have the expected single parameter.", method.getDeclaringClass(), method.getName());
                }
            } else {
                LOG.warn("Method {}.{} marked for saga event handling but does return a value.", method.getDeclaringClass(), method.getName());
            }
        }

        return isHandler;
    }
1165941
private static boolean isDesignerMethod(Method method) {
        Class<?>[] parameterTypes = method.getParameterTypes();

        for (Class<?> parameterType : parameterTypes) {
            if (parameterType.isAssignableFrom(TestDesigner.class)) {
                return true;
            }
        }

        return false;
    }
1087682
private static Boolean methodExists(Class clazz, String methodName, Type[] args, Type returnType) {
	try {
	    Class<?>[] _args = new Class[args.length];
	    for (int i = 0; i < _args.length; i++) {
		_args[i] = Types.toClass(args[i]);
	    }
	    Class<?> rtn = Types.toClass(returnType);
	    try {
		java.lang.reflect.Method m = clazz.getMethod(methodName, _args);
		return m.getReturnType() == rtn;
	    }
	    catch (Exception e) {
		return false;
	    }
	}
	catch (Exception e) {
	    SystemOut.printDate(e);
	    return null;
	}
    }
660953
public static boolean isVoidMethod(@Nullable Object target, String method, Object... args) {
    if (target == null) return false; // no way to tell

    Class[] argTypes = ReflectionUtil.getTypes(args);

    // the way we choose metaClass, we won't find methods on java.lang.Class
    // but since java.lang.Class has no void methods other than the ones inherited
    // from java.lang.Object, and since we operate on a best effort basis, that's OK
    // also we will choose a static method like Foo.getName() over the equally
    // named method on java.lang.Class, but this is consistent with current Groovy semantics
    // (see http://jira.codehaus.org/browse/GROOVY-3548)
    // in the end it's probably best to rely on NullAwareInvokeMethodSpec to tell us if
    // everything is OK
    MetaClass metaClass = target instanceof Class ?
        InvokerHelper.getMetaClass((Class) target) : InvokerHelper.getMetaClass(target);

    // seems to find more methods than getMetaMethod()
    MetaMethod metaMethod = metaClass.pickMethod(method, argTypes);
    if (metaMethod == null) return false; // we were unable to figure out which method was called

    Class returnType = metaMethod.getReturnType();
    // although Void.class will occur rarely, it makes sense to handle
    // it in the same way as void.class
    return returnType == void.class || returnType == Void.class;
  }