Summary: Useful to have Eradicate and Biabduction agree on how to inform that the analysis that some objects are not null. Reviewed By: sblackshear Differential Revision: D5075127 fbshipit-source-id: 9e56981master
parent
735e906145
commit
64ab959486
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2004 - 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 com.facebook.infer.annotation;
|
||||
|
||||
import com.facebook.infer.builtins.InferBuiltins;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class Assertions {
|
||||
|
||||
public static <T> T assumeNotNull(@Nullable T object) {
|
||||
InferBuiltins.assume_allocated(object);
|
||||
return object;
|
||||
}
|
||||
|
||||
public static <T> T assumeNotNull(@Nullable T object, String explanation) {
|
||||
InferBuiltins.assume_allocated(object);
|
||||
return object;
|
||||
}
|
||||
|
||||
public static <T> T assertNotNull(@Nullable T object) {
|
||||
InferBuiltins.assume_allocated(object);
|
||||
return object;
|
||||
}
|
||||
|
||||
public static <T> T assertNotNull(@Nullable T object, String explanation) {
|
||||
InferBuiltins.assume_allocated(object);
|
||||
return object;
|
||||
}
|
||||
|
||||
public static void assumeCondition(boolean condition) {
|
||||
InferBuiltins.assume(condition);
|
||||
}
|
||||
|
||||
public static void assumeCondition(boolean condition, String explanation) {
|
||||
InferBuiltins.assume(condition);
|
||||
}
|
||||
|
||||
public static void assertCondition(boolean condition) {
|
||||
InferBuiltins.assume(condition);
|
||||
}
|
||||
|
||||
public static void assertCondition(boolean condition, String explanation) {
|
||||
InferBuiltins.assume(condition);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue