|
1 | 1 | /*
|
2 |
| - * Copyright 2022-2023 DiffPlug |
| 2 | + * Copyright 2022-2024 DiffPlug |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
26 | 26 |
|
27 | 27 | import com.diffplug.spotless.FormatterFunc;
|
28 | 28 | import com.diffplug.spotless.FormatterStep;
|
| 29 | +import com.diffplug.spotless.RoundedStep; |
29 | 30 |
|
30 | 31 | /**
|
31 | 32 | * Some formatters put every annotation on its own line
|
|
36 | 37 | * <p>
|
37 | 38 | * Note: A type annotation is an annotation that is meta-annotated with {@code @Target({ElementType.TYPE_USE})}.
|
38 | 39 | */
|
39 |
| -public final class FormatAnnotationsStep { |
| 40 | +public final class FormatAnnotationsStep implements RoundedStep { |
| 41 | + private static final long serialVersionUID = 1L; |
40 | 42 |
|
41 | 43 | /**
|
42 | 44 | * Simple names of type annotations.
|
@@ -389,7 +391,7 @@ public final class FormatAnnotationsStep {
|
389 | 391 |
|
390 | 392 | );
|
391 | 393 |
|
392 |
| - static final String NAME = "No line break between type annotation and type"; |
| 394 | + private static final String NAME = "No line break between type annotation and type"; |
393 | 395 |
|
394 | 396 | public static FormatterStep create() {
|
395 | 397 | return create(Collections.emptyList(), Collections.emptyList());
|
@@ -432,13 +434,13 @@ private static final class State implements Serializable {
|
432 | 434 | }
|
433 | 435 |
|
434 | 436 | FormatterFunc toFormatter() {
|
435 |
| - return unixStr -> fixupTypeAnnotations(unixStr); |
| 437 | + return this::fixupTypeAnnotations; |
436 | 438 | }
|
437 | 439 |
|
438 | 440 | /**
|
439 | 441 | * Removes line break between type annotations and the following type.
|
440 | 442 | *
|
441 |
| - * @param the text of a Java file |
| 443 | + * @param unixStr the text of a Java file |
442 | 444 | * @return corrected text of the Java file
|
443 | 445 | */
|
444 | 446 | String fixupTypeAnnotations(String unixStr) {
|
|
0 commit comments