title: Redundant nullcheck of value known to be null
body: <p>I have a piece of code which looks something like this:</p>
  
  <pre><code>private void methodA(String a String b){
    Employee e1=null;
    foobar(e1,b); //line 1
    //do something
    if(e1!=null){ //line 2
      //flow1
    }else{
      //flow2
    }
  }
  private void foobar(Employee e, String a){
    e= new Employee();
    //do stuff
  }
  </code></pre>
  
  <p>When I run findBugs for this class, it shows me two warnings at line1 -  </p>
  
  <pre><code>Load of known null value
  The variable referenced at this point is known to be null due to an earlier check against null. Although this is valid, it might be a mistake (perhaps you intended to refer to a different variable, or perhaps the earlier check to see if the variable is null should have been a check to see if it was nonnull).
  </code></pre>
  
  <p>and at line 2 :</p>
  
  <pre><code>Redundant nullcheck of value known to be null
  This method contains a redundant check of a known null value against the constant null.
  </code></pre>
  
  <p>To avoid these warnings I instead did the following:</p>
  
  <pre><code>private void methodA(String a String b){
    Employee e1 = foobar(b); //line 1
    //do something
    if(e1!=null){ //line 2
      //flow1
    }else{
      //flow2
    }
  }
  private Employee foobar(String a){
   if("some_value".equals(a)){
    Employee e= new Employee();
    //do stuff
    return e;
    }
  return null;
  }
  </code></pre>
  
  <p>Doing this removes the warnings from findbugs, but my question is this change absolutely  necessary, or rather what could be the impacts going with the first approach?</p>