@@ -100,7 +100,7 @@ private static DescribedPredicate<CanBeAnnotated> getAtGenerated() {
100
100
* @param option must not be {@literal null}.
101
101
*/
102
102
protected ApplicationModules (ModulithMetadata metadata ,
103
- DescribedPredicate <JavaClass > ignored , boolean useFullyQualifiedModuleNames , ImportOption option ) {
103
+ DescribedPredicate <? super JavaClass > ignored , boolean useFullyQualifiedModuleNames , ImportOption option ) {
104
104
this (metadata , metadata .getBasePackages (), ignored , useFullyQualifiedModuleNames , option );
105
105
}
106
106
@@ -118,18 +118,20 @@ protected ApplicationModules(ModulithMetadata metadata,
118
118
*/
119
119
@ Deprecated (forRemoval = true )
120
120
protected ApplicationModules (ModulithMetadata metadata , Collection <String > packages ,
121
- DescribedPredicate <JavaClass > ignored , boolean useFullyQualifiedModuleNames , ImportOption option ) {
121
+ DescribedPredicate <? super JavaClass > ignored , boolean useFullyQualifiedModuleNames , ImportOption option ) {
122
122
123
123
Assert .notNull (metadata , "ModulithMetadata must not be null!" );
124
124
Assert .notNull (packages , "Base packages must not be null!" );
125
125
Assert .notNull (ignored , "Ignores must not be null!" );
126
126
Assert .notNull (option , "ImportOptions must not be null!" );
127
127
128
+ DescribedPredicate <? super JavaClass > excluded = DescribedPredicate .or (ignored , IS_AOT_TYPE , IS_SPRING_CGLIB_PROXY );
129
+
128
130
this .metadata = metadata ;
129
131
this .allClasses = new ClassFileImporter () //
130
132
.withImportOption (option ) //
131
133
.importPackages (packages ) //
132
- .that (not (ignored . or ( IS_AOT_TYPE ). or ( IS_SPRING_CGLIB_PROXY ) ));
134
+ .that (not (excluded ));
133
135
134
136
Assert .notEmpty (allClasses , () -> "No classes found in packages %s!" .formatted (packages ));
135
137
@@ -215,7 +217,7 @@ public static ApplicationModules of(Class<?> modulithType) {
215
217
* @param ignored must not be {@literal null}.
216
218
* @return will never be {@literal null}.
217
219
*/
218
- public static ApplicationModules of (Class <?> modulithType , DescribedPredicate <JavaClass > ignored ) {
220
+ public static ApplicationModules of (Class <?> modulithType , DescribedPredicate <? super JavaClass > ignored ) {
219
221
220
222
Assert .notNull (modulithType , "Modulith root type must not be null!" );
221
223
Assert .notNull (ignored , "Predicate to describe ignored types must not be null!" );
@@ -653,12 +655,12 @@ public static DescribedPredicate<JavaClass> withoutModule(String name) {
653
655
654
656
private static class CacheKey {
655
657
656
- private final DescribedPredicate <JavaClass > ignored ;
658
+ private final DescribedPredicate <? super JavaClass > ignored ;
657
659
private final ImportOption options ;
658
660
private final Object metadataSource ;
659
661
private final Supplier <ModulithMetadata > metadata ;
660
662
661
- public CacheKey (DescribedPredicate <JavaClass > ignored , ImportOption options , Object metadataSource ,
663
+ public CacheKey (DescribedPredicate <? super JavaClass > ignored , ImportOption options , Object metadataSource ,
662
664
Supplier <ModulithMetadata > metadata ) {
663
665
664
666
this .ignored = ignored ;
@@ -667,15 +669,15 @@ public CacheKey(DescribedPredicate<JavaClass> ignored, ImportOption options, Obj
667
669
this .metadata = SingletonSupplier .of (metadata );
668
670
}
669
671
670
- static CacheKey of (String pkg , DescribedPredicate <JavaClass > ignored , ImportOption options ) {
672
+ static CacheKey of (String pkg , DescribedPredicate <? super JavaClass > ignored , ImportOption options ) {
671
673
return new CacheKey (ignored , options , pkg , () -> ModulithMetadata .of (pkg ));
672
674
}
673
675
674
- static CacheKey of (Class <?> type , DescribedPredicate <JavaClass > ignored , ImportOption options ) {
676
+ static CacheKey of (Class <?> type , DescribedPredicate <? super JavaClass > ignored , ImportOption options ) {
675
677
return new CacheKey (ignored , options , type , () -> ModulithMetadata .of (type ));
676
678
}
677
679
678
- DescribedPredicate <JavaClass > getIgnored () {
680
+ DescribedPredicate <? super JavaClass > getIgnored () {
679
681
return ignored ;
680
682
}
681
683
0 commit comments