Skip to content

Commit 437636b

Browse files
committed
List of type annotations is hard-coded
1 parent d8f047e commit 437636b

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

CHANGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
1111

1212
## [Unreleased]
1313
### Added
14-
* `typeAnnotations()` step to correct formatting of type annotations. It puts type annotations on the same line as the type that they qualify. Run it after a Java formattng step, such as `googleJavaFormat()`. ([#1275](https://github.com/diffplug/spotless/pull/1275))
14+
* `typeAnnotations()` step to correct formatting of type annotations. It puts type annotations on the same line as the type that they qualify. Run it after a Java formatting step, such as `googleJavaFormat()`. ([#1275](https://github.com/diffplug/spotless/pull/1275))
1515

1616
## [2.29.0] - 2022-08-23
1717
### Added

plugin-gradle/CHANGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
44

55
## [Unreleased]
66
### Added
7-
* `typeAnnotations()` step to correct formatting of type annotations. It puts type annotations on the same line as the type that they qualify. Run it after a Java formattng step, such as `googleJavaFormat()`. ([#1275](https://github.com/diffplug/spotless/pull/1275))
7+
* `typeAnnotations()` step to correct formatting of type annotations. It puts type annotations on the same line as the type that they qualify. Run it after a Java formatting step, such as `googleJavaFormat()`. ([#1275](https://github.com/diffplug/spotless/pull/1275))
88

99
## [6.10.0] - 2022-08-23
1010
### Added

plugin-gradle/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,6 @@ 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-
267265
However, some tools format them incorrectly, like this:
268266

269267
```java
@@ -287,6 +285,11 @@ spotless {
287285

288286
This does not re-order annotations, it just removes incorrect newlines.
289287

288+
A type annotation is an annotation that is meta-annotated with `@Target({ElementType.TYPE_USE})`.
289+
Because Spotless cannot necessarily examine the annotation definition, it uses a hard-coded
290+
list of well-known type annotations. You can make a pull request to add new ones.
291+
In the future there will be mechanisms to add/remove annotations from the list.
292+
290293

291294
<a name="applying-to-groovy-source"></a>
292295

plugin-maven/CHANGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
44

55
## [Unreleased]
66
### Added
7-
* `typeAnnotations` step to correct formatting of type annotations. It puts type annotations on the same line as the type that they qualify. Run it after a Java formattng step, such as `googleJavaFormat`. ([#1275](https://github.com/diffplug/spotless/pull/1275))
7+
* `typeAnnotations` step to correct formatting of type annotations. It puts type annotations on the same line as the type that they qualify. Run it after a Java formatting step, such as `googleJavaFormat`. ([#1275](https://github.com/diffplug/spotless/pull/1275))
88

99
## [2.25.0] - 2022-08-23
1010
### Added

plugin-maven/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,6 @@ 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-
272270
However, some tools format them incorrectly, like this:
273271

274272
```java
@@ -288,6 +286,12 @@ To fix the incorrect formatting, add the `typeAnnotations()` rule after a Java f
288286

289287
This does not re-order annotations, it just removes incorrect newlines.
290288

289+
A type annotation is an annotation that is meta-annotated with `@Target({ElementType.TYPE_USE})`.
290+
Because Spotless cannot necessarily examine the annotation definition, it uses a hard-coded
291+
list of well-known type annotations. You can make a pull request to add new ones.
292+
In the future there will be mechanisms to add/remove annotations from the list.
293+
294+
291295
## Groovy
292296

293297
[code](https://github.com/diffplug/spotless/blob/main/plugin-maven/src/main/java/com/diffplug/spotless/maven/groovy/Groovy.java). [available steps](https://github.com/diffplug/spotless/tree/main/plugin-maven/src/main/java/com/diffplug/spotless/maven/groovy).

0 commit comments

Comments
 (0)