Prevent incomplete types to stop AOT processing

Previously, if a type to bind had a property whose type could not be
loaded, this would fail the whole build. This commit makes sure that
such failure does not stop AOT processing: rather we ignore the
incomplete type and carry on.

Closes gh-43598
This commit is contained in:
Stéphane Nicoll 2024-12-23 16:12:53 +01:00
parent a87a856376
commit 0035569882
1 changed files with 10 additions and 1 deletions

View File

@ -29,6 +29,8 @@ import java.util.stream.StreamSupport;
import kotlin.jvm.JvmClassMappingKt;
import kotlin.reflect.KClass;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.aot.hint.ExecutableMode;
import org.springframework.aot.hint.MemberCategory;
@ -59,6 +61,8 @@ import org.springframework.util.ReflectionUtils;
*/
public class BindableRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
private static final Log logger = LogFactory.getLog(BindableRuntimeHintsRegistrar.class);
private final Bindable<?>[] bindables;
/**
@ -89,7 +93,12 @@ public class BindableRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
*/
public void registerHints(RuntimeHints hints) {
for (Bindable<?> bindable : this.bindables) {
new Processor(bindable).process(hints.reflection());
try {
new Processor(bindable).process(hints.reflection());
}
catch (Exception ex) {
logger.debug("Skipping hints for " + bindable, ex);
}
}
}