Outputs bytecode that will test the item at the top of the stack for null, and branch to {@code
nullExit} if it is {@code null}. At {@code nullSafeExit} there will be a null value at the top
of the stack.
485459
public static void nullCoalesce(CodeBuilder builder, Label nullExit) {
    builder.dup();
    Label nonNull = new Label();
    builder.ifNonNull(nonNull);
    // See http://mail.ow2.org/wws/arc/asm/2016-02/msg00001.html for a discussion of this pattern
    // but even though the value at the top of the stack here is null, its type isn't.  So we need
    // to pop and push.  This is the idiomatic pattern.
    builder.pop();
    builder.pushNull();
    builder.goTo(nullExit);
    builder.mark(nonNull);
  }
29543
@Override
    public void sawOpcode(int seen) {
        if (DEBUG) {
            System.out.println(getPC() + " " + Const.getOpcodeName(seen));
        }
        switch (seen) {
        case Const.IFNE:
        case Const.IFEQ: {
            OpcodeStack.Item top = stack.getStackItem(0);
            if (DEBUG) {
                System.out.println("Stack top: " + top);
            }
            XMethod m = top.getReturnValueOf();
            if (m != null && "java.util.concurrent.ConcurrentHashMap".equals(m.getClassName())
                    && "containsKey".equals(m.getName())) {
                lastQuestionableCheckTarget = getBranchTarget();
                if (seen == Const.IFEQ) {
                    priority = LOW_PRIORITY;
                } else if (seen == Const.IFNE) {
                    priority = NORMAL_PRIORITY;
                }
            }
            break;
        }
        case Const.IFNULL:
        case Const.IFNONNULL: {
            OpcodeStack.Item top = stack.getStackItem(0);
            if (DEBUG) {
                System.out.println("Stack top: " + top);
            }
            XMethod m = top.getReturnValueOf();
            if (DEBUG) {
                System.out.println("Found null check");
            }
            if (m != null && "java.util.concurrent.ConcurrentHashMap".equals(m.getClassName()) && "get".equals(m.getName())) {
                lastQuestionableCheckTarget = getBranchTarget();
                if (seen == Const.IFNULL) {
                    priority = LOW_PRIORITY;
                } else if (seen == Const.IFNONNULL) {
                    priority = NORMAL_PRIORITY;
                }
            }
            break;
        }
        case Const.INVOKEVIRTUAL:
        case Const.INVOKEINTERFACE: {
            if ("java.util.concurrent.ConcurrentHashMap".equals(getDottedClassConstantOperand())) {
                String methodName = getNameConstantOperand();
                XClass xClass = getXClassOperand();
                if (xClass != null && "put".equals(methodName)) {
                    if ((getPC() < lastQuestionableCheckTarget) && (lastQuestionableCheckTarget != -1)) {
                        bugReporter.reportBug(new BugInstance(this, "AT_OPERATION_SEQUENCE_ON_CONCURRENT_ABSTRACTION", priority)
                        .addClassAndMethod(this).addType(xClass.getClassDescriptor()).addCalledMethod(this)
                        .addSourceLine(this));
                    }
                }
            }
            break;
        }
        default:
            break;
        }
    }
328033
void endIfStarted(CodeAttribute b, ClassMethod method) {
        b.aload(getLocalVariableIndex(0));
        b.dup();
        final BranchEnd ifnotnull = b.ifnull();
        b.checkcast(Stack.class);
        b.invokevirtual(Stack.class.getName(), END_INTERCEPTOR_CONTEXT_METHOD_NAME, EMPTY_PARENTHESES + VOID_CLASS_DESCRIPTOR);
        BranchEnd ifnull = b.gotoInstruction();
        b.branchEnd(ifnotnull);
        b.pop(); // remove null Stack
        b.branchEnd(ifnull);
    }
778323
public static void checkNotNull(Object o, String msg, int arg1) {
        if (o == null) {
            throwNullPointerEx(msg, arg1);
        }
    }
1014118
private <T> T nullSafe(T actual, T safe) {
		return actual == null ? safe : actual;
	}
1303001
@Override
    public void execute() throws BuildException {
        if (ifCondition != null) {
            final String msg = MessageUtils.getMessage("DOTA014W", "if", "if:set")
                    .setLocation(this.getLocation())
                    .toString();
            getProject().log(msg, Project.MSG_WARN);
        }
        if (unlessCondition != null) {
            final String msg = MessageUtils.getMessage("DOTA014W", "unless", "unless:set")
                    .setLocation(this.getLocation())
                    .toString();
            getProject().log(msg, Project.MSG_WARN);
        }
        final boolean fail = nestedConditionPresent()
                       ? testNestedCondition()
                       : (testIfCondition() && testUnlessCondition());
        if (!fail) {
            return;
        }

        if (id == null) {
            throw new BuildException("id attribute must be specified");
        }

        final MessageBean msgBean = MessageUtils.getMessage(id, readParamValues());
        final DITAOTLogger logger = new DITAOTAntLogger(getProject());
        if (msgBean != null) {
            final String type = msgBean.getType();
            if (FATAL.equals(type)) {
                setMessage(msgBean.toString());
                try {
                    super.execute();
                } catch (final BuildException ex) {
                    throw new BuildException(msgBean.toString(),new DITAOTException(msgBean, ex, msgBean.toString()));
                }
            } else if (ERROR.equals(type)) {
                logger.error(msgBean.toString());
            } else if (WARN.equals(type)) {
                logger.warn(msgBean.toString());
            } else if (INFO.equals(type)) {
                logger.info(msgBean.toString());
            } else if (DEBUG.equals(type)) {
                logger.debug(msgBean.toString());
            }
        }

        
    }
787038
@Override
    public void sawOpcode(int seen) {
        int lhsReg = -1;
        try {
            stack.precomputation(this);

            switch (state) {
                case SEEN_NOTHING:
                    if (!catchTargets.get(getPC()) && lookForStore(seen) && (stack.getStackDepth() >= 1)) {
                        OpcodeStack.Item item = stack.getStackItem(0);
                        Integer reg = (Integer) item.getUserValue();
                        if ((reg == null) || (reg.intValue() != storeReg)) {
                            state = State.SEEN_STORE;
                        }
                    }
                break;

                case SEEN_STORE:
                    if (branchTargets.get(getPC())) {
                        state = State.SEEN_NOTHING;
                        break;
                    }

                    state = lookForLoad(seen) ? State.SEEN_LOAD : State.SEEN_NOTHING;
                break;

                case SEEN_LOAD:
                    if ((seen >= Const.IRETURN) && (seen <= Const.ARETURN)) {
                        bugReporter.reportBug(new BugInstance(this, BugType.USBR_UNNECESSARY_STORE_BEFORE_RETURN.name(), NORMAL_PRIORITY).addClass(this)
                                .addMethod(this).addSourceLine(this));
                    }
                    state = State.SEEN_NOTHING;
                break;
            }

            if (branchInstructions.get(seen)) {
                branchTargets.set(getBranchTarget());
            }

            lhsReg = processBinOp(seen);

        } finally {
            TernaryPatcher.pre(stack, seen);
            stack.sawOpcode(this, seen);
            TernaryPatcher.post(stack, seen);
            if ((lhsReg > -1) && (stack.getStackDepth() >= 1)) {
                OpcodeStack.Item item = stack.getStackItem(0);
                item.setUserValue(Integer.valueOf(lhsReg));
            }
        }

    }
155842
@Override
    public void visitCode(final Code obj) {
        if (obj.getCode() != null) {
            stack.resetForMethodEntry(this);
            sawLDCEmpty = false;
            super.visitCode(obj);
        }
    }
1077892
@Override
    public void visitClassContext(ClassContext classContext) {
        try {
            branchTargets = new BitSet();
            catchTargets = new BitSet();
            stack = new OpcodeStack();
            super.visitClassContext(classContext);
        } finally {
            branchTargets = null;
            catchTargets = null;
            stack = null;
        }
    }
1266307
@Override
    public void visitCode(Code obj) {
        try {
            userValues = new HashMap<>();
            super.visitCode(obj);
        } finally {
            userValues = null;
        }
    }
208915
public void setNullValue(String nullValue) {
        this.nullValue = nullValue;
        this.nullValueChars = nullValue.toCharArray();
        this.nullValueBytes = toBytes(nullValue, nullValue);
    }
112319
@SuppressWarnings("unchecked")
    private boolean hasExceptionOnStack() {
        try {
            for (int i = 0; i < (stack.getStackDepth() - 1); i++) {
                OpcodeStack.Item item = stack.getStackItem(i);
                String sig = item.getSignature();
                if (sig.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) {
                    String name = SignatureUtils.stripSignature(sig);
                    JavaClass cls = Repository.lookupClass(name);
                    if (cls.instanceOf(throwableClass)) {
                        return true;
                    }
                } else if (sig.startsWith(Values.SIG_ARRAY_PREFIX)) {
                    LOUserValue<Integer> uv = (LOUserValue<Integer>) item.getUserValue();
                    if ((uv != null) && (uv.getType() == LOUserValue.LOType.ARRAY_SIZE)) {
                        Integer sz = uv.getValue();
                        if ((sz != null) && (sz.intValue() < 0)) {
                            return true;
                        }
                    }
                }
            }
            return false;
        } catch (ClassNotFoundException cnfe) {
            bugReporter.reportMissingClass(cnfe);
            return true;
        }
    }
92549
@Override
    public void visitCode(Code obj) {
        Method m = getMethod();
        stack.resetForMethodEntry(this);
        initializedRegs.clear();
        modifyRegs.clear();
        Type[] argTypes = m.getArgumentTypes();
        int arg = m.isStatic() ? 0 : 1;
        for (Type argType : argTypes) {
            String argSig = argType.getSignature();
            initializedRegs.set(arg);
            arg += SignatureUtils.getSignatureSize(argSig);
        }
        nullStoreToLocation.clear();
        super.visitCode(obj);

        for (Integer pc : nullStoreToLocation.values()) {
            bugReporter.reportBug(new BugInstance(this, BugType.AIOB_ARRAY_STORE_TO_NULL_REFERENCE.name(), HIGH_PRIORITY).addClass(this).addMethod(this)
                    .addSourceLine(this, pc.intValue()));
        }
    }
1260001
public static <T> T checkNotNull(T arg, String text) {
        if (arg == null) {
            throw new NullPointerException(text);
        }
        return arg;
    }
90210
public static void assertNull(String message, Object o) {
        if (o == null) {
            pass(message);
        } else {
            fail(message, "'" + o + "' is not null");
        }
    }
398966
public static <T> T checkNotNull(T value) throws NullPointerException {
    if (value == null) {
      throw new NullPointerException();
    }
    return value;
  }
388071
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "SF_SWITCH_FALLTHROUGH", justification = "This fall-through is deliberate and documented")
    @Override
    public void sawOpcode(int seen) {
        Object userObject = null;

        // saving and restoring the userobject of the top item, works around a
        // bug in Findbugs proper
        if (stack.getStackDepth() > 0) {
            userObject = stack.getStackItem(0).getUserValue();
        }
        stack.precomputation(this);
        if (stack.getStackDepth() > 0) {
            stack.getStackItem(0).setUserValue(userObject);
            userObject = null;
        }

        try {
            switch (seen) {
                case Const.INVOKESPECIAL:
                userObject = sawInvokeSpecial(userObject);
                break;
                case Const.INVOKEINTERFACE:
                case Const.INVOKEVIRTUAL:
                sawInvokeInterfaceVirtual();
                break;
                case Const.INVOKESTATIC:
                userObject = sawInvokeStatic(userObject);
                //$FALL-THROUGH$
                case Const.INVOKEDYNAMIC:
                processMethodParms();
                break;
                case Const.ARETURN:
                if (stack.getStackDepth() > 0) {
                    OpcodeStack.Item item = stack.getStackItem(0);
                    clearUserValue(item);
                } else {
                    // bad findbugs bug, which clears the stack after an ALOAD, in some cases
                    int prevOp = getPrevOpcode(1);
                    if (OpcodeUtils.isALoad(prevOp)) {
                        localSpecialObjects.clear();
                    }
                }
                break;

                case Const.ASTORE_0:
                case Const.ASTORE_1:
                case Const.ASTORE_2:
                case Const.ASTORE_3:
                case Const.ASTORE:
                sawAStore(seen);
                break;

                case Const.ALOAD_0:
                case Const.ALOAD_1:
                case Const.ALOAD_2:
                case Const.ALOAD_3:
                case Const.ALOAD:
                userObject = sawLoad(seen, userObject);
                break;

                case Const.AASTORE:
                if (stack.getStackDepth() >= 3) {
                    OpcodeStack.Item item = stack.getStackItem(0);
                    clearUserValue(item);
                }
                break;

                case Const.PUTFIELD:
                sawPutField();
                break;

                case Const.GETFIELD:
                userObject = sawGetField(userObject);
                break;

                case Const.PUTSTATIC:
                sawPutStatic();
                break;

                case Const.GETSTATIC:
                userObject = sawGetStatic(userObject);
                break;

                case Const.GOTO:
                case Const.IFNULL:
                case Const.IFNONNULL:
                if (stack.getStackDepth() > 0) {
                    OpcodeStack.Item item = stack.getStackItem(0);
                    Object uo = item.getUserValue();
                    if ((uo != null) && !(uo instanceof Boolean)) {
                        clearUserValue(item);
                    }
                    sawTernary = true;
                }
                break;
            default:
                break;
            }
        } finally {
            TernaryPatcher.pre(stack, seen);
            stack.sawOpcode(this, seen);
            TernaryPatcher.post(stack, seen);
            if ((userObject != null) && (stack.getStackDepth() > 0)) {
                OpcodeStack.Item item = stack.getStackItem(0);
                item.setUserValue(userObject);
            }
            if (sawTernary) {
                handleTernary(seen);
            }
        }
    }