Skip to content

Commit 9553e60

Browse files
committed
Define "type annotation"
1 parent 61da1b2 commit 9553e60

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

lib/src/main/java/com/diffplug/spotless/java/TypeAnnotationsStep.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
* -- even type annotations, which should be on the same line as the type they qualify.
3131
* This class corrects the formatting.
3232
* This is useful as a postprocessing step after a Java formatter that is not cognizant of type annotations.
33+
34+
* <p>
35+
* Note: A type annotation is an annotation that is meta-annotated with {@code @Target({ElementType.TYPE_USE})}.
3336
*/
3437
public final class TypeAnnotationsStep {
3538
private TypeAnnotationsStep() {}
@@ -54,6 +57,7 @@ private static final class State implements Serializable {
5457
// Type annotations from the Checker Framework and all the tools it
5558
// supports, including FindBugs, JetBrains (IntelliJ), Eclipse, NetBeans,
5659
// Spring, JML, Android, etc.
60+
// A type annotation is an annotation that is meta-annotated with @Target({ElementType.TYPE_USE}).
5761
"A",
5862
"ACCBottom",
5963
"Acceleration",

plugin-gradle/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ Type annotations should be on the same line as the type that they qualify.
262262
@Nullable @Interned String s;
263263
```
264264

265+
(A type annotation is an annotation that is meta-annotated with `@Target({ElementType.TYPE_USE})`.)
266+
265267
However, some tools format them incorrectly, like this:
266268

267269
```java

plugin-maven/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ Type annotations should be on the same line as the type that they qualify.
267267
@Nullable @Interned String s;
268268
```
269269

270+
(A type annotation is an annotation that is meta-annotated with `@Target({ElementType.TYPE_USE})`.)
271+
270272
However, some tools format them incorrectly, like this:
271273

272274
```java

0 commit comments

Comments
 (0)