Add a precondition check to the annotated method. The condition
     is passed the arguments from the annotated method. It does not
     need to accept all of the methods parameters. The condition
     is inspected to figure out which parameters to pass.
338440
def pre(cond):
    
    cond_args, cond_varargs, cond_varkw, cond_defaults = inspect.getargspec(cond)
    source = inspect.getsource(cond).strip()

    def inner(f):
        if enabled:
            # deal with the real function, not a wrapper
            f = getattr(f, 'wrapped_fn', f)

            # need to check if 'self' is the first arg,
            # since @pre doesn't want the self param
            member_function = is_member_function(f)

            # need metadata for checking defaults
            method_args, method_defaults = inspect.getargspec(f)[0::3]

            def check_condition(args, kwargs):
                cond_kwargs = {}

                if method_defaults is not None and len(method_defaults) > 0 \
                and len(method_args) - len(method_defaults) <= len(args) < len(method_args):
                    args += method_defaults[len(args) - len(method_args):]

                # collection the args
                for name, value in zip(cond_args, args[member_function:]):
                    cond_kwargs[name] = value

                # collect the remaining kwargs
                for name in cond_args:
                    if name not in cond_kwargs:
                        cond_kwargs[name] = kwargs.get(name)

                # test the precondition
                if not cond(**cond_kwargs):
                    # otherwise raise the exception
                    raise AssertionError('Precondition failure, %s' % source)

            # append to the rest of the preconditions attached to this method
            if not hasattr(f, 'preconditions'):
                f.preconditions = []
            f.preconditions.append(check_condition)

            return check(f)
        else:
            return f

    return inner
844354
private void check() {
		final Method method = getMethod();
		final XParameter[] parameters = getParameters();
		final Class<?>[] parameterTypes = method.getParameterTypes();
		Validate.isTrue(parameters.length == parameterTypes.length,
				"Wrong number of parameters: [" + parameters.length
						+ "], expected [" + parameterTypes.length + "].");
		for (int index = 0; index < parameters.length; index++) {
			final XParameter parameter = parameters[index];
			final Class<?> parameterType = parameterTypes[index];
			Validate.isTrue(parameterType.equals(parameter.getType()),
					"Wrong parameter type: [" + parameter.getType()
							+ "], expected [" + parameterType + "]");
		}
	}
1079760
public static Condition method(final Method m) {
        return new Condition(input -> m.equals(input.getMethod()));
    }
226565
public static long checkPreconditionL(
    final long value,
    final ContractLongConditionType condition)
    throws PreconditionViolationException
  {
    return checkPreconditionL(
      value, condition.predicate(), condition.describer());
  }
1084204
boolean isConsiderateMethod(Collection<String> methodProceeds, ExecutableElement methodElement) {
//		int argNum methodElement.getParameters().size();
		String signature = methodElement.getSimpleName().toString(); // + "(" + argNum + ")";
		// Check if method ith same signature has been already proceed.
		if (methodProceeds.contains(signature)) {
			return false;
		}
		// Herited from Object
		TypeElement objectElement = environment.getElementUtils().getTypeElement(Object.class.getName());
		if (objectElement.getEnclosedElements().contains(methodElement)) {
			return false;
		}
		// Static, not public ?
		if (!methodElement.getModifiers().contains(Modifier.PUBLIC) || methodElement.getModifiers().contains(Modifier.STATIC)) {
			return false;
		}
		// TransientDataService ?
		List<? extends AnnotationMirror> annotationMirrors = methodElement.getAnnotationMirrors();
		for (AnnotationMirror annotationMirror : annotationMirrors) {
			if (annotationMirror.getAnnotationType().toString().equals(TransientDataService.class.getName())) {
				return false;
			}
		}
		methodProceeds.add(signature);
		return true;
	}
1206216
@Override
    protected void checkParameters() {
        super.checkParameters();

        if (outputFile == null) {
            throw new BuildException("output attribute is required", getLocation());
        }

        if (inputFile == null) {
            throw new BuildException("inputFile element is required");
        }

        checkBoolean(notAProblem, "notAProblem");
        checkBoolean(withSource, "withSource");
        checkBoolean(applySuppression, "applySuppression");
        checkBoolean(active, "active");
        checkBoolean(introducedByChange, "introducedByChange");
        checkBoolean(removedByChange, "removedByChange");
        checkBoolean(newCode, "newCode");
        checkBoolean(removedCode, "removedCode");
        checkBoolean(withMessages, "withMessages");
    }
868637
def post(cond):
    
    source = inspect.getsource(cond).strip()

    def inner(f):
        if enabled:
            # deal with the real function, not a wrapper
            f = getattr(f, 'wrapped_fn', f)

            def check_condition(result):
                if not cond(result):
                    raise AssertionError('Postcondition failure, %s' % source)

            # append to the rest of the postconditions attached to this method
            if not hasattr(f, 'postconditions'):
                f.postconditions = []
            f.postconditions.append(check_condition)

            return check(f)
        else:
            return f

    return inner
40615
private static boolean checkParameters(Method method, Object... data)
	{
		Parameter[] parameters = method.getParameters();
		if (ArrayUtils.isEmpty(data) && parameters.length != 0)
			return false;
		if (parameters.length != data.length)
			return false;

		for (int i = 0; i < parameters.length; i++)
		{
			Class<?> paramClass = parameters[i].getType();
			if (data[i] != null)
			{
				Class<?> dataClass = data[i].getClass();
				if (!ClassUtils.isAssignable(dataClass, paramClass, true))
					return false;
			}
		}

		return true;
	}
812084
function findMethodWithValidDescription(type, methodName, condition) {
    type = findTypeMetaInfo(type);
    if (!type) {
        return;
    }
    var methods = type.methodsClass || type.methods || [];
    var method = methods.find(m => m.name === methodName && condition(m));
    if (method) {
        return method;
    }

    var parents = (type.implements || []).concat();
    if (type.extends) {
        parents.push(type.extends);
    }
    for (var i = 0; i < parents.length; i++) {
        method = findMethodWithValidDescription(parents[i], methodName, condition);
        if (method) {
            return method;
        }
    }
}
33578
public static void assertOneParameter(final Method method, Class<? extends Annotation> annotation)
   {
      if (method.getParameterTypes().length != 1)
      {
         throw annotation == null ? MESSAGES.methodHasToDeclareExactlyOneParameter(method) : MESSAGES.methodHasToDeclareExactlyOneParameter2(method, annotation);
      }
   }
1351209
public void add(final Condition condition) {
        if (andConditions.isEmpty()) {
            andConditions.add(new AndCondition());
        }
        andConditions.get(0).getConditions().add(condition);
    }
1157501
public static int checkPostconditionI(
    final int value,
    final ContractIntConditionType condition)
    throws PostconditionViolationException
  {
    return checkPostconditionI(
      value, condition.predicate(), condition.describer());
  }
1088275
protected void checkNonGenericParameter(Method executeMethod, Parameter parameter) {
        if (isNonGenericCheckTargetType(parameter.getType())) { // e.g. List
            final Type paramedType = parameter.getParameterizedType();
            if (paramedType == null) { // no way? no check just in case
                return;
            }
            if (paramedType instanceof ParameterizedType) {
                final Type[] typeArgs = ((ParameterizedType) paramedType).getActualTypeArguments();
                if (typeArgs != null && typeArgs.length > 0 && "?".equals(typeArgs[0].getTypeName())) { // e.g. List<?>
                    throwActionFormWildcardOnlyListParameterException(executeMethod, parameter);
                }
            } else {
                throwActionFormNonGenericListParameterException(executeMethod, parameter);
            }
        }
    }
109952
private void checkAndExecuteBeforeAfters(final Object obj, final Class<? extends Annotation> anno, final Method... meths) {
        final PerfidixMethodCheckException checkExc = checkMethod(obj, anno, meths);
        if (checkExc == null) {
            for (Method m : meths) {
                final PerfidixMethodInvocationException invoExc = invokeMethod(obj, anno, m);
                if (invoExc != null) {
                    BENCHRES.addException(invoExc);
                }
            }
        } else {
            BENCHRES.addException(checkExc);
        }
    }
28871
public static void assertTrue(boolean condition, String message, Object... args) {
		verify(condition, message, args);
	}
1073481
protected void invokePreconditions() {
    MethodContractHandle h =
        contracts.getMethodHandle(ContractKind.PRE, methodName, methodDesc, 0);
    if (h == null) {
      return;
    }

    MethodNode contractMethod = injectContractMethod(h);
    if (!statik) {
      loadThis();
    }
    loadArgs();
    invokeContractMethod(contractMethod);
  }
247552
public static void assertNoParameters(final Method method, Class<? extends Annotation> annotation) 
   {
      if (method.getParameterTypes().length != 0)
      {
         throw annotation == null ? MESSAGES.methodHasToHaveNoParameters(method) : MESSAGES.methodHasToHaveNoParameters2(method, annotation);
      }
   }