Just so everyone remembers:

Any suggested code-style should be
a) configurable in the IDE (otherwise we'll never be able to auto-format)
b) be verifiable via checkstyle (otherwise we'll end up manually checking for code-style again)

On 02/08/2019 03:20, SHI Xiaogang wrote:
Hi Andrey,

Thanks for bringing this. Personally, I prefer to the following style which
(1) puts the right parenthese in the next line
(2) a new line for each exception if exceptions can not be put in the same
line

That way, parentheses are aligned in a similar way to braces and exceptions
can be well aligned.

*public **void func(*
*    int arg1,*
*    int arg2,*
*    ...
*) throws E1, E2, E3 {*
*    ...
*}*

or

*public **void func(*
*    int arg1,*
*    int arg2,*
*    ...
*) throws
*    E1,
*    E2,
*    E3 {*
*    ...
*}*

Regards,
Xiaogang

Andrey Zagrebin <and...@ververica.com> 于2019年8月1日周四 下午11:19写道:

Hi all,

This is one more small suggestion for the recent thread about code style
guide in Flink [1].

We already have a note about using a new line for each chained call in
Scala, e.g. either:

*values**.stream()**.map(...)**,collect(...);*

or

*values*
*    .stream()*
*    .map(*...*)*
*    .collect(...)*

if it would result in a too long line by keeping all chained calls in one
line.

The suggestion is to have it for Java as well and add the same rule for a
long list of function arguments. So it is either:

*public void func(int arg1, int arg2, ...) throws E1, E2, E3 {*
*    ...*
*}*

or

*public **void func(*
*        int arg1,*
*        int arg2,*
*        ...)** throws E1, E2, E3 {*
*    ...*
*}*

but thrown exceptions stay on the same last line.

Please, feel free to share you thoughts.

Best,
Andrey

[1]

http://mail-archives.apache.org/mod_mbox/flink-dev/201906.mbox/%3ced91df4b-7cab-4547-a430-85bc710fd...@apache.org%3E


Reply via email to