Skip to content

Commit 6bd25f6

Browse files
committed
Polish
1 parent ff890bc commit 6bd25f6

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyBeanRegistrationCodeFragmentsCustomizerTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ void getBeanRegistrationCodeGeneratorWhenScopedProxyWithTargetBeanName() {
133133
private void testCompile(BiConsumer<DefaultListableBeanFactory, Compiled> result) {
134134
BeanFactoryInitializationAotContribution contribution = this.processor
135135
.processAheadOfTime(this.beanFactory);
136+
assertThat(contribution).isNotNull();
136137
contribution.applyTo(this.generationContext, this.beanFactoryInitializationCode);
137138
this.generationContext.writeGeneratedContent();
138139
TestCompiler.forSystem().withFiles(this.generatedFiles).printFiles(System.out)
@@ -151,7 +152,7 @@ private void testCompile(BiConsumer<DefaultListableBeanFactory, Compiled> result
151152
}
152153

153154

154-
class MockBeanFactoryInitializationCode implements BeanFactoryInitializationCode {
155+
static class MockBeanFactoryInitializationCode implements BeanFactoryInitializationCode {
155156

156157
private final GeneratedMethods generatedMethods = new GeneratedMethods();
157158

@@ -168,7 +169,7 @@ public void addInitializer(MethodReference methodReference) {
168169
}
169170

170171
List<MethodReference> getInitializers() {
171-
return initializers;
172+
return this.initializers;
172173
}
173174

174175
}

spring-core/src/main/java/org/springframework/aot/generate/ClassNameGenerator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
*
3434
* @author Phillip Webb
3535
* @since 6.0
36-
* @see GeneratedClassName
3736
*/
3837
public final class ClassNameGenerator {
3938

spring-core/src/main/java/org/springframework/aot/generate/GeneratedMethod.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import org.springframework.javapoet.MethodSpec;
2222
import org.springframework.javapoet.MethodSpec.Builder;
23+
import org.springframework.lang.Nullable;
2324
import org.springframework.util.Assert;
2425

2526
/**
@@ -34,6 +35,7 @@ public final class GeneratedMethod {
3435

3536
private final String name;
3637

38+
@Nullable
3739
private MethodSpec spec;
3840

3941

@@ -84,7 +86,7 @@ public GeneratedMethod using(Consumer<MethodSpec.Builder> builder) {
8486
}
8587

8688
private void assertNameHasNotBeenChanged(MethodSpec spec) {
87-
Assert.isTrue(this.name.toString().equals(spec.name), () -> String
89+
Assert.isTrue(this.name.equals(spec.name), () -> String
8890
.format("'spec' must use the generated name \"%s\"", this.name));
8991
}
9092

spring-core/src/main/java/org/springframework/aot/generate/MethodReference.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public final class MethodReference {
3131

3232
private final Kind kind;
3333

34+
@Nullable
3435
private final ClassName declaringClass;
3536

3637
private final String methodName;
@@ -109,6 +110,7 @@ public static MethodReference ofStatic(ClassName declaringClass, String methodNa
109110
* Return the referenced declaring class.
110111
* @return the declaring class
111112
*/
113+
@Nullable
112114
public ClassName getDeclaringClass() {
113115
return this.declaringClass;
114116
}
@@ -147,7 +149,7 @@ public CodeBlock toCodeBlock(@Nullable String instanceVariable) {
147149
};
148150
}
149151

150-
private CodeBlock toCodeBlockForInstance(String instanceVariable) {
152+
private CodeBlock toCodeBlockForInstance(@Nullable String instanceVariable) {
151153
instanceVariable = (instanceVariable != null) ? instanceVariable : "this";
152154
return CodeBlock.of("$L::$L", instanceVariable, this.methodName);
153155

0 commit comments

Comments
 (0)