39
39
import org .springframework .boot .context .properties .bind .JavaBeanBinder .BeanProperties ;
40
40
import org .springframework .boot .context .properties .bind .JavaBeanBinder .BeanProperty ;
41
41
import org .springframework .core .KotlinDetector ;
42
- import org .springframework .core .KotlinReflectionParameterNameDiscoverer ;
43
- import org .springframework .core .ParameterNameDiscoverer ;
44
- import org .springframework .core .PrioritizedParameterNameDiscoverer ;
45
42
import org .springframework .core .ResolvableType ;
46
- import org .springframework .core .StandardReflectionParameterNameDiscoverer ;
47
43
import org .springframework .core .annotation .MergedAnnotations ;
48
44
import org .springframework .util .Assert ;
49
45
import org .springframework .util .ReflectionUtils ;
@@ -92,12 +88,8 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
92
88
* @param hints the hints contributed so far for the deployment unit
93
89
*/
94
90
public void registerHints (RuntimeHints hints ) {
95
- Set <Class <?>> compiledWithoutParameters = new HashSet <>();
96
91
for (Bindable <?> bindable : this .bindables ) {
97
- new Processor (bindable , compiledWithoutParameters ).process (hints .reflection ());
98
- }
99
- if (!compiledWithoutParameters .isEmpty ()) {
100
- throw new MissingParametersCompilerArgumentException (compiledWithoutParameters );
92
+ new Processor (bindable ).process (hints .reflection ());
101
93
}
102
94
}
103
95
@@ -144,18 +136,7 @@ public static BindableRuntimeHintsRegistrar forBindables(Bindable<?>... bindable
144
136
/**
145
137
* Processor used to register the hints.
146
138
*/
147
- private final class Processor {
148
-
149
- private static final ParameterNameDiscoverer parameterNameDiscoverer ;
150
-
151
- static {
152
- PrioritizedParameterNameDiscoverer discoverer = new PrioritizedParameterNameDiscoverer ();
153
- if (KotlinDetector .isKotlinReflectPresent ()) {
154
- discoverer .addDiscoverer (new KotlinReflectionParameterNameDiscoverer ());
155
- }
156
- discoverer .addDiscoverer (new StandardReflectionParameterNameDiscoverer ());
157
- parameterNameDiscoverer = discoverer ;
158
- }
139
+ private static final class Processor {
159
140
160
141
private final Class <?> type ;
161
142
@@ -165,21 +146,17 @@ private final class Processor {
165
146
166
147
private final Set <Class <?>> seen ;
167
148
168
- private final Set <Class <?>> compiledWithoutParameters ;
169
-
170
- Processor (Bindable <?> bindable , Set <Class <?>> compiledWithoutParameters ) {
171
- this (bindable , false , new HashSet <>(), compiledWithoutParameters );
149
+ Processor (Bindable <?> bindable ) {
150
+ this (bindable , false , new HashSet <>());
172
151
}
173
152
174
- private Processor (Bindable <?> bindable , boolean nestedType , Set <Class <?>> seen ,
175
- Set <Class <?>> compiledWithoutParameters ) {
153
+ private Processor (Bindable <?> bindable , boolean nestedType , Set <Class <?>> seen ) {
176
154
this .type = bindable .getType ().getRawClass ();
177
155
this .bindConstructor = (bindable .getBindMethod () != BindMethod .JAVA_BEAN )
178
156
? BindConstructorProvider .DEFAULT .getBindConstructor (bindable .getType ().resolve (), nestedType )
179
157
: null ;
180
158
this .bean = JavaBeanBinder .BeanProperties .of (bindable );
181
159
this .seen = seen ;
182
- this .compiledWithoutParameters = compiledWithoutParameters ;
183
160
}
184
161
185
162
void process (ReflectionHints hints ) {
@@ -198,7 +175,6 @@ else if (this.bean != null && !this.bean.getProperties().isEmpty()) {
198
175
199
176
private void handleConstructor (ReflectionHints hints ) {
200
177
if (this .bindConstructor != null ) {
201
- verifyParameterNamesAreAvailable ();
202
178
if (KotlinDetector .isKotlinType (this .bindConstructor .getDeclaringClass ())) {
203
179
KotlinDelegate .handleConstructor (hints , this .bindConstructor );
204
180
}
@@ -213,13 +189,6 @@ private void handleConstructor(ReflectionHints hints) {
213
189
.ifPresent ((constructor ) -> hints .registerConstructor (constructor , ExecutableMode .INVOKE ));
214
190
}
215
191
216
- private void verifyParameterNamesAreAvailable () {
217
- String [] parameterNames = parameterNameDiscoverer .getParameterNames (this .bindConstructor );
218
- if (parameterNames == null ) {
219
- this .compiledWithoutParameters .add (this .bindConstructor .getDeclaringClass ());
220
- }
221
- }
222
-
223
192
private boolean hasNoParameters (Constructor <?> candidate ) {
224
193
return candidate .getParameterCount () == 0 ;
225
194
}
@@ -268,7 +237,7 @@ else if (isNestedType(propertyName, propertyClass)) {
268
237
}
269
238
270
239
private void processNested (Class <?> type , ReflectionHints hints ) {
271
- new Processor (Bindable .of (type ), true , this .seen , this . compiledWithoutParameters ).process (hints );
240
+ new Processor (Bindable .of (type ), true , this .seen ).process (hints );
272
241
}
273
242
274
243
private Class <?> getComponentClass (ResolvableType type ) {
0 commit comments