Skip to content

Cover how a long generic field type wraps - #59

Merged
abashev merged 1 commit into
mainfrom
long-generic-field-type-golden
Sep 24, 2026
Merged

abashev merged 1 commit into
mainfrom
long-generic-field-type-golden

Conversation

@abashev

@abashev abashev commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator

A field whose parameterized type fits in the line keeps the type whole
and moves the name and the initializer to the next line. A type that
does not fit breaks right after "<" and puts its arguments one level
deeper: on one line when they fit there, one per line when they do
not. That is google-java-format's layout, kept as it is. At 120
columns it shows only on a type that is over the limit by itself: in
the 15,747 files of the JDK 21 sources, once on a field
(LocaleProviderAdapter) and once inside a cast (TCPTransport).

The golden pins the three shapes, so that an upstream sync or a change
to visitParameterizedType has to say so.

A field whose parameterized type fits in the line keeps the type whole
and moves the name and the initializer to the next line. A type that
does not fit breaks right after "<" and puts its arguments one level
deeper: on one line when they fit there, one per line when they do
not. That is google-java-format's layout, kept as it is. At 120
columns it shows only on a type that is over the limit by itself: in
the 15,747 files of the JDK 21 sources, once on a field
(LocaleProviderAdapter) and once inside a cast (TCPTransport).

The golden pins the three shapes, so that an upstream sync or a change
to visitParameterizedType has to say so.
@abashev
abashev merged commit a079cbb into main Sep 24, 2026
12 of 13 checks passed
@abashev
abashev deleted the long-generic-field-type-golden branch September 24, 2026 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant