The Java compiler is perfectly able to determine which variables are being changed and which are not (thus being able to enforce something like final
in the first place).
There is no performance advantage to declaring final
for local variables yourself. The only advantages are developer ones, e.g. being able to know that a variable doesn't change, and have the compiler verify this for you.
Note: There can be advantages in final non-private methods, classes, and member variables. This provides information the compiler cannot know only from that source code. (Actual effectiveness may vary.)