Skip to content

Commit dc50f40

Browse files
committed
Cover how a long generic field type wraps
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.
1 parent 86cdc74 commit dc50f40

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class LongGenericFieldType {
2+
private final AtomicReference<Table<RealmName, CoreGridViewConfigurationId, CoreGridViewConfigurationEntry>> gridViewConfigurations = new AtomicReference<>(ImmutableTable.of());
3+
4+
private final AtomicReference<Table<RealmName, CoreGridViewConfigurationId, CoreGridViewConfigurationEntry, DefaultValue>> gridViewConfigurationsWithDefault = new AtomicReference<>(ImmutableTable.of());
5+
6+
private final AtomicReference<Table<RealmNameIdentifierValue, CoreGridViewConfigurationIdentifierValue, CoreGridViewConfigurationEntryValue, DefaultValue>> gridViewConfigurationsWithLongNames = new AtomicReference<>(ImmutableTable.of());
7+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class LongGenericFieldType {
2+
private final AtomicReference<Table<RealmName, CoreGridViewConfigurationId, CoreGridViewConfigurationEntry>>
3+
gridViewConfigurations = new AtomicReference<>(ImmutableTable.of());
4+
5+
private final AtomicReference<
6+
Table<RealmName, CoreGridViewConfigurationId, CoreGridViewConfigurationEntry, DefaultValue>>
7+
gridViewConfigurationsWithDefault = new AtomicReference<>(ImmutableTable.of());
8+
9+
private final AtomicReference<
10+
Table<
11+
RealmNameIdentifierValue,
12+
CoreGridViewConfigurationIdentifierValue,
13+
CoreGridViewConfigurationEntryValue,
14+
DefaultValue>>
15+
gridViewConfigurationsWithLongNames = new AtomicReference<>(ImmutableTable.of());
16+
}

0 commit comments

Comments
 (0)