|
|
|
|
|
by WHoWHo
3018 days ago
|
|
From my experience in 20 years of Java, it prevents the reusage of local vars, which mostly is wrong. Person p = ....
p = doSomething(p)
...
p = doSomethingElse(p)
is hard to reason about when it should be Person p = ....
... lots of code
Person updated = doSomething(p)
... lots of code
doSomethingElse(updated)
Which is easier to read and understand. So you might have had bugs that would have been prevented with final, but you didn't attribute to final. |
|
You shouldn't be able to doSomethingElse(p) when you actually mean to doSomethingElse(updated).