Commit 010cef1
Treat a single upper case letter as a type name in a dotted chain
A dotted name is broken after its type-name prefix, and the prefix is
found from the case of each segment: "com.example.Foo.bar" is a package,
a class and a member. A single upper case letter such as Android's R
counted as an all-caps constant, so in
"com.some.extremely.verbose.pkg.name.R.string.some_resource" no prefix
was found and the name broke at every dot, one segment per line.
This ports google/google-java-format#731 by Liam Miller-Cushon: a
single upper case letter is UpperCamelCase, so the chain keeps
"com.some.extremely.verbose.pkg.name.R.string" together and breaks
before the last segment. The golden b26306390 and the two
TypeNameClassifierTest assertions come from upstream, with the
expected output in this project's style.
The 15,747 files of the JDK 21 sources format exactly as before.1 parent 746fb60 commit 010cef1
4 files changed
Lines changed: 11 additions & 1 deletion
File tree
- open-java-format/src
- main/java/com/palantir/javaformat/java
- test
- java/com/palantir/javaformat/java
- resources/com/palantir/javaformat/java/testdata
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
| 168 | + | |
168 | 169 | | |
169 | 170 | | |
170 | 171 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| 64 | + | |
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
0 commit comments