for (CallTarget dangerousCallTarget : dangerousCallTargetList) { JavaClass targetClass = dangerousCallTarget.javaClass; XMethod targetMethod = dangerousCallTarget.xmethod; addMethodAnnotationForCalledMethod(warning, targetClass, targetMethod, "METHOD_DANGEROUS_TARGET");
for (JavaClassAndMethod dangerousCallTarget : dangerousCallTargetList) { warning.addMethod(dangerousCallTarget.getJavaClass(), dangerousCallTarget.getMethod()).describe("METHOD_DANGEROUS_TARGET");
	private void checkUnconditionallyDereferencedParam(			Location location,			ConstantPoolGen cpg,			TypeDataflow typeDataflow,			InvokeInstruction invokeInstruction,			BitSet nullArgSet, BitSet definitelyNullArgSet) throws DataflowAnalysisException, ClassNotFoundException {				NonNullParamPropertyDatabase database = unconditionalDerefDatabase.get();				// See what methods might be called here		TypeFrame typeFrame = typeDataflow.getFactAtLocation(location);		Set<XMethod> targetMethodSet = Hierarchy.resolveMethodCallTargets(invokeInstruction, typeFrame, cpg);		if (DEBUG_NULLARG) {			System.out.println("Possibly called methods: " + targetMethodSet);		}				// See if any call targets unconditionally dereference one of the null arguments		BitSet unconditionallyDereferencedNullArgSet = new BitSet();		List<CallTarget> dangerousCallTargetList = new LinkedList<CallTarget>();		for (XMethod targetMethod : targetMethodSet) {			if (DEBUG_NULLARG) {				System.out.println("For target method " + targetMethod);			}						NonNullParamProperty property = database.getProperty(targetMethod);			if (property == null)				continue;			if (DEBUG_NULLARG) {				System.out.println("\tUnconditionally dereferenced params: " + property);			}						BitSet targetUnconditionallyDereferencedNullArgSet =				property.getViolatedParamSet(nullArgSet);						if (targetUnconditionallyDereferencedNullArgSet.isEmpty())				continue;						JavaClass targetClass = AnalysisContext.currentAnalysisContext().lookupClass(targetMethod.getClassName());			dangerousCallTargetList.add(new CallTarget(targetClass, targetMethod));						unconditionallyDereferencedNullArgSet.or(targetUnconditionallyDereferencedNullArgSet);		}				if (dangerousCallTargetList.isEmpty())			return;				WarningPropertySet propertySet = new WarningPropertySet();				MethodGen methodGen = classContext.getMethodGen(method);		String sourceFile = classContext.getJavaClass().getSourceFileName();		BugInstance warning = new BugInstance("NP_NULL_PARAM_DEREF", NORMAL_PRIORITY)				.addClassAndMethod(methodGen, sourceFile)				.addSourceLine(methodGen, sourceFile, location.getHandle());				// Check which params might be null		addParamAnnotations(definitelyNullArgSet, unconditionallyDereferencedNullArgSet, propertySet, warning);		// Add annotations for dangerous method call targets		for (CallTarget dangerousCallTarget : dangerousCallTargetList) {			JavaClass targetClass = dangerousCallTarget.javaClass;			XMethod targetMethod = dangerousCallTarget.xmethod;			addMethodAnnotationForCalledMethod(warning, targetClass, targetMethod, "METHOD_DANGEROUS_TARGET");		}		// See if there are any safe targets		Set<XMethod> safeCallTargetSet = new HashSet<XMethod>();		safeCallTargetSet.addAll(targetMethodSet);		for (CallTarget dangerousCallTarget : dangerousCallTargetList) {			safeCallTargetSet.remove(dangerousCallTarget.xmethod);		}		if (safeCallTargetSet.isEmpty()) {			propertySet.addProperty(NullArgumentWarningProperty.ALL_DANGEROUS_TARGETS);			if (dangerousCallTargetList.size() == 1) {				propertySet.addProperty(NullArgumentWarningProperty.MONOMORPHIC_CALL_SITE);			}		}		if (REPORT_SAFE_METHOD_TARGETS) {			// This is useful to see which other call targets the analysis			// considered.			for (XMethod safeMethod : safeCallTargetSet) {				JavaClass targetClass = AnalysisContext.currentAnalysisContext().lookupClass(safeMethod.getClassName());				addMethodAnnotationForCalledMethod(warning, targetClass, safeMethod, "METHOD_SAFE_TARGET");			}		}		finishWarning(location, propertySet, warning);				bugReporter.reportBug(warning);	}