for (Iterator<WarningWithProperties> i = stringComparisonList.iterator(); i.hasNext();) { WarningWithProperties warn = i.next();  if (sawCallToEquals) { warn.propertySet.addProperty(RefComparisonWarningProperty.SAW_CALL_TO_EQUALS); }  if (!(method.isPublic() || method.isProtected())) { warn.propertySet.addProperty(RefComparisonWarningProperty.PRIVATE_METHOD); }  warn.instance.setPriority(warn.propertySet.computePriority(NORMAL_PRIORITY)); }    WarningWithProperties best = null; for (Iterator<WarningWithProperties> i = stringComparisonList.iterator(); i.hasNext();) { WarningWithProperties warn = i.next(); if (best == null || warn.instance.getPriority() < best.instance.getPriority()) { best = warn; }  if (relaxed) { warn.propertySet.decorateBugInstance(warn.instance); bugReporter.reportBug(warn.instance); } } if (best != null && !relaxed) { bugReporter.reportBug(best.instance); }  if (refComparison != null) { if (false && sawCallToEquals) {  refComparison.setPriority(1 + refComparison.getPriority()); } if (refComparison.getPriority() <= LOW_PRIORITY) bugReporter.reportBug(refComparison); }
reportBest(classContext, method, stringComparisonList, relaxed); reportBest(classContext, method, refComparisonList, relaxed);
	private void analyzeMethod(ClassContext classContext, Method method)	        throws CFGBuilderException, DataflowAnalysisException {		boolean sawCallToEquals = false;		JavaClass jclass = classContext.getJavaClass();		ConstantPoolGen cpg = classContext.getConstantPoolGen();		MethodGen methodGen = classContext.getMethodGen(method);		// Report at most one String comparison per method.		// We report the first highest priority warning.		refComparison = null;		LinkedList<WarningWithProperties> stringComparisonList =			new LinkedList<WarningWithProperties>();		CFG cfg = classContext.getCFG(method);		DepthFirstSearch dfs = classContext.getDepthFirstSearch(method);		ExceptionSetFactory exceptionSetFactory =		        classContext.getExceptionSetFactory(method);		// Perform type analysis using our special type merger		// (which handles String types specially, keeping track of		// which ones appear to be dynamically created)		RefComparisonTypeMerger typeMerger =		        new RefComparisonTypeMerger(bugReporter, exceptionSetFactory);		RefComparisonTypeFrameModelingVisitor visitor =		        new RefComparisonTypeFrameModelingVisitor(methodGen.getConstantPool(), bugReporter);		TypeAnalysis typeAnalysis =		        new TypeAnalysis(methodGen, cfg, dfs, typeMerger, visitor, bugReporter, exceptionSetFactory);		TypeDataflow typeDataflow = new TypeDataflow(cfg, typeAnalysis);		typeDataflow.execute();		for (Iterator<Location> i = cfg.locationIterator(); i.hasNext();) {			Location location = i.next();			Instruction ins = location.getHandle().getInstruction();			short opcode = ins.getOpcode();			if (opcode == Constants.IF_ACMPEQ || opcode == Constants.IF_ACMPNE) {				checkRefComparison(						location,						jclass,						methodGen,						visitor,						typeDataflow,						stringComparisonList);			} else if (invokeInstanceSet.get(opcode)) {				InvokeInstruction inv = (InvokeInstruction) ins;				String methodName = inv.getMethodName(cpg);				String methodSig = inv.getSignature(cpg);				if ((methodName.equals("equals") && methodSig.equals("(Ljava/lang/Object;)Z"))				        || (methodName.equals("equalIgnoreCases") && methodSig.equals("(Ljava/lang/String;)Z"))) {					sawCallToEquals = true;					checkEqualsComparison(location, jclass, methodGen, typeDataflow);				}			}		}				boolean relaxed = AnalysisContext.currentAnalysisContext().getBoolProperty(				FindBugsAnalysisProperties.RELAXED_REPORTING_MODE);		// Add method-wide properties to BugInstances		for (Iterator<WarningWithProperties> i = stringComparisonList.iterator(); i.hasNext();) {			WarningWithProperties warn = i.next();			if (sawCallToEquals) {				warn.propertySet.addProperty(RefComparisonWarningProperty.SAW_CALL_TO_EQUALS);			}						if (!(method.isPublic() || method.isProtected())) {				warn.propertySet.addProperty(RefComparisonWarningProperty.PRIVATE_METHOD);			}						warn.instance.setPriority(warn.propertySet.computePriority(NORMAL_PRIORITY));		}				// If a String reference comparison was found in the method,		// report it		WarningWithProperties best = null;		for (Iterator<WarningWithProperties> i = stringComparisonList.iterator(); i.hasNext();) {			WarningWithProperties warn = i.next();			if (best == null || warn.instance.getPriority() < best.instance.getPriority()) {				best = warn;			}						if (relaxed) {				warn.propertySet.decorateBugInstance(warn.instance);				bugReporter.reportBug(warn.instance);			}		}		if (best != null && !relaxed) {			bugReporter.reportBug(best.instance);		}				if (refComparison != null) {			if (false && sawCallToEquals) {				// System.out.println("Reducing priority of " + refComparison);				refComparison.setPriority(1 + refComparison.getPriority());			}			if (refComparison.getPriority() <= LOW_PRIORITY)				bugReporter.reportBug(refComparison);		}	}