I actually think that doing this the other way round would be correct. Removing 
final everywhere and relying on humans to assume that everything is final 
doesn’t seem maintainable to me. The benefit of having final on 
parameters/fields is that the compiler/IDE actually checks that you don’t 
modify it.

In general, I think that as much as possible should be declared final, 
including fields and parameters.

Best,
Aljoscha

> On 2. Oct 2019, at 13:31, Piotr Nowojski <pi...@ververica.com> wrote:
> 
> +1 from my side.
> 
>> On 2 Oct 2019, at 13:07, Zili Chen <wander4...@gmail.com> wrote:
>> 
>> Yes exactly.
>> 
>> 
>> Piotr Nowojski <pi...@ververica.com> 于2019年10月2日周三 下午7:03写道:
>> 
>>> Hi Tison,
>>> 
>>> To clarify      your proposal. You are proposing to actually drop the
>>> `final` keyword from the parameters and we should implicilty assume that
>>> it’s always there (in other words, we shouldn’t be modifying the
>>> parameters). Did I understand this correctly?
>>> 
>>> Piotrek
>>> 
>>>> On 1 Oct 2019, at 21:44, Zili Chen <wander4...@gmail.com> wrote:
>>>> 
>>>> Hi devs,
>>>> 
>>>> Coming from this discussion[1] I'd like to propose that in Flink codebase
>>>> we suggest a code style
>>>> that parameters of method are always final. Almost everywhere parameters
>>> of
>>>> method are final
>>>> already and if we have such consensus we can prevent redundant final
>>>> modifier in method
>>>> declaration so that we survive from those noise.
>>>> 
>>>> Here are some cases that might require to modify a parameter.
>>>> 
>>>> 1. to set default; especially if (param == null) { param = ... }
>>>> 2. to refine parameter; it is in pattern if ( ... ) { param =
>>>> refine(param); }
>>>> 
>>>> Either of the cases we can move the refine/set default logics to the
>>> caller
>>>> or select another
>>>> name for the refined value case by case.
>>>> 
>>>> Looking forward to your feedbacks :-)
>>>> 
>>>> Best,
>>>> tison.
>>>> 
>>>> [1] https://github.com/apache/flink/pull/9788#discussion_r329314681
>>> 
>>> 
> 

Reply via email to