overrides the visitor to navigate basic blocks looking for all first usages of fields, removing those that are read from first.

@param obj
the context object of the currently parsed method
349083
@Override
    public void visitMethod(Method obj) {
        if (localizableFields.isEmpty()) {
            return;
        }

        try {

            cfg = clsContext.getCFG(obj);
            cpg = cfg.getMethodGen().getConstantPool();
            BasicBlock bb = cfg.getEntry();
            Set<String> uncheckedFields = new HashSet<>(localizableFields.keySet());
            visitedBlocks.clear();
            checkBlock(bb, uncheckedFields);
        } catch (CFGBuilderException cbe) {
            localizableFields.clear();
        } finally {
            cfg = null;
            cpg = null;
        }
    }
551276
@Override
    public void visitCode(Code obj) {

        stack.resetForMethodEntry(this);
        localSpecialObjects.clear();
        sawTernary = false;
        super.visitCode(obj);

        for (Integer pc : localSpecialObjects.values()) {
            bugReporter.reportBug(
                    makeLocalBugInstance().addClass(this).addMethod(this).addSourceLine(this, pc.intValue()));
        }
    }
352927
@Override
    public void visitCode(Code obj) {
        state = State.SAW_NOTHING;
        lvt = obj.getLocalVariableTable();
        if ((lvt != null) && prescreen(getMethod())) {
            super.visitCode(obj);
        }
    }
753484
@Override
    public void visitCode(Code obj) {
        stack.resetForMethodEntry(this);
        toStringRegisters.clear();
        super.visitCode(obj);
    }
593034
@Override
    public void visitCode(Code obj) {
        stack.resetForMethodEntry(this);
        exemptExecutors.clear();

        if (!hangingFieldCandidates.isEmpty()) {
            isInitializer = (Values.STATIC_INITIALIZER.equals(methodName) || Values.CONSTRUCTOR.equals(methodName));
            super.visitCode(obj);
        }
    }
392230
@Override
    public void visitMethod(Method obj) {
        Code c = obj.getCode();
        if (c != null) {
            byte[] opcodes = c.getCode();
            if (opcodes != null) {
                trPCPos = opcodes.length - 1;
                if (!obj.getSignature().endsWith(Values.SIG_VOID)) {
                    trPCPos -= 1;
                }
                trPCPos -= TAILRECURSIONFUDGE;
                possibleTailRecursion = true;
                isStatic = obj.isStatic();
                stack.resetForMethodEntry(this);
                super.visitMethod(obj);
            }
        }
    }
989480
@Override
    public void visitCode(Code obj) {
        if (Values.STATIC_INITIALIZER.equals(getMethod().getName())) {
            state = State.SAW_NOTHING;
            super.visitCode(obj);
        }
    }
267215
@Override
    public void visitCode(Code obj) {
        stack.resetForMethodEntry(this);
        nextAllocNumber = 1;
        storeToUserValue.clear();
        allocLocation.clear();
        allocToAddPCs.clear();
        optionalRanges.clear();

        addExceptionRanges(obj);

        super.visitCode(obj);

        for (List<Integer> pcs : allocToAddPCs.values()) {
            if (pcs.size() > 16) {
                bugReporter.reportBug(new BugInstance(this, BugType.PSC_PRESIZE_COLLECTIONS.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
                        .addSourceLine(this, pcs.get(0).intValue()));
            }
        }
    }
242448
@Override
    public void visitMethod(Method obj) {
        methodSignatureIsConstrained = false;
        String methodName = obj.getName();

        if (!Values.CONSTRUCTOR.equals(methodName) && !Values.STATIC_INITIALIZER.equals(methodName)) {

            String methodSig = obj.getSignature();

            methodSignatureIsConstrained = methodIsSpecial(methodName, methodSig)
                    || methodHasSyntheticTwin(methodName, methodSig);

            if (!methodSignatureIsConstrained) {
                for (AnnotationEntry entry : obj.getAnnotationEntries()) {
                    if (CONVERSION_ANNOTATIONS.contains(entry.getAnnotationType())) {
                        methodSignatureIsConstrained = true;
                        break;
                    }
                }
            }
            if (!methodSignatureIsConstrained) {
                String parms = methodSig.split("\\(|\\)")[1];
                if (parms.indexOf(Values.SIG_QUALIFIED_CLASS_SUFFIX_CHAR) >= 0) {

                    outer: for (JavaClass constrainCls : constrainingClasses) {
                        Method[] methods = constrainCls.getMethods();
                        for (Method m : methods) {
                            if (methodName.equals(m.getName()) && methodSig.equals(m.getSignature())) {
                                methodSignatureIsConstrained = true;
                                break outer;
                            }
                        }
                    }
                }
            }
        }
    }
587520
@Override
    public void visitMethod(Method obj) {
        stack.resetForMethodEntry(this);
        enumRegs.clear();
        super.visitMethod(obj);
    }
973432
@Override
    public void visitCode(Code obj) {
        try {
            Method m = getMethod();
            if ((!m.isPublic() && !m.isProtected()) || m.isAbstract() || m.isSynthetic()) {
                return;
            }

            CodeInfo superCode = superclassCode.remove(curMethodInfo);
            if (superCode != null) {
                if (sameAccess(getMethod().getAccessFlags(), superCode.getAccess()) && codeEquals(obj, superCode.getCode())) {
                    bugReporter.reportBug(new BugInstance(this, BugType.COM_COPIED_OVERRIDDEN_METHOD.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
                            .addSourceLine(classContext, this, getPC()));
                    return;
                }

                if ((getMethod().getAccessFlags() & Const.ACC_SYNCHRONIZED) != (superCode.getAccess() & Const.ACC_SYNCHRONIZED)) {
                    return;
                }

                parmTypes = getMethod().getArgumentTypes();
                nextParmIndex = 0;
                nextParmOffset = getMethod().isStatic() ? 0 : 1;
                sawAload0 = nextParmOffset == 0;
                sawParentCall = false;
                super.visitCode(obj);
            }
        } catch (StopOpcodeParsingException e) {
            // method is unique
        }

    }
623069
@Override
    public void visitCode(Code obj) {
        try {

            ignoreRegs.clear();
            Method method = getMethod();
            if (!method.isStatic()) {
                ignoreRegs.set(0);
            }

            int[] parmRegs = RegisterUtils.getParameterRegisters(method);
            for (int parm : parmRegs) {
                ignoreRegs.set(parm);
            }

            rootScopeBlock = new ScopeBlock(0, obj.getLength());
            tryBlocks.clear();
            catchHandlers.clear();
            CodeException[] exceptions = obj.getExceptionTable();
            if (exceptions != null) {
                for (CodeException ex : exceptions) {
                    tryBlocks.set(ex.getStartPC());
                    catchHandlers.set(ex.getHandlerPC());
                }
            }

            switchTargets.clear();
            stack.resetForMethodEntry(this);
            dontReport = false;
            sawDup = false;
            sawNull = false;
            super.visitCode(obj);

            if (!dontReport) {
                rootScopeBlock.findBugs(new HashSet<Integer>());
            }

        } finally {
            rootScopeBlock = null;
        }
    }
752144
@Override
    public void visitCode(Code obj) {
        stack.resetForMethodEntry(this);
        localLabels.clear();
        super.visitCode(obj);
        for (SourceLineAnnotation sla : localLabels.values()) {
            BugInstance bug = new BugInstance(this, BugType.S508C_NO_SETLABELFOR.name(), NORMAL_PRIORITY).addClass(this).addMethod(this);

            if (sla != null) {
                bug.addSourceLine(sla);
            }

            bugReporter.reportBug(bug);
        }
    }
51259
@Override
    public void visitCode(Code obj) {
        stack.resetForMethodEntry(this);
        lastOpcode = -1;
        lastReg = -1;
        lastIfEqWasBoolean = false;
        lastLoadWasString = false;
        Arrays.fill(lastPCs, -1);
        branchTargets.clear();
        trimLocations.clear();
        super.visitCode(obj);
    }
1088163
@Override
    public void visitCode(final Code obj) {
        if (sourceLines == null) {
            return;
        }

        if (isAbstract) {
            return;
        }

        if (Values.STATIC_INITIALIZER.equals(methodName) || Values.CONSTRUCTOR.equals(methodName)) {
            return;
        }

        int methodStart = srcLineAnnotation.getStartLine() - 2;
        int methodLine = methodStart;
        String line;
        while ((methodLine >= 0) && (methodLine < sourceLines.length)) {
            line = sourceLines[methodLine];
            if (line.indexOf(methodName) >= 0) {
                break;
            }
            methodLine--;
        }

        if (methodLine < 0) {
            return;
        }

        for (int i = methodLine; i <= methodStart; i++) {
            if ((i < 0) || (i >= sourceLines.length)) {
                return;
            }
            line = sourceLines[i];
            if (line.indexOf("final") >= 0) {
                return;
            }
        }

        changedParms = new BitSet();
        super.visitCode(obj);

        BugInstance bi = null;
        for (int i = 0; i < firstLocalReg; i++) {
            if (changedParms.get(i)) {
                changedParms.clear(i);
                continue;
            }

            String parmName = getRegisterName(obj, i);
            if (bi == null) {
                bi = new BugInstance(this, BugType.FP_FINAL_PARAMETERS.name(), LOW_PRIORITY).addClass(this).addMethod(this).addSourceLine(this, 0);
                bugReporter.reportBug(bi);
            }
            bi.addString(parmName);
        }
        changedParms = null;
    }
41101
@Override
    public void visitCode(Code obj) {
        try {
            stack.resetForMethodEntry(this);
            reportedType = ImmutabilityType.UNKNOWN;
            super.visitCode(obj);
        } catch (StopOpcodeParsingException e) {
            // report type is immutable
        }
    }
1122874
@Override
    public void visitField(Field obj) {
        if (checkConfusedName(obj.getName(), obj.getSignature())) {
            bugReporter.reportBug(new BugInstance(this, BugType.CNC_COLLECTION_NAMING_CONFUSION.name(), NORMAL_PRIORITY).addClass(this).addField(this)
                    .addString(obj.getName()));
        }
    }