@@ -983,11 +983,15 @@ private boolean processType(Type type, Set<String> visited, int depth) {
983
983
SpringFeature .log (spaces (depth ) + "will follow " + t );
984
984
toFollow .add (t );
985
985
}
986
- } else if (hint .isSkipIfTypesMissing () && depth == 0 ) {
986
+ } else if (hint .isSkipIfTypesMissing () && ( depth == 0 || isNestedConfiguration ( type )) ) {
987
987
// TODO If processing secondary type (depth>0) we can't skip things as we don't
988
988
// know if the top level type that refers to us is going to fail or not. Ideally we should
989
989
// pass in the tar and accumulate types in secondary type processing and leave it to the
990
990
// outermost processing to decide if they need registration.
991
+ // Update: the isNestedConfiguration() clause allows us to discard nested configurations that are failing a COC check.
992
+ // This works if they are simply included in a setup due to being lexically inside an outer configuration - if they
993
+ // are being explicitly referenced via some other mechanism (e.g. @Import) this will need a bit of rework (the outer
994
+ // call into here should tell us how this configuration is being made so we can make a smarter decision).
991
995
passesTests = false ;
992
996
// Once failing, no need to process other hints
993
997
if (ConfigOptions .shouldRemoveUnusedAutoconfig ()) {
@@ -1242,6 +1246,14 @@ private boolean processType(Type type, Set<String> visited, int depth) {
1242
1246
return passesTests ;
1243
1247
}
1244
1248
1249
+ /**
1250
+ * Crude guess at nested configuration.
1251
+ */
1252
+ private boolean isNestedConfiguration (Type type ) {
1253
+ boolean b = type .isAtConfiguration () && type .getEnclosingType ()!=null ;
1254
+ return b ;
1255
+ }
1256
+
1245
1257
private void registerAnnotationChain (int depth , TypeAccessRequestor tar , List <Type > annotationChain ) {
1246
1258
SpringFeature .log (spaces (depth ) + "attempting registration of " + annotationChain .size ()
1247
1259
+ " elements of annotation chain" );
0 commit comments