From 8ce15caffb3c48787e3851b888264eee17bef47e Mon Sep 17 00:00:00 2001 From: Jeremy Dubreil Date: Wed, 22 Nov 2017 15:51:24 -0800 Subject: [PATCH] [infer][java] model org.assertj.core.util.Preconditions Summary: The model is the same as `com.google.common.base.Preconditions`. We could imagine a more generic ways of dealing with `x.y.Z.checkNotNull()` but this would work for now. Reviewed By: sblackshear Differential Revision: D6341869 fbshipit-source-id: 5b6e507 --- .../org/assertj/core/util/Preconditions.java | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 infer/models/java/src/org/assertj/core/util/Preconditions.java diff --git a/infer/models/java/src/org/assertj/core/util/Preconditions.java b/infer/models/java/src/org/assertj/core/util/Preconditions.java new file mode 100644 index 000000000..41672094c --- /dev/null +++ b/infer/models/java/src/org/assertj/core/util/Preconditions.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2017 - present Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +package org.assertj.core.util; + +import javax.annotation.Nullable; + +import static com.facebook.infer.builtins.InferBuiltins.assume; + +public final class Preconditions { + + public static void checkArgument( + boolean expression, String errorMessageTemplate, Object... errorMessageArgs) { + assume(expression); + } + + public static T checkNotNull(T reference) { + assume(reference != null); + return reference; + } + + public static T checkNotNull(T reference, String message) { + assume(reference != null); + return reference; + } + + public static void checkState( + boolean expression, String errorMessageTemplate, Object... errorMessageArgs) { + assume(expression); + } +}