How to avoid SonarLint' s False-Positive when assert-style null point check?

I have a BusinessException class below:

public class BusinessException extends RuntimeException {

    private final Integer code;

    private final String msg;

    public BusinessException(Integer code, String msg) {
        this.code = code;
        this.msg = msg;

     * assert-style check
    public static void failBuild(boolean isError, Integer errorCode, String message) {
        if (isError) {
            throw new BusinessException(errorCode, message);

    public String toString() {
        return String.format("BizErrorCodeException:[code=%s,msg=%s]", code, msg);

and I invoke BusinessException#failBuild like this in the other class:

public class MyService {

    public void test(Order dto) {
        BusinessException.failBuild(Objects.isNull(dto), ErrorCodeEnum.PARAM_FAIL);
        //SonarLint' s FP here: dto is nullable here"orderId: {}", dto.getId())


There are two java source code files: and

My software information:

  • IDEA 2021.3
  • SonarLint

I found some discuss in the community or stackoverflow, I know the symbolic execution engine. I want to know how to avoid this FP? Is there some jsr305’s annotations I can used?