Skip to content

Commit 5eac75e

Browse files
committed
Chore
Signed-off-by: sijun-yang <[email protected]>
1 parent e9ce2b3 commit 5eac75e

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

initializr-generator/src/main/java/io/spring/initializr/generator/language/AnnotationContainer.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
* A container for {@linkplain Annotation annotations} defined on an annotated element.
2828
*
2929
* @author Stephane Nicoll
30+
* @author Sijun Yang
3031
*/
3132
public class AnnotationContainer {
3233

@@ -60,8 +61,8 @@ public boolean has(ClassName className) {
6061
/**
6162
* Specify if this instance contains an annotation with the specified name.
6263
* @param name the name of the annotation
63-
* @return {@code true} if an annotation with the specified name is present,
64-
* otherwise {@code false}
64+
* @return {@code true} if an annotation with the specified name is present, otherwise
65+
* {@code false}
6566
*/
6667
public boolean has(String name) {
6768
return this.annotations.containsKey(name);
@@ -76,16 +77,15 @@ public Stream<Annotation> values() {
7677
}
7778

7879
/**
79-
* Add an {@link Annotation} with the specific name and {@link Consumer} to
80-
* customize it. If an annotation with that name already exists, the consumer can
81-
* be used to further tune its attributes.
80+
* Add an {@link Annotation} with the specific name and {@link Consumer} to customize
81+
* it. If an annotation with that name already exists, the consumer can be used to
82+
* further tune its attributes.
8283
* @param name the name of the annotation
8384
* @param className the class name of the annotation
8485
* @param annotation a {@link Consumer} to further configure the annotation
8586
*/
8687
public void add(String name, ClassName className, Consumer<Builder> annotation) {
87-
Builder builder = this.annotations.computeIfAbsent(name,
88-
(key) -> new Builder(className));
88+
Builder builder = this.annotations.computeIfAbsent(name, (key) -> new Builder(className));
8989
if (annotation != null) {
9090
annotation.accept(builder);
9191
}

initializr-generator/src/test/java/io/spring/initializr/generator/language/AnnotationContainerTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,10 @@ void addWithDifferentNamesAddsTwoAnnotations() {
116116
container.add("test-1", TEST_CLASS_NAME, (annotation) -> annotation.set("id", 1));
117117
container.add("test-2", TEST_CLASS_NAME, (annotation) -> annotation.set("id", 2));
118118
assertThat(container.values()).satisfiesExactlyInAnyOrder(
119-
(a) -> assertThat(a.getAttributes()).singleElement()
120-
.satisfies((attribute) -> assertThat(attribute.getValues()).containsOnly(1)),
121-
(a) -> assertThat(a.getAttributes()).singleElement()
122-
.satisfies((attribute) -> assertThat(attribute.getValues()).containsOnly(2)));
119+
(a) -> assertThat(a.getAttributes()).singleElement()
120+
.satisfies((attribute) -> assertThat(attribute.getValues()).containsOnly(1)),
121+
(a) -> assertThat(a.getAttributes()).singleElement()
122+
.satisfies((attribute) -> assertThat(attribute.getValues()).containsOnly(2)));
123123
}
124124

125125
@Test

initializr-generator/src/test/java/io/spring/initializr/generator/language/groovy/GroovySourceCodeWriterTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,9 @@ void repeatableAnnotationsOnMethod() throws IOException {
353353
GroovyCompilationUnit compilationUnit = sourceCode.createCompilationUnit("com.example", "Test");
354354
GroovyTypeDeclaration test = compilationUnit.createTypeDeclaration("Test");
355355
GroovyMethodDeclaration method = GroovyMethodDeclaration.method("testMethod")
356-
.returning("void")
357-
.parameters()
358-
.body(CodeBlock.of(""));
356+
.returning("void")
357+
.parameters()
358+
.body(CodeBlock.of(""));
359359
method.annotations().add("TestAnnotation1", ClassName.of("com.example.TestMethodAnnotation"));
360360
method.annotations().add("TestAnnotation2", ClassName.of("com.example.TestMethodAnnotation"));
361361
test.addMethodDeclaration(method);

initializr-generator/src/test/java/io/spring/initializr/generator/language/java/JavaSourceCodeWriterTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@ void repeatableAnnotationsOnField() throws IOException {
345345
JavaCompilationUnit compilationUnit = sourceCode.createCompilationUnit("com.example", "Test");
346346
JavaTypeDeclaration test = compilationUnit.createTypeDeclaration("Test");
347347
JavaFieldDeclaration field = JavaFieldDeclaration.field("testField")
348-
.modifiers(Modifier.PRIVATE)
349-
.returning("java.lang.String");
348+
.modifiers(Modifier.PRIVATE)
349+
.returning("java.lang.String");
350350
field.annotations().add("TestAnnotation1", ClassName.of("com.example.TestFiledAnnotation"));
351351
field.annotations().add("TestAnnotation2", ClassName.of("com.example.TestFiledAnnotation"));
352352
test.addFieldDeclaration(field);
@@ -361,9 +361,9 @@ void repeatableAnnotationsOnMethod() throws IOException {
361361
JavaCompilationUnit compilationUnit = sourceCode.createCompilationUnit("com.example", "Test");
362362
JavaTypeDeclaration test = compilationUnit.createTypeDeclaration("Test");
363363
JavaMethodDeclaration method = JavaMethodDeclaration.method("testMethod")
364-
.returning("void")
365-
.parameters()
366-
.body(CodeBlock.of(""));
364+
.returning("void")
365+
.parameters()
366+
.body(CodeBlock.of(""));
367367
method.annotations().add("TestAnnotation1", ClassName.of("com.example.TestMethodAnnotation"));
368368
method.annotations().add("TestAnnotation2", ClassName.of("com.example.TestMethodAnnotation"));
369369
test.addMethodDeclaration(method);

initializr-generator/src/test/java/io/spring/initializr/generator/language/kotlin/KotlinSourceCodeWriterTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,8 @@ void repeatableAnnotationsOnField() throws IOException {
452452
KotlinCompilationUnit compilationUnit = sourceCode.createCompilationUnit("com.example", "Test");
453453
KotlinTypeDeclaration test = compilationUnit.createTypeDeclaration("Test");
454454
KotlinPropertyDeclaration field = KotlinPropertyDeclaration.var("testField")
455-
.returning("java.lang.String").empty();
455+
.returning("java.lang.String")
456+
.empty();
456457
field.annotations().add("TestAnnotation1", ClassName.of("com.example.TestFiledAnnotation"));
457458
field.annotations().add("TestAnnotation2", ClassName.of("com.example.TestFiledAnnotation"));
458459
test.addPropertyDeclaration(field);
@@ -466,8 +467,7 @@ void repeatableAnnotationsOnMethod() throws IOException {
466467
KotlinSourceCode sourceCode = new KotlinSourceCode();
467468
KotlinCompilationUnit compilationUnit = sourceCode.createCompilationUnit("com.example", "Test");
468469
KotlinTypeDeclaration test = compilationUnit.createTypeDeclaration("Test");
469-
KotlinFunctionDeclaration method = KotlinFunctionDeclaration.function("testMethod")
470-
.body(CodeBlock.of(""));
470+
KotlinFunctionDeclaration method = KotlinFunctionDeclaration.function("testMethod").body(CodeBlock.of(""));
471471
method.annotations().add("TestAnnotation1", ClassName.of("com.example.TestMethodAnnotation"));
472472
method.annotations().add("TestAnnotation2", ClassName.of("com.example.TestMethodAnnotation"));
473473
test.addFunctionDeclaration(method);

0 commit comments

Comments
 (0)