<commit_before>package edu.umd.cs.findbugs.ba.npe;

import edu.umd.cs.findbugs.ba.JavaClassAndMethod;
import edu.umd.cs.findbugs.ba.JavaClassAndMethodChooser;
import edu.umd.cs.findbugs.ba.XMethod;

/**
 * This callback can be passed to Hierarchy.findInvocationLeastUpperBound
 * to find the @NonNull or @CheckForNull method return value annotation
 * which should be applied at a call site.
 * 
 * @author <NAME>
 * @deprecated
 */
public class NonNullReturnValueAnnotationChecker implements JavaClassAndMethodChooser {
	private static final boolean DEBUG = Boolean.getBoolean("fnd.debug.nullreturn");
	
	private MayReturnNullPropertyDatabase database;
	private JavaClassAndMethod annotatedMethod;
	private Boolean property;
	
	public NonNullReturnValueAnnotationChecker(MayReturnNullPropertyDatabase database) {
		this.database = database;
	}
	
	public Boolean getProperty() {
		return property;
	}
	
	public JavaClassAndMethod getAnnotatedMethod() {
		return annotatedMethod;
	}
	
	public boolean choose(JavaClassAndMethod javaClassAndMethod) {
		XMethod xmethod = javaClassAndMethod.toXMethod();
		if (DEBUG) {
			System.out.print("Checking " + xmethod + " for @NonNull or @CheckForNull...");
		}
		Boolean prop = database.getProperty(xmethod);
		if (prop != null) {
			this.property = prop;
			this.annotatedMethod = javaClassAndMethod;
			if (DEBUG) {
				System.out.println(prop.booleanValue() ? "@CheckForNull" : "@NonNull");
			}
			return true;
		}
		if (DEBUG) {<commit_msg>get rid of compiler warning. if this class isn't used by anyone we should remove it.<commit_after>package edu.umd.cs.findbugs.ba.npe;

import edu.umd.cs.findbugs.ba.JavaClassAndMethod;
import edu.umd.cs.findbugs.ba.JavaClassAndMethodChooser;
import edu.umd.cs.findbugs.ba.XMethod;

/**
 * This callback can be passed to Hierarchy.findInvocationLeastUpperBound
 * to find the @NonNull or @CheckForNull method return value annotation
 * which should be applied at a call site.
 * 
 * @author <NAME>
 * @deprecated
 */
public class NonNullReturnValueAnnotationChecker implements JavaClassAndMethodChooser {
	private static final boolean DEBUG = Boolean.getBoolean("fnd.debug.nullreturn");
	
	private MayReturnNullPropertyDatabase database;
	private JavaClassAndMethod annotatedMethod;
	private Boolean property;

	/** @deprecated */
	public NonNullReturnValueAnnotationChecker(MayReturnNullPropertyDatabase database) {
		this.database = database;
	}
	
	public Boolean getProperty() {
		return property;
	}
	
	public JavaClassAndMethod getAnnotatedMethod() {
		return annotatedMethod;
	}
	
	public boolean choose(JavaClassAndMethod javaClassAndMethod) {
		XMethod xmethod = javaClassAndMethod.toXMethod();
		if (DEBUG) {
			System.out.print("Checking " + xmethod + " for @NonNull or @CheckForNull...");
		}
		Boolean prop = database.getProperty(xmethod);
		if (prop != null) {
			this.property = prop;
			this.annotatedMethod = javaClassAndMethod;
			if (DEBUG) {
				System.out.println(prop.booleanValue() ? "@CheckForNull" : "@NonNull");
			}
			return true;
		}
		if (DEBUG) {
{'fraction_non_alphanumeric': 0.0977124183006536, 'fraction_numerical': 0.0, 'mean_word_length': 4.786389413988658, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5567235', 'n_tokens_mistral': 996, 'n_tokens_neox': 916, 'n_words': 226}