VisibleForTesting
437613
Optional<String> writeTimeGauge(TimeGauge gauge) {
        Double value = gauge.value(getBaseTimeUnit());
        if (Double.isFinite(value)) {
            return Optional.of(writeDocument(gauge, builder -> {
                builder.append(",\"value\":").append(value);
            }));
        }
        return Optional.empty();
    }
311454
@Override
    public void sawOpcode(int seen) {
        if (isInitializer) {
            lookForCustomThreadFactoriesInConstructors(seen);
            return;
        }

        try {
            stack.precomputation(this);

            if ((seen == Const.INVOKEVIRTUAL) || (seen == Const.INVOKEINTERFACE)) {
                processInvoke();
            }
            // TODO Should not include private methods
            else if (seen == Const.ARETURN) {
                removeFieldsThatGetReturned();
            } else if (seen == Const.PUTFIELD) {
                XField f = getXFieldOperand();
                if (f != null) {
                    reportOverwrittenField(f);
                }
            } else if (seen == Const.IFNONNULL) {
                // indicates a null check, which means that we get an exemption
                // until the end of the branch
                OpcodeStack.Item nullCheckItem = stack.getStackItem(0);
                XField fieldWhichWasNullChecked = nullCheckItem.getXField();
                if (fieldWhichWasNullChecked != null) {
                    exemptExecutors.put(fieldWhichWasNullChecked, Integer.valueOf(getPC() + getBranchOffset()));
                }
            }
        } finally {
            stack.sawOpcode(this, seen);
        }
    }
22794
@Override
    public void sawOpcode(int seen) {
        boolean sawSBToString = false;
        try {

            stack.precomputation(this);
            if ((seen >= Const.IRETURN) && (seen <= Const.ARETURN)) {
                if (stack.getStackDepth() > 0) {
                    OpcodeStack.Item item = stack.getStackItem(0);

                    Integer register = Integer.valueOf(item.getRegisterNumber());
                    Object constant = registerConstants.get(register);
                    if (CONSTANT_DOESNT_EXIST.equals(constant)) {
                        throw new StopOpcodeParsingException();
                    }

                    String returnSig = item.getSignature();
                    if ((returnSig != null) && returnSig.startsWith(Values.SIG_ARRAY_PREFIX)) {
                        XField f = item.getXField();
                        if ((f == null) || (!f.isStatic())) {
                            throw new StopOpcodeParsingException();
                        }
                    }

                    constant = item.getConstant();
                    if (constant == null) {
                        throw new StopOpcodeParsingException();
                    }
                    if (Boolean.TRUE.equals(item.getUserValue()) && ("".equals(constant))) {
                        throw new StopOpcodeParsingException();
                    }
                    if ((returnConstant != null) && (!returnConstant.equals(constant))) {
                        throw new StopOpcodeParsingException();
                    }

                    returnRegister = Integer.valueOf(item.getRegisterNumber());
                    returnConstant = constant;
                    returnPC = getPC();
                }
            } else if ((seen == Const.GOTO) || (seen == Const.GOTO_W)) {
                if (stack.getStackDepth() > 0) {
                    // Ternaries confuse us too much, if the code has a ternary well - oh well
                    throw new StopOpcodeParsingException();
                }
            } else if (seen == Const.ATHROW) {
                throw new StopOpcodeParsingException();
            } else if (seen == Const.INVOKEVIRTUAL) {
                String clsName = getClassConstantOperand();
                if (SignatureUtils.isPlainStringConvertableClass(clsName)) {
                    sawSBToString = Values.TOSTRING.equals(getNameConstantOperand());
                }
            } else if (((seen >= Const.ISTORE) && (seen <= Const.ASTORE_3)) || (seen == Const.IINC)) {
                Integer register = Integer.valueOf(getRegisterOperand());
                if ((returnRegister.intValue() != -1) && (register.equals(returnRegister))) {
                    throw new StopOpcodeParsingException();
                }

                if (stack.getStackDepth() > 0) {
                    OpcodeStack.Item item = stack.getStackItem(0);
                    Object constant = item.getConstant();

                    Object regConstant = registerConstants.get(register);
                    if (regConstant != null) {
                        if ((constant == null) || !constant.equals(regConstant)) {
                            registerConstants.put(register, CONSTANT_DOESNT_EXIST);
                        }
                    } else {
                        if (item.getSignature().contains(Values.SIG_ARRAY_PREFIX)) {
                            registerConstants.put(register, CONSTANT_DOESNT_EXIST);
                        } else {
                            registerConstants.put(register, constant == null ? CONSTANT_DOESNT_EXIST : constant);
                        }
                    }
                } else {
                    registerConstants.put(register, CONSTANT_DOESNT_EXIST);
                }

                if (returnRegister.equals(register)) {
                    Object constant = registerConstants.get(returnRegister);
                    if (CONSTANT_DOESNT_EXIST.equals(constant)) {
                        throw new StopOpcodeParsingException();
                    }
                }
            }

        } finally {
            TernaryPatcher.pre(stack, seen);
            stack.sawOpcode(this, seen);
            TernaryPatcher.post(stack, seen);
            if (sawSBToString && (stack.getStackDepth() > 0)) {
                OpcodeStack.Item item = stack.getStackItem(0);
                item.setUserValue(Boolean.TRUE);
            }
        }
    }
600912
int writeJavaAnnotations(List<Attribute.Compound> attrs) {
        if (attrs.isEmpty()) return 0;
        ListBuffer<Attribute.Compound> visibles = new ListBuffer<Attribute.Compound>();
        ListBuffer<Attribute.Compound> invisibles = new ListBuffer<Attribute.Compound>();
        for (Attribute.Compound a : attrs) {
            switch (types.getRetention(a)) {
            case SOURCE: break;
            case CLASS: invisibles.append(a); break;
            case RUNTIME: visibles.append(a); break;
            default: ;// /* fail soft */ throw new AssertionError(vis);
            }
        }

        int attrCount = 0;
        if (visibles.length() != 0) {
            int attrIndex = writeAttr(names.RuntimeVisibleAnnotations);
            databuf.appendChar(visibles.length());
            for (Attribute.Compound a : visibles)
                writeCompoundAttribute(a);
            endAttr(attrIndex);
            attrCount++;
        }
        if (invisibles.length() != 0) {
            int attrIndex = writeAttr(names.RuntimeInvisibleAnnotations);
            databuf.appendChar(invisibles.length());
            for (Attribute.Compound a : invisibles)
                writeCompoundAttribute(a);
            endAttr(attrIndex);
            attrCount++;
        }
        return attrCount;
    }
1285212
@Override
    public void sawOpcode(int seen) {
        if (seen != Const.INVOKESPECIAL) {
            return;
        }

        String calledClassName = getClassConstantOperand();
        String calledMethodName = getNameConstantOperand();
        String calledMethodSig = getSigConstantOperand();
        if (calledClassName.equals(getSuperclassName()) && calledMethodName.equals(getMethodName())
                && calledMethodSig.equals(getMethodSig())) {
            sawCallToSuper = true;
        }

    }
1239414
@Override
    public void sawOpcode(final int seen) {
        try {
            stack.precomputation(this);

            BitSet regs = localScopeEnds.remove(Integer.valueOf(getPC()));
            if (regs != null) {
                int i = regs.nextSetBit(0);
                while (i >= 0) {
                    localCollections.remove(i);
                    localSourceLineAnnotations.remove(i);
                    i = regs.nextSetBit(i + 1);
                }
            }
            if (seen == Const.INVOKEINTERFACE) {
                String className = getClassConstantOperand();
                if (COLLECTION_CLASSES.contains(className)) {
                    String methodName = getNameConstantOperand();
                    String methodSig = getSigConstantOperand();
                    if ("add".equals(methodName) && SignatureBuilder.SIG_OBJECT_TO_BOOLEAN.equals(methodSig)) {
                        if (stack.getStackDepth() > 1) {
                            OpcodeStack.Item colItm = stack.getStackItem(1);
                            OpcodeStack.Item addItm = stack.getStackItem(0);
                            checkAdd(colItm, addItm);
                        }
                    } else if (("put".equals(methodName) && SignatureBuilder.SIG_TWO_OBJECTS_TO_OBJECT.equals(methodSig)) && (stack.getStackDepth() > 2)) {
                        // For maps, just check the keys
                        OpcodeStack.Item colItm = stack.getStackItem(2);
                        OpcodeStack.Item addItm = stack.getStackItem(1);
                        checkAdd(colItm, addItm);
                    }
                }
            } else if (seen == Const.AASTORE) {
                if (stack.getStackDepth() > 2) {
                    OpcodeStack.Item arrayItm = stack.getStackItem(2);
                    OpcodeStack.Item addItm = stack.getStackItem(0);
                    checkAdd(arrayItm, addItm);
                }
            } else if (OpcodeUtils.isAStore(seen)) {
                Integer reg = Integer.valueOf(RegisterUtils.getAStoreReg(this, seen));
                localCollections.remove(reg);
                localSourceLineAnnotations.remove(reg);
            }
        } catch (ClassNotFoundException cnfe) {
            bugReporter.reportMissingClass(cnfe);
        } finally {
            stack.sawOpcode(this, seen);
        }
    }
37815
@Override
    public void sawOpcode(int seen) {
        Integer tosIsPriority = null;
        try {
            stack.precomputation(this);

            switch (seen) {
                case Const.GETFIELD:
                    tosIsPriority = OWNED;
                break;

                case Const.ALOAD:
                case Const.ALOAD_0:
                case Const.ALOAD_1:
                case Const.ALOAD_2:
                case Const.ALOAD_3: {
                    int reg = RegisterUtils.getALoadReg(this, seen);
                    if ((reg == 0) && getMethod().isStatic()) {
                        tosIsPriority = Values.LOW_BUG_PRIORITY;
                    } else {
                        tosIsPriority = regPriorities.get(Integer.valueOf(reg));
                        if (tosIsPriority == null) {
                            tosIsPriority = Values.NORMAL_BUG_PRIORITY;
                        }
                    }
                }
                break;

                case Const.ASTORE:
                case Const.ASTORE_0:
                case Const.ASTORE_1:
                case Const.ASTORE_2:
                case Const.ASTORE_3: {
                    if (stack.getStackDepth() > 0) {
                        OpcodeStack.Item item = stack.getStackItem(0);
                        Integer priority = (Integer) item.getUserValue();
                        regPriorities.put(Integer.valueOf(RegisterUtils.getAStoreReg(this, seen)), priority);
                    }
                }
                break;

                case Const.INVOKEVIRTUAL:
                case Const.INVOKEINTERFACE: {
                    String sig = getSigConstantOperand();
                    if (SignatureUtils.getReturnSignature(sig).startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) {
                        int parmCnt = SignatureUtils.getNumParameters(sig);
                        if (stack.getStackDepth() > parmCnt) {
                            OpcodeStack.Item itm = stack.getStackItem(parmCnt);
                            Integer priority = (Integer) itm.getUserValue();
                            if ((priority != null) && OWNED.equals(priority)) {
                                tosIsPriority = OWNED;
                            } else {
                                int reg = itm.getRegisterNumber();
                                if (reg > 0) {
                                    tosIsPriority = regPriorities.get(Integer.valueOf(reg));
                                } else {
                                    tosIsPriority = OWNED;
                                }
                            }
                        }
                    }
                }
                break;

                case Const.INVOKESTATIC: {
                    String sig = getSigConstantOperand();
                    if (SignatureUtils.getReturnSignature(sig).startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) {
                        tosIsPriority = OWNED; // can't be sure
                    }
                }
                break;

                case Const.INVOKESPECIAL: {
                    String name = getNameConstantOperand();
                    if (Values.CONSTRUCTOR.equals(name)) {
                        tosIsPriority = OWNED;
                    }
                }
                break;

                case Const.MONITORENTER: {
                    if (stack.getStackDepth() > 0) {
                        OpcodeStack.Item itm = stack.getStackItem(0);
                        Integer priority = (Integer) itm.getUserValue();
                        if ((priority != null) && (!priority.equals(OWNED))) {
                            bugReporter.reportBug(new BugInstance(this, BugType.NOS_NON_OWNED_SYNCHRONIZATION.name(), priority.intValue()).addClass(this)
                                    .addMethod(this).addSourceLine(this));
                        }
                    }
                }
                break;
                default:
                break;
            }
        } finally {
            TernaryPatcher.pre(stack, seen);
            stack.sawOpcode(this, seen);
            TernaryPatcher.post(stack, seen);
            if ((tosIsPriority != null) && (stack.getStackDepth() > 0)) {
                OpcodeStack.Item itm = stack.getStackItem(0);
                itm.setUserValue(tosIsPriority);
            }
        }
    }
661088
@Override
    public void sawOpcode(int seen) {
        ImmutabilityType seenImmutable = null;
        try {
            stack.precomputation(this);

            switch (seen) {
                case Const.INVOKESTATIC: {
                    String className = getClassConstantOperand();
                    String methodName = getNameConstantOperand();

                    if (IMMUTABLE_PRODUCING_METHODS.contains(className + '.' + methodName)) {
                        seenImmutable = ImmutabilityType.IMMUTABLE;
                        break;
                    }
                }
                //$FALL-THROUGH$
                case Const.INVOKEINTERFACE:
                case Const.INVOKESPECIAL:
                case Const.INVOKEVIRTUAL: {
                    String className = getClassConstantOperand();
                    String methodName = getNameConstantOperand();
                    String signature = getSigConstantOperand();

                    MethodInfo mi = Statistics.getStatistics().getMethodStatistics(className, methodName, signature);
                    seenImmutable = mi.getImmutabilityType();
                    if (seenImmutable == ImmutabilityType.UNKNOWN) {
                        seenImmutable = null;
                    }
                }
                break;

                case Const.ARETURN: {
                    processARreturn();
                    break;
                }
                default:
                break;
            }

        } finally {
            stack.sawOpcode(this, seen);
            if ((seenImmutable != null) && (stack.getStackDepth() > 0)) {
                OpcodeStack.Item item = stack.getStackItem(0);
                item.setUserValue(seenImmutable);
            }
        }
    }
1203300
@Override
    public boolean isReadOnly(ELContext context)
            throws PropertyNotFoundException, ELException {
        EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
                this.varMapper);
        context.notifyBeforeEvaluation(getExpressionString());
        boolean result = this.getNode().isReadOnly(ctx);
        context.notifyAfterEvaluation(getExpressionString());
        return result;
    }
1152959
@Override
    public void sawOpcode(int seen) {

        try {
            stack.precomputation(this);

            if ((seen == Const.INVOKEVIRTUAL) || (seen == Const.INVOKEINTERFACE)) {
                FQMethod key = new FQMethod(getClassConstantOperand(), getNameConstantOperand(), getSigConstantOperand());

                Object posObject = characterMethods.get(key);
                if (posObject instanceof Integer) {
                    if (checkSingleParamMethod(((Integer) posObject).intValue()) && !isInlineAppend(key)) {
                        reportBug();
                    }
                } else if ((posObject instanceof IntPair) && checkDoubleParamMethod((IntPair) posObject)) {
                    reportBug();
                }

            } else if (seen == Const.DUP) {
                if (stack.getStackDepth() > 0) {
                    OpcodeStack.Item itm = stack.getStackItem(0);
                    String duppedSig = itm.getSignature();
                    if (Values.SIG_JAVA_UTIL_STRINGBUILDER.equals(duppedSig) || Values.SIG_JAVA_UTIL_STRINGBUFFER.equals(duppedSig)) {
                        itm.setUserValue(UCPMUserValue.INLINE);
                    }
                }
            } else if ((seen == Const.PUTFIELD) || (((seen == Const.PUTSTATIC) || OpcodeUtils.isAStore(seen)) && (stack.getStackDepth() > 0))) {
                OpcodeStack.Item itm = stack.getStackItem(0);
                itm.setUserValue(null);
            }
        } finally {
            UCPMUserValue uv = callHasInline(seen);

            stack.sawOpcode(this, seen);
            if ((uv == UCPMUserValue.INLINE) && (stack.getStackDepth() > 0)) {
                OpcodeStack.Item itm = stack.getStackItem(0);
                itm.setUserValue(uv);
            }
        }
    }
384726
@Override
    public void sawOpcode(int seen) {
        try {
            stack.precomputation(this);

            if (unsafeCallOccurred && OpcodeUtils.isAStore(seen)) {
                int storeReg = RegisterUtils.getAStoreReg(this, seen);
                if (storeReg >= 0) {
                    unsafeAliases.set(storeReg);
                }
            }

            if ((seen == Const.INVOKEVIRTUAL) || (seen == Const.INVOKESPECIAL) || (seen == Const.INVOKEINTERFACE) || (seen == Const.INVOKEDYNAMIC)) {
                String methodSig = getSigConstantOperand();

                MethodInfo mi = Statistics.getStatistics().getMethodStatistics(getClassConstantOperand(), getNameConstantOperand(), methodSig);
                if (mi.getModifiesState()) {
                    unsafeCallOccurred = true;
                } else {
                    if (!Values.SIG_VOID.equals(SignatureUtils.getReturnSignature(methodSig))) {
                        int parmCount = SignatureUtils.getNumParameters(methodSig);
                        if (stack.getStackDepth() > parmCount) {
                            OpcodeStack.Item itm = stack.getStackItem(parmCount);
                            unsafeCallOccurred = unsafeAliases.get(itm.getRegisterNumber());
                        } else {
                            unsafeCallOccurred = false;
                        }
                    } else {
                        unsafeCallOccurred = false;
                    }
                }
            } else if (seen == Const.INVOKESTATIC) {
                unsafeCallOccurred = getDottedClassConstantOperand().equals(this.getClassContext().getJavaClass().getClassName());
            } else if (((seen >= Const.IFEQ) && (seen <= Const.GOTO)) || (seen == Const.GOTO_W)) {
                Integer from = Integer.valueOf(getPC());
                Integer to = Integer.valueOf(getBranchTarget());
                branchInfo.put(from, to);
                unsafeCallOccurred = false;
            } else {
                unsafeCallOccurred = false;
            }

            if (seen == Const.MONITORENTER) {
                if (syncPC < 0) {
                    syncPC = getPC();
                    if (stack.getStackDepth() > 0) {
                        OpcodeStack.Item itm = stack.getStackItem(0);
                        int monitorReg = itm.getRegisterNumber();
                        if (monitorReg >= 0) {
                            unsafeAliases.set(monitorReg);
                        }
                    }
                }
            } else if (seen == Const.MONITOREXIT) {
                syncPC = -1;
            } else if (syncPC >= 0) {
                processSyncBlockInstruction(seen);
            }
        } finally {
            stack.sawOpcode(this, seen);
        }
    }
631320
@Override
  public FieldVisitor visitField(int access,
                                 String name,
                                 String description,
                                 String signature,
                                 Object value) {
    assert (currentClass != null);
    if (signature == null)
      signature = description + " " + name;
    return currentClass.visitField(access, name, description,
        signature, value);
  }
434630
@Override
    public void sawOpcode(int seen) {
        Integer sawALOADReg = null;
        try {
            stack.precomputation(this);

            int pc = getPC();
            nullGuards.remove(Integer.valueOf(pc));
            clearEndOfLifeRegisters();

            switch (seen) {
                case Const.IFNULL: {
                    if (stack.getStackDepth() > 0) {
                        OpcodeStack.Item itm = stack.getStackItem(0);
                        int reg = itm.getRegisterNumber();
                        Integer target = Integer.valueOf(getBranchTarget());
                        if (reg >= 0) {
                            int eol = Integer.MAX_VALUE;
                            LocalVariableTable lvt = getMethod().getLocalVariableTable();
                            if (lvt != null) {
                                LocalVariable lv = lvt.getLocalVariable(reg, pc);
                                if (lv != null) {
                                    eol = pc + lv.getLength();
                                }
                            }

                            nullGuards.put(target, new NullGuard(reg, pc, eol, itm.getSignature()));
                        } else {
                            XField xf = itm.getXField();
                            Integer sourceFieldReg = (Integer) itm.getUserValue();
                            if ((xf != null) && (sourceFieldReg != null)) {
                                nullGuards.put(target, new NullGuard(xf, sourceFieldReg.intValue(), pc, itm.getSignature()));
                            }
                        }
                    }
                }
                break;

                case Const.ASTORE:
                case Const.ASTORE_0:
                case Const.ASTORE_1:
                case Const.ASTORE_2:
                case Const.ASTORE_3: {
                    if (stack.getStackDepth() > 0) {
                        OpcodeStack.Item itm = stack.getStackItem(0);
                        if (!itm.isNull()) {
                            NullGuard guard = findNullGuardWithRegister(RegisterUtils.getAStoreReg(this, seen));
                            if (guard != null) {
                                bugReporter.reportBug(new BugInstance(this, BugType.SNG_SUSPICIOUS_NULL_LOCAL_GUARD.name(), NORMAL_PRIORITY).addClass(this)
                                        .addMethod(this).addSourceLine(this));
                                removeNullGuard(guard);
                            }
                        }
                    }
                }
                break;

                case Const.ALOAD:
                case Const.ALOAD_0:
                case Const.ALOAD_1:
                case Const.ALOAD_2:
                case Const.ALOAD_3: {
                    NullGuard guard = findNullGuardWithRegister(RegisterUtils.getALoadReg(this, seen));
                    if (guard != null) {
                        removeNullGuard(guard);
                    }
                    sawALOADReg = Integer.valueOf(RegisterUtils.getALoadReg(this, seen));
                }
                break;

                case Const.PUTFIELD: {
                    if (stack.getStackDepth() <= 1) {
                        break;
                    }
                    OpcodeStack.Item itm = stack.getStackItem(0);
                    if (itm.isNull()) {
                        break;
                    }
                    XField xf = getXFieldOperand();
                    itm = stack.getStackItem(1);
                    Integer fieldSourceReg = (Integer) itm.getUserValue();
                    if ((xf != null) && (fieldSourceReg != null)) {
                        NullGuard guard = findNullGuardWithField(xf, fieldSourceReg.intValue());
                        if (guard != null) {
                            bugReporter.reportBug(new BugInstance(this, BugType.SNG_SUSPICIOUS_NULL_FIELD_GUARD.name(), NORMAL_PRIORITY).addClass(this)
                                    .addMethod(this).addSourceLine(this));
                            removeNullGuard(guard);
                        }
                    }
                }
                break;

                case Const.GETFIELD: {
                    if (stack.getStackDepth() > 0) {
                        XField xf = getXFieldOperand();
                        OpcodeStack.Item itm = stack.getStackItem(0);
                        Integer fieldSourceReg = (Integer) itm.getUserValue();
                        if ((xf != null) && (fieldSourceReg != null)) {
                            NullGuard guard = findNullGuardWithField(xf, fieldSourceReg.intValue());
                            if (guard != null) {
                                removeNullGuard(guard);
                            } else {
                                sawALOADReg = (Integer) itm.getUserValue();
                            }
                        }
                    }
                }
                break;

                case Const.IFEQ:
                case Const.IFNE:
                case Const.IFLT:
                case Const.IFGE:
                case Const.IFGT:
                case Const.IFLE:
                case Const.IF_ICMPEQ:
                case Const.IF_ICMPNE:
                case Const.IF_ICMPLT:
                case Const.IF_ICMPGE:
                case Const.IF_ICMPGT:
                case Const.IF_ICMPLE:
                case Const.IF_ACMPEQ:
                case Const.IF_ACMPNE:
                case Const.GOTO:
                case Const.GOTO_W:
                case Const.IFNONNULL:
                    nullGuards.clear();
                break;
                default:
                break;
            }
        } finally {
            stack.sawOpcode(this, seen);
            if ((sawALOADReg != null) && (stack.getStackDepth() > 0)) {
                OpcodeStack.Item itm = stack.getStackItem(0);
                itm.setUserValue(sawALOADReg);
            }
        }
    }
611336
@Override
    public void sawOpcode(int seen) {
        switch (state) {
            case SAW_NOTHING:
                if (seen == Const.CHECKCAST) {
                    castClass = getClassConstantOperand();
                    state = State.SAW_CHECKCAST;
                } else if (seen == Const.INVOKEINTERFACE) {
                    // enhanced for loops add an incorrect checkcast instruction, so
                    // ignore checkcasts after iterator.next()
                    String clsName = getClassConstantOperand();
                    String methodName = getNameConstantOperand();
                    if ("java/util/Iterator".equals(clsName) && "next".equals(methodName)) {
                        state = State.SAW_NEXT;
                    }
                }
            break;

            case SAW_CHECKCAST:
                if (OpcodeUtils.isAStore(seen)) {
                    int reg = RegisterUtils.getAStoreReg(this, seen);
                    LocalVariable lv = lvt.getLocalVariable(reg, getNextPC());
                    if (lv != null) {
                        String sig = lv.getSignature();
                        if (sig.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) {
                            sig = SignatureUtils.trimSignature(sig);
                        }
                        if (!sig.equals(castClass)) {
                            bugReporter.reportBug(new BugInstance(this, BugType.OC_OVERZEALOUS_CASTING.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
                                    .addSourceLine(this));
                        }
                    }
                } else if (seen == Const.PUTFIELD) {
                    FieldAnnotation f = FieldAnnotation.fromReferencedField(this);
                    String sig = f.getFieldSignature();
                    if (sig.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) {
                        sig = SignatureUtils.trimSignature(sig);
                    }
                    // if the signature is Object, the field might be genericized, so ignore
                    if (!Values.SLASHED_JAVA_LANG_OBJECT.equals(sig) && !sig.equals(castClass)) {
                        bugReporter.reportBug(new BugInstance(this, BugType.OC_OVERZEALOUS_CASTING.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
                                .addSourceLine(this));
                    }
                }
                state = State.SAW_NOTHING;
            break;

            case SAW_NEXT:
            default:
                state = State.SAW_NOTHING;
            break;
        }
    }
1001432
@Override
    public void sawOpcode(int seen) {
        int reg = -1;
        Object uValue = null;
        boolean sawAlias = false;
        boolean sawLoad = false;
        boolean sawNewArray = false;

        try {
            stack.precomputation(this);

            if (seen == Const.INVOKEINTERFACE) {
                String methodName = getNameConstantOperand();
                String signature = getSigConstantOperand();
                if ("size".equals(methodName) && SignatureBuilder.SIG_VOID_TO_INT.equals(signature)) {
                    if (stack.getStackDepth() > 0) {
                        OpcodeStack.Item itm = stack.getStackItem(0);
                        reg = isLocalCollection(itm);
                        if (reg >= 0) {
                            sawAlias = true;
                        }
                    }
                } else if ("get".equals(methodName) && SignatureBuilder.SIG_INT_TO_OBJECT.equals(signature)) {
                    if (stack.getStackDepth() > 1) {
                        OpcodeStack.Item itm = stack.getStackItem(1);
                        reg = isLocalCollection(itm);
                        if (reg >= 0) {
                            sawAlias = true;
                        }
                    }
                } else if (("keySet".equals(methodName) || "values".equals(methodName) || "iterator".equals(methodName) || "next".equals(methodName))
                        && (stack.getStackDepth() > 0)) {
                    OpcodeStack.Item itm = stack.getStackItem(0);
                    reg = isLocalCollection(itm);
                    if (reg >= 0) {
                        sawAlias = true;
                    }
                }
            } else if (OpcodeUtils.isIStore(seen) || OpcodeUtils.isAStore(seen)) {
                if (stack.getStackDepth() > 0) {
                    uValue = stack.getStackItem(0).getUserValue();
                    userValues.put(Integer.valueOf(RegisterUtils.getStoreReg(this, seen)), uValue);
                }
            } else if (OpcodeUtils.isILoad(seen) || OpcodeUtils.isALoad(seen)) {
                sawLoad = true;
            } else if (seen == Const.ANEWARRAY) {
                if (stack.getStackDepth() > 0) {
                    OpcodeStack.Item itm = stack.getStackItem(0);
                    uValue = itm.getUserValue();
                    sawNewArray = true;
                }
            } else if (seen == Const.IF_ICMPGE) {
                if (stack.getStackDepth() > 1) {
                    OpcodeStack.Item itm1 = stack.getStackItem(1);
                    OpcodeStack.Item itm2 = stack.getStackItem(0);
                    reg = itm1.getRegisterNumber();
                    if ((reg >= 0) && (itm1.couldBeZero())) {
                        uValue = itm2.getUserValue();
                        if (uValue != null) {
                            userValues.put(Integer.valueOf(reg), uValue);
                        }
                    }
                }
            } else if ((seen >= Const.IASTORE) && (seen <= Const.SASTORE)) {
                if (stack.getStackDepth() > 2) {
                    OpcodeStack.Item arItem = stack.getStackItem(2);
                    OpcodeStack.Item idxItem = stack.getStackItem(1);
                    OpcodeStack.Item valueItem = stack.getStackItem(0);
                    reg = isLocalCollection(arItem);
                    if ((reg >= 0) && (idxItem.getUserValue() != null) && (valueItem.getUserValue() != null)) {
                        bugReporter.reportBug(
                                new BugInstance(this, BugType.UTA_USE_TO_ARRAY.name(), NORMAL_PRIORITY).addClass(this).addMethod(this).addSourceLine(this));
                    }
                }
            } else if ((seen == Const.CHECKCAST) && (stack.getStackDepth() > 0)) {
                OpcodeStack.Item itm = stack.getStackItem(0);
                uValue = itm.getUserValue();
                if (uValue instanceof Integer) {
                    reg = ((Integer) uValue).intValue();
                    sawAlias = true;
                }
            }
        } catch (ClassNotFoundException cnfe) {
            bugReporter.reportMissingClass(cnfe);
        } finally {
            TernaryPatcher.pre(stack, seen);
            stack.sawOpcode(this, seen);
            TernaryPatcher.post(stack, seen);
            if (sawAlias) {
                if (stack.getStackDepth() > 0) {
                    OpcodeStack.Item itm = stack.getStackItem(0);
                    itm.setUserValue(Integer.valueOf(reg));
                }
            } else if (sawLoad) {
                if (stack.getStackDepth() > 0) {
                    OpcodeStack.Item itm = stack.getStackItem(0);
                    reg = itm.getRegisterNumber();
                    if (reg >= 0) {
                        uValue = userValues.get(Integer.valueOf(reg));
                        itm.setUserValue(uValue);
                    }
                }
            } else if (sawNewArray && (stack.getStackDepth() > 0)) {
                OpcodeStack.Item itm = stack.getStackItem(0);
                itm.setUserValue(uValue);
            }
        }
    }
473215
private static boolean checkAnnotation(AnnotationsAttribute invisible, AnnotationsAttribute visible,
            String annotationName) {
        boolean exist1 = false;
        boolean exist2 = false;
        if (invisible != null) {
            exist1 = invisible.getAnnotation(annotationName) != null;
        }
        if (visible != null) {
            exist2 = visible.getAnnotation(annotationName) != null;
        }
        return exist1 || exist2;
    }
152718
@Override
    public void sawOpcode(int seen) {
        try {

            stack.precomputation(this);

            if ((seen == Const.ARETURN) && (stack.getStackDepth() > 0)) {
                OpcodeStack.Item item = stack.getStackItem(0);
                if (item.isNull()) {
                    bugReporter.reportBug(new BugInstance(this, BugType.TBP_TRISTATE_BOOLEAN_PATTERN.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
                            .addSourceLine(this));
                    throw new StopOpcodeParsingException();
                }
            }
        } finally {
            stack.sawOpcode(this, seen);
        }
    }