bejancsaba commented on PR #6149:
URL: https://github.com/apache/nifi/pull/6149#issuecomment-1166350542

   @exceptionfactory thanks for the new suggestions I addressed  (I hope) 
everything that was requested. Theer is only one outstanding item. Of course I 
don't want to spend too much time on it. I'm accepting this is how it is done 
by the community just wanted to take one last stab at it:
   
   > As far use use of the `final` keyword, it is strongly preferred as it 
provides a quick indicator that method parameters cannot and will not be 
changed during method processing. Although languages like Kotlin make this the 
default behavior, Java requires the keyword to enforce the behavior, so it is 
best to apply it across the board.
   
   Thanks for the explanation. I know there could be a lot of pros and cons 
raised and there would be plenty of articles to be found across the internet 
justifying each point. My opinion is that even if we declare each method 
parameter final that just tells us that the reference won't be reassigned 
inside the method (which doesn't have any affect on the caller's reference) 
however even the final "annotated" object's state / properties can be changed 
if the object is not immutable. Based on the code I saw immutability is not 
followed from top to bottom and I thought adding final for every parameter is 
noisy (makes the code longer) and misleading as you can change the object 
inside the function as you wish you just can't reassign the reference to it 
which would have affect only inside the scope of the function anyway.
   Of course if this is a must follow constraint in the NiFi codebase then 
there is not much to talk about I will add it everywhere just wanted to explain 
why I think it is counter productive.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to