Why does PMD suggest making fields final? <p>I created Android application and run static analysis tool PMD on it. And what I don't get is why it is giving me warning and says to declare fields final when possible like in this example.</p> <pre><code>final City selectedItem = (City) arg0.getItemAtPosition(arg2); new RequestSender(aaa).execute(xxx, selectedItem.getId()); </code></pre> <p>It just starts inner AsyncTask instance. Is it good style to declare it final and why? For the sake of readability, I created a new object, but PMD says it should be final. </p>