Skip to content

Commit 07ebfc0

Browse files
committed
Polish
1 parent b1e90fd commit 07ebfc0

File tree

1 file changed

+8
-9
lines changed
  • spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind

1 file changed

+8
-9
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/JavaBeanBinder.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,6 @@ public BeanSupplier<T> getSupplier(Bindable<T> target) {
192192
});
193193
}
194194

195-
private boolean isOfDifferentType(ResolvableType targetType,
196-
Class<?> resolvedType) {
197-
if (this.type.hasGenerics() || targetType.hasGenerics()) {
198-
return !this.type.equals(targetType);
199-
}
200-
return this.resolvedType == null || !this.resolvedType.equals(resolvedType);
201-
}
202-
203195
@SuppressWarnings("unchecked")
204196
public static <T> Bean<T> get(Bindable<T> bindable, boolean canCallGetValue) {
205197
ResolvableType type = bindable.getType();
@@ -214,7 +206,7 @@ public static <T> Bean<T> get(Bindable<T> bindable, boolean canCallGetValue) {
214206
return null;
215207
}
216208
Bean<?> bean = Bean.cached;
217-
if (bean == null || bean.isOfDifferentType(type, resolvedType)) {
209+
if (bean == null || !bean.isOfType(type, resolvedType)) {
218210
bean = new Bean<>(type, resolvedType);
219211
cached = bean;
220212
}
@@ -234,6 +226,13 @@ private static boolean isInstantiable(Class<?> type) {
234226
}
235227
}
236228

229+
private boolean isOfType(ResolvableType type, Class<?> resolvedType) {
230+
if (this.type.hasGenerics() || type.hasGenerics()) {
231+
return this.type.equals(type);
232+
}
233+
return this.resolvedType != null && this.resolvedType.equals(resolvedType);
234+
}
235+
237236
}
238237

239238
private static class BeanSupplier<T> implements Supplier<T> {

0 commit comments

Comments
 (0)