java - Need to know about one PMD rule -
this question has reply here:
when should 1 utilize final method parameters , local variables? 15 answersi utilize pmd tool find errors in java code if any. 1 mutual suggestion pmd gives "local variable {local_variable} declared final". necessary declare local variables final if it's state not changed further?
is necessary declare local variables final if it's state not changed further?
no not necessary, except in 1 situation: if need access variable within anonymous class.
is practice create local variable final when don't change?
this subjective - think clutters code unnecessarily , if follow coding practice, methods should short plenty , self-explanatory plenty making variables final should not required.
java optimization code-cleanup
No comments:
Post a Comment