ndimiduk commented on PR #4312:
URL: https://github.com/apache/hbase/pull/4312#issuecomment-1102721095
@Apache9 These are my preferences. I don't know how expressive the Eclipse
Formatter configuration language is...
For method invocation arguments, I usually prefer as little whitespace as
possible, wrapping only where necessary. Something like,
```
foo(a, b, c, d, e, f,
g, h, i, j);
```
However, when invoking other methods as method (or commonly, constructor)
parameters, I prefer a form with more whitespace,
```
final foo = new Foo(
conf.get("foo_a_key", DEFAULT_A_VALUE),
callsiteParam.getFooBValue(),
...);
```
For method declarations, I follow two styles. For simple functions where
declaring a parameter type and name doesn't use very many characters, I will do
a "basic" version. But when the type parameter declarations take a lot of
space, I prefer a style with more whitespace. So,
```
class Foo {
// a basic method declaration style style
public Foo(int a, boolean b, float c, ...) { ... }
// a style that uses more whitespace
public Foo(
final SomeType someType,
final SomeOtherType someOtherType,
...
) throws MyFavoriteException {
...
}
}
```
For method call chains with only a two method calls, I'm fine with keeping
that to a single line. If there are many steps or steps that themselves wrap
call chains, my preferences is one method call per line, with appropriate
indentation. for example,
```
// a simple one-liner
protected static final Foo foo = Foo().setA(a);
// a more complex example, where extra newlines improve readability.
protected static final MiniClusterRule miniClusterRule =
MiniClusterRule.newBuilder()
.setMiniClusterOption(StartMiniClusterOption.builder()
.numWorkers(3)
.build())
.build();
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]