Skip to content

Commit 3252968

Browse files
committed
java 16 compatibility: reducing inaccessibility impact
1 parent 4884d1b commit 3252968

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

spring/src/main/java/io/kubernetes/client/spring/extended/manifests/KubernetesFromYamlProcessor.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ public Object postProcessAfterInitialization(Object bean, String beanName) throw
6060
}
6161

6262
for (Field field : bean.getClass().getDeclaredFields()) {
63+
// skip if the field if the FromYaml annotation is missing
64+
fromYamlAnnotation = field.getAnnotation(FromYaml.class);
65+
if (fromYamlAnnotation == null) {
66+
continue; // skip if the field doesn't have the annotation
67+
}
68+
// injecting
6369
ReflectionUtils.makeAccessible(field);
6470
try {
6571
if (field.get(bean) != null) {
@@ -70,11 +76,6 @@ public Object postProcessAfterInitialization(Object bean, String beanName) throw
7076
continue;
7177
}
7278

73-
fromYamlAnnotation = field.getAnnotation(FromYaml.class);
74-
if (fromYamlAnnotation == null) {
75-
continue; // skip if the field doesn't have the annotation
76-
}
77-
7879
Object loadedObj = loadFromYaml(fromYamlAnnotation.filePath());
7980
ReflectionUtils.setField(field, bean, loadedObj);
8081
}

0 commit comments

Comments
 (0)