Re: [CODE STYLE] Parameters of method are always final

2019-10-07 Thread Arvid Heise
For Piotr's comment. IntelliJ does support adding/removing final parameters automatically. You could even automatically add them on save with the Save Actions plugin [1]. [1] https://plugins.jetbrains.com/plugin/7642-save-actions On Mon, Oct 7, 2019 at 11:22 AM Piotr Nowojski wrote: > After ch

Re: [CODE STYLE] Parameters of method are always final

2019-10-07 Thread Piotr Nowojski
After checking out the check style modules mentioned by Tison, I really do not see a point of enforcing/adding `final`. With ParameterAssignment [1] it’s redundant and will cause problems that I mentioned before. Additionally enabling ParameterAssignment [1] would be probably much easier in our

Re: [CODE STYLE] Parameters of method are always final

2019-10-07 Thread Dawid Wysakowicz
Hi all, My quick take on it. 1. If I were to introduce any rule on that I agree with Aljoscha, we should rather enforce the `final` keyword rather than the opposite. 2. I think it does not make sense to enforce rules on such an unimportant (in my opinion) topic. Generally I agree with Piotr that

Re: [CODE STYLE] Parameters of method are always final

2019-10-07 Thread Zili Chen
Thanks for your thoughts Arvid & Piotr, I check out the effect of ParameterAssignment[1] and it does prevent codes from modifying parameter which I argued above the most value introduced by `final` modifier of parameter. So firstly, I think it's good to enable ParameterAssignment in our codebase.

Re: [CODE STYLE] Parameters of method are always final

2019-10-07 Thread Piotr Nowojski
Hi, Couple of arguments to counter the proposal of making the `final` keyword obligatory. Can we prepare a code style/IDE settings to add it automatically? If not, I would be strongly against it, since: - Intellij’s automatic refactor actions will not work properly. - I don’t think it’s a big d

Re: [CODE STYLE] Parameters of method are always final

2019-10-07 Thread Arvid Heise
Hi guys, I'm a bit torn. In general, +1 for making parameters effectively final. The question is how to enforce it. We can make it explicit (like Aljoscha said). All IDEs will show immediately warnings/errors for violations. It would allow to softly migrate code. Another option is to use a check

Re: [CODE STYLE] Parameters of method are always final

2019-10-04 Thread Zili Chen
Hi Aljoscha, I totally agree with you on field topic. Of course it makes significant difference whether or not a field is final and IDE/compiler can help on checking. Here are several thoughts about final modifier on parameters and why I propose this one: 1. parameters should be always final As

Re: [CODE STYLE] Parameters of method are always final

2019-10-04 Thread Aljoscha Krettek
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 mod

Re: [CODE STYLE] Parameters of method are always final

2019-10-02 Thread Piotr Nowojski
+1 from my side. > On 2 Oct 2019, at 13:07, Zili Chen wrote: > > Yes exactly. > > > Piotr Nowojski 于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 >

Re: [CODE STYLE] Parameters of method are always final

2019-10-02 Thread Zili Chen
Yes exactly. Piotr Nowojski 于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).

Re: [CODE STYLE] Parameters of method are always final

2019-10-02 Thread Piotr Nowojski
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

[CODE STYLE] Parameters of method are always final

2019-10-01 Thread Zili Chen
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 declaratio