Sometimes projects have a rule in place where any variables that are not intended to change are marked “final”.

Most methods get called with some parameters, do some work with those parameters as a starting point, and then possibly return a value.  Rarely do methods change the parameters passed in, so having a requirement to add the “final” keyword everywhere just adds busy work to the developer.  

public class Invoice
{
:
    public void applyTransition(final String usernamefinal InvoiceStateTransition transition)
    {
    :

In this case, it is clear from the method signature that applyTransition( ) is not changing the two values passed in.  Moreover, String and InvoiceStateTransition are immutable objects, which cannot be changed.  

blog comments powered by Disqus