String localName = null; LocalVariable[] lvs = lvt.getLocalVariableTable(); for (int j=0; j<lvs.length; j++) { if (lvs[j].getIndex() == local) { localName = lvs[j].getName(); } }   if (EXCLUDED_LOCALS.contains(localName)) { continue; }
LocalVariable lv = lvt.getLocalVariable(local); if (lv != null) { String localName = lv.getName();   if (EXCLUDED_LOCALS.contains(localName)) { continue; } }
	private void analyzeMethod(ClassContext classContext, Method method)		throws DataflowAnalysisException, CFGBuilderException {		JavaClass javaClass = classContext.getJavaClass();		Dataflow<BitSet, LiveLocalStoreAnalysis> llsaDataflow =			classContext.getLiveLocalStoreDataflow(method);		int numLocals = method.getCode().getMaxLocals();		int [] localUpdateCount = new int[numLocals];		int [] localLoadCount = new int[numLocals];		int [] localIncrementCount = new int[numLocals];		MethodGen methodGen = classContext.getMethodGen(method);		CFG cfg = classContext.getCFG(method);		BitSet liveStoreSetAtEntry = llsaDataflow.getAnalysis().getResultFact(cfg.getEntry());		BitSet complainedAbout = new BitSet();        // Get the local variable table from the method...        LocalVariableTable lvt = method.getLocalVariableTable();        		for (Iterator<Location> i = cfg.locationIterator(); i.hasNext(); ) {			Location location = i.next();			if (location.getBasicBlock().isExceptionHandler())				continue;			boolean isStore = isStore(location);			boolean isLoad = isLoad(location);			if (!isStore && !isLoad) continue;			IndexedInstruction ins = (IndexedInstruction) location.getHandle().getInstruction();			int local = ins.getIndex();			if (ins instanceof IINC) {				localUpdateCount[local]++;				localLoadCount[local]++;				localIncrementCount[local]++;			}			else if (isStore) 				localUpdateCount[local]++;			else 				localLoadCount[local]++;			}		for (Iterator<Location> i = cfg.locationIterator(); i.hasNext(); ) {			Location location = i.next();			if (!isStore(location))				continue;			// Ignore exception handler blocks:			// javac always stores caught exceptions in			// a local, even if the value is not used.			if (location.getBasicBlock().isExceptionHandler())				continue;			IndexedInstruction ins = (IndexedInstruction) location.getHandle().getInstruction();			int local = ins.getIndex();                 // Determine whether we should ignore this local variable...            if (lvt != null) {                // Get the name of the local...                String localName = null;                LocalVariable[] lvs = lvt.getLocalVariableTable();                for (int j=0; j<lvs.length; j++) {                    if (lvs[j].getIndex() == local) {                        localName = lvs[j].getName();                    }                }                                // Is it in our set of excluded names?                if (EXCLUDED_LOCALS.contains(localName)) {                    continue;                }            }                			int localsThatAreParameters = method.getArgumentTypes().length;			if (!method.isStatic()) localsThatAreParameters++;			boolean parameterThatIsDeadAtEntry = local < localsThatAreParameters			    && !llsaDataflow.getAnalysis().isStoreAlive(liveStoreSetAtEntry, local);			if (parameterThatIsDeadAtEntry && !complainedAbout.get(local)) {			BugInstance bugInstance = new BugInstance(this, "IP_PARAMETER_IS_DEAD_BUT_OVERWRITTEN", NORMAL_PRIORITY)				.addClassAndMethod(methodGen, javaClass.getSourceFileName())				.addSourceLine(methodGen, javaClass.getSourceFileName(), location.getHandle());			bugReporter.reportBug(bugInstance);			complainedAbout.set(local);			}			// Get live stores at this instruction.			// Note that the analysis also computes which stores were			// killed by a subsequent unconditional store.			BitSet liveStoreSet = llsaDataflow.getAnalysis().getFactAtLocation(location);			// Is store alive?			if (llsaDataflow.getAnalysis().isStoreAlive(liveStoreSet, local))				continue;			// Store is dead						// Ignore assignments that were killed by a subsequent assignment.			if (llsaDataflow.getAnalysis().killedByStore(liveStoreSet, local)) {				if (DEBUG) {					System.out.println("Store at " + location.getHandle() +						" killed by subsequent store");				}				continue;			}			// Ignore dead assignments of null and 0.			// These often indicate defensive programming.			InstructionHandle prev = location.getBasicBlock().getPredecessorOf(location.getHandle());			if (prev != null && defensiveConstantValueOpcodes.get(prev.getInstruction().getOpcode()))				continue;			int priority = LOW_PRIORITY;			// special handling of IINC			if (ins instanceof IINC) {								 if (localIncrementCount[local] == 1) 					priority = NORMAL_PRIORITY;				else continue;				}			else if (ins instanceof ASTORE				&& prev != null) { 				Instruction prevIns = prev.getInstruction();				if ((prevIns instanceof INVOKESPECIAL &&					((INVOKESPECIAL)prevIns).getMethodName(methodGen.getConstantPool()).equals("<init>"))				    || prevIns instanceof ANEWARRAY				    || prevIns instanceof NEWARRAY				    || prevIns instanceof MULTIANEWARRAY)					priority--;			}			else if (localUpdateCount[local] == 2				&& localLoadCount[local] > 0) priority--; // raise priority			else if (localUpdateCount[local] == 1)				priority++;			else if (localLoadCount[local] == 0) priority++; // lower priority			if (parameterThatIsDeadAtEntry) {				if (DEBUG) System.out.println("Raising priority");				priority--;				}			if (priority < HIGH_PRIORITY)				priority =  HIGH_PRIORITY;			if (DEBUG) System.out.println(" considering reporting bug:" + priority);			if (priority != LOW_PRIORITY 				|| classesAlreadyReportedOn.add(javaClass.getClassName())) {			// Report the bug			BugInstance bugInstance = new BugInstance(this, "DLS_DEAD_LOCAL_STORE", priority)				.addClassAndMethod(methodGen, javaClass.getSourceFileName())				.addSourceLine(methodGen, javaClass.getSourceFileName(), location.getHandle());			if (DEBUG) System.out.println("Reporting " + bugInstance);			bugReporter.reportBug(bugInstance);			}		}	}