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) {
130130
131131 private ReflectiveProcessor instantiateClass (Class <? extends ReflectiveProcessor > type ) {
132132 try {
133- Constructor <? extends ReflectiveProcessor > constructor = type .getDeclaredConstructor ();
134- ReflectionUtils .makeAccessible (constructor );
135- return constructor .newInstance ();
133+ return ReflectionUtils .accessibleConstructor (type ).newInstance ();
136134 }
137135 catch (Exception ex ) {
138136 throw new IllegalStateException ("Failed to instantiate " + type , ex );
139137 }
140138 }
141139
140+
142141 private static class DelegatingReflectiveProcessor implements ReflectiveProcessor {
143142
144143 private final Iterable <ReflectiveProcessor > processors ;
@@ -151,9 +150,10 @@ private static class DelegatingReflectiveProcessor implements ReflectiveProcesso
151150 public void registerReflectionHints (ReflectionHints hints , AnnotatedElement element ) {
152151 this .processors .forEach (processor -> processor .registerReflectionHints (hints , element ));
153152 }
154-
155153 }
156154
157- private record Entry (AnnotatedElement element , ReflectiveProcessor processor ) {}
155+
156+ private record Entry (AnnotatedElement element , ReflectiveProcessor processor ) {
157+ }
158158
159159}
Original file line number Diff line number Diff line change 1818
1919import java .io .FileNotFoundException ;
2020import java .io .IOException ;
21- import java .lang .reflect .Constructor ;
2221import java .net .SocketException ;
2322import java .net .UnknownHostException ;
2423import java .util .ArrayList ;
@@ -147,9 +146,7 @@ private void addPropertySource(PropertySource<?> propertySource) {
147146
148147 private static PropertySourceFactory instantiateClass (Class <? extends PropertySourceFactory > type ) {
149148 try {
150- Constructor <? extends PropertySourceFactory > constructor = type .getDeclaredConstructor ();
151- ReflectionUtils .makeAccessible (constructor );
152- return constructor .newInstance ();
149+ return ReflectionUtils .accessibleConstructor (type ).newInstance ();
153150 }
154151 catch (Exception ex ) {
155152 throw new IllegalStateException ("Failed to instantiate " + type , ex );
You can’t perform that action at this time.
0 commit comments