Skip to content

Commit 754f39e

Browse files
committed
Polish
1 parent e3df6c5 commit 754f39e

File tree

1 file changed

+5
-17
lines changed
  • spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor

1 file changed

+5
-17
lines changed

spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/PropertyDescriptorResolver.java

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
import javax.lang.model.element.AnnotationMirror;
2626
import javax.lang.model.element.ExecutableElement;
27-
import javax.lang.model.element.NestingKind;
2827
import javax.lang.model.element.TypeElement;
2928
import javax.lang.model.element.VariableElement;
3029
import javax.lang.model.type.TypeMirror;
@@ -143,16 +142,13 @@ private static class ConfigurationPropertiesTypeElement {
143142

144143
private final TypeElement type;
145144

146-
private final boolean constructorBoundType;
147-
148145
private final List<ExecutableElement> constructors;
149146

150147
private final List<ExecutableElement> boundConstructors;
151148

152-
ConfigurationPropertiesTypeElement(TypeElement type, boolean constructorBoundType,
153-
List<ExecutableElement> constructors, List<ExecutableElement> boundConstructors) {
149+
ConfigurationPropertiesTypeElement(TypeElement type, List<ExecutableElement> constructors,
150+
List<ExecutableElement> boundConstructors) {
154151
this.type = type;
155-
this.constructorBoundType = constructorBoundType;
156152
this.constructors = constructors;
157153
this.boundConstructors = boundConstructors;
158154
}
@@ -162,11 +158,11 @@ TypeElement getType() {
162158
}
163159

164160
boolean isConstructorBindingEnabled() {
165-
return this.constructorBoundType || !this.boundConstructors.isEmpty();
161+
return !this.boundConstructors.isEmpty();
166162
}
167163

168164
ExecutableElement getBindConstructor() {
169-
if (this.constructorBoundType && this.boundConstructors.isEmpty()) {
165+
if (this.boundConstructors.isEmpty()) {
170166
return findBoundConstructor();
171167
}
172168
if (this.boundConstructors.size() == 1) {
@@ -189,10 +185,9 @@ private ExecutableElement findBoundConstructor() {
189185
}
190186

191187
static ConfigurationPropertiesTypeElement of(TypeElement type, MetadataGenerationEnvironment env) {
192-
boolean constructorBoundType = isConstructorBoundType(type, env);
193188
List<ExecutableElement> constructors = ElementFilter.constructorsIn(type.getEnclosedElements());
194189
List<ExecutableElement> boundConstructors = getBoundConstructors(env, constructors);
195-
return new ConfigurationPropertiesTypeElement(type, constructorBoundType, constructors, boundConstructors);
190+
return new ConfigurationPropertiesTypeElement(type, constructors, boundConstructors);
196191
}
197192

198193
private static List<ExecutableElement> getBoundConstructors(MetadataGenerationEnvironment env,
@@ -213,13 +208,6 @@ private static ExecutableElement deduceBindConstructor(List<ExecutableElement> c
213208
return null;
214209
}
215210

216-
private static boolean isConstructorBoundType(TypeElement type, MetadataGenerationEnvironment env) {
217-
if (type.getNestingKind() == NestingKind.MEMBER) {
218-
return isConstructorBoundType((TypeElement) type.getEnclosingElement(), env);
219-
}
220-
return false;
221-
}
222-
223211
}
224212

225213
}

0 commit comments

Comments
 (0)