RFR: 8091673: Public focus traversal API for use in custom controls [v4]
Andy Goryachev
angorya at openjdk.org
Tue Oct 29 15:31:25 UTC 2024
On Tue, 29 Oct 2024 15:16:59 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> This is a bit silly. You have an opening brace, you should be indenting as you would in every other case when an opening brace appears and you break off the line. So unless there is a **really** good reason to suddenly not do so that has to do with readability, I think this is an really odd stand to take.
>
> I agree that especially when each switch case is on a single line, indenting is the most sensible thing to do. It's a little more defensible to treat the standard switch `case NNNN:`, on a line by itself, as a label which is placed at the same indentation level as the switch itself (but even indenting it is more consistent).
>
> Taking this example:
>
> Option 1 - don't indent:
>
>
> String s = switch(val) {
> case 1 -> "one";
> case 2 -> "two";
> // ...
> default -> "unknown";
> };
>
> Option 2 - indent:
>
>
> String s = switch(val) {
> case 1 -> "one";
> case 2 -> "two";
> // ...
> default -> "unknown";
> };
>
>
> It seems pretty clear that the second option is easier to read. Virtually _all_ such uses in the JDK, and all uses up to now in JavaFX use the second pattern.
>
> @andy-goryachev-oracle care to make a counter-argument?
Sure:
String s = switch(val) {
case 1 ->
"one";
case 2 ->
"two";
default ->
"unknown";
};
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1604#discussion_r1821048760
More information about the openjfx-dev
mailing list