File tree Expand file tree Collapse file tree 2 files changed +6
-9
lines changed
spring-core/src/main/java/org/springframework Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -130,15 +130,14 @@ private Entry createEntry(AnnotatedElement element) {
130
130
131
131
private ReflectiveProcessor instantiateClass (Class <? extends ReflectiveProcessor > type ) {
132
132
try {
133
- Constructor <? extends ReflectiveProcessor > constructor = type .getDeclaredConstructor ();
134
- ReflectionUtils .makeAccessible (constructor );
135
- return constructor .newInstance ();
133
+ return ReflectionUtils .accessibleConstructor (type ).newInstance ();
136
134
}
137
135
catch (Exception ex ) {
138
136
throw new IllegalStateException ("Failed to instantiate " + type , ex );
139
137
}
140
138
}
141
139
140
+
142
141
private static class DelegatingReflectiveProcessor implements ReflectiveProcessor {
143
142
144
143
private final Iterable <ReflectiveProcessor > processors ;
@@ -151,9 +150,10 @@ private static class DelegatingReflectiveProcessor implements ReflectiveProcesso
151
150
public void registerReflectionHints (ReflectionHints hints , AnnotatedElement element ) {
152
151
this .processors .forEach (processor -> processor .registerReflectionHints (hints , element ));
153
152
}
154
-
155
153
}
156
154
157
- private record Entry (AnnotatedElement element , ReflectiveProcessor processor ) {}
155
+
156
+ private record Entry (AnnotatedElement element , ReflectiveProcessor processor ) {
157
+ }
158
158
159
159
}
Original file line number Diff line number Diff line change 18
18
19
19
import java .io .FileNotFoundException ;
20
20
import java .io .IOException ;
21
- import java .lang .reflect .Constructor ;
22
21
import java .net .SocketException ;
23
22
import java .net .UnknownHostException ;
24
23
import java .util .ArrayList ;
@@ -147,9 +146,7 @@ private void addPropertySource(PropertySource<?> propertySource) {
147
146
148
147
private static PropertySourceFactory instantiateClass (Class <? extends PropertySourceFactory > type ) {
149
148
try {
150
- Constructor <? extends PropertySourceFactory > constructor = type .getDeclaredConstructor ();
151
- ReflectionUtils .makeAccessible (constructor );
152
- return constructor .newInstance ();
149
+ return ReflectionUtils .accessibleConstructor (type ).newInstance ();
153
150
}
154
151
catch (Exception ex ) {
155
152
throw new IllegalStateException ("Failed to instantiate " + type , ex );
You can’t perform that action at this time.
0 commit comments