package sfBugs;

import edu.umd.cs.findbugs.annotations.NonNull;

public class Bug1924512 {
    @NonNull
    public static String nonNullLoop(String[] args) {
        String ret = null;
        for (String s : args) {
            ret = s;
        }
        return ret; // no warning reported here
    }

    @NonNull
    public static String nonNullIf(String[] args) {
        String ret = null;
    	if(args.length > 0) {
    		ret = args[0];
    	}
    	return ret; // warning correctly reported here
    }
}

Test case for [ 1924512 ] Null check fooled by zero-iteration loop
Test case for [ 1924512 ] Null check fooled by zero-iteration loop

git-svn-id: e7d6bde23f017c9ff4efd468d79d66def666766b@9449 eae3c2d3-9b19-0410-a86e-396b6ccb6ab3
