title: Is it problematic to assign a new value to a method parameter?
body: <p>Eclipse has an option to warn on assignment to a method's parameter (inside the method), as in:</p>
  
  <pre><code>public void doFoo(int a){
     if (a&lt;0){
        a=0; // this will generate a warning
     }
     // do stuff
  }
  </code></pre>
  
  <p>Normally I try to activate (and heed) almost all available compiler warnings, but in this case I'm  not really sure whether it's worth it.</p>
  
  <p>I see legitimate cases for changing a parameter in a method (e.g.: Allowing a parameter to be "unset" (e.g. null) and automatically substituting a default value), but few situations where it would cause problems, except that it might be a bit confusing to reassign a parameter in the middle of the method.</p>
  
  <p>Do you use such warnings? Why / why not?</p>
  
  <p>Note:</p>
  
  <p>Avoiding this warning is of course equivalent to making the method parameter <code>final</code> (only then it's a compiler error :-)). So this question <a href="https://stackoverflow.com/questions/500508/why-should-i-use-the-keyword-final-on-a-method-parameter-in-java">Why should I use the keyword &quot;final&quot; on a method parameter in Java?</a> might be related.</p>