@@ -100,7 +100,7 @@ private static DescribedPredicate<CanBeAnnotated> getAtGenerated() {
100100 * @param option must not be {@literal null}.
101101 */
102102 protected ApplicationModules (ModulithMetadata metadata ,
103- DescribedPredicate <JavaClass > ignored , boolean useFullyQualifiedModuleNames , ImportOption option ) {
103+ DescribedPredicate <? super JavaClass > ignored , boolean useFullyQualifiedModuleNames , ImportOption option ) {
104104 this (metadata , metadata .getBasePackages (), ignored , useFullyQualifiedModuleNames , option );
105105 }
106106
@@ -118,18 +118,20 @@ protected ApplicationModules(ModulithMetadata metadata,
118118 */
119119 @ Deprecated (forRemoval = true )
120120 protected ApplicationModules (ModulithMetadata metadata , Collection <String > packages ,
121- DescribedPredicate <JavaClass > ignored , boolean useFullyQualifiedModuleNames , ImportOption option ) {
121+ DescribedPredicate <? super JavaClass > ignored , boolean useFullyQualifiedModuleNames , ImportOption option ) {
122122
123123 Assert .notNull (metadata , "ModulithMetadata must not be null!" );
124124 Assert .notNull (packages , "Base packages must not be null!" );
125125 Assert .notNull (ignored , "Ignores must not be null!" );
126126 Assert .notNull (option , "ImportOptions must not be null!" );
127127
128+ DescribedPredicate <? super JavaClass > excluded = DescribedPredicate .or (ignored , IS_AOT_TYPE , IS_SPRING_CGLIB_PROXY );
129+
128130 this .metadata = metadata ;
129131 this .allClasses = new ClassFileImporter () //
130132 .withImportOption (option ) //
131133 .importPackages (packages ) //
132- .that (not (ignored . or ( IS_AOT_TYPE ). or ( IS_SPRING_CGLIB_PROXY ) ));
134+ .that (not (excluded ));
133135
134136 Assert .notEmpty (allClasses , () -> "No classes found in packages %s!" .formatted (packages ));
135137
@@ -215,7 +217,7 @@ public static ApplicationModules of(Class<?> modulithType) {
215217 * @param ignored must not be {@literal null}.
216218 * @return will never be {@literal null}.
217219 */
218- public static ApplicationModules of (Class <?> modulithType , DescribedPredicate <JavaClass > ignored ) {
220+ public static ApplicationModules of (Class <?> modulithType , DescribedPredicate <? super JavaClass > ignored ) {
219221
220222 Assert .notNull (modulithType , "Modulith root type must not be null!" );
221223 Assert .notNull (ignored , "Predicate to describe ignored types must not be null!" );
@@ -653,12 +655,12 @@ public static DescribedPredicate<JavaClass> withoutModule(String name) {
653655
654656 private static class CacheKey {
655657
656- private final DescribedPredicate <JavaClass > ignored ;
658+ private final DescribedPredicate <? super JavaClass > ignored ;
657659 private final ImportOption options ;
658660 private final Object metadataSource ;
659661 private final Supplier <ModulithMetadata > metadata ;
660662
661- public CacheKey (DescribedPredicate <JavaClass > ignored , ImportOption options , Object metadataSource ,
663+ public CacheKey (DescribedPredicate <? super JavaClass > ignored , ImportOption options , Object metadataSource ,
662664 Supplier <ModulithMetadata > metadata ) {
663665
664666 this .ignored = ignored ;
@@ -667,15 +669,15 @@ public CacheKey(DescribedPredicate<JavaClass> ignored, ImportOption options, Obj
667669 this .metadata = SingletonSupplier .of (metadata );
668670 }
669671
670- static CacheKey of (String pkg , DescribedPredicate <JavaClass > ignored , ImportOption options ) {
672+ static CacheKey of (String pkg , DescribedPredicate <? super JavaClass > ignored , ImportOption options ) {
671673 return new CacheKey (ignored , options , pkg , () -> ModulithMetadata .of (pkg ));
672674 }
673675
674- static CacheKey of (Class <?> type , DescribedPredicate <JavaClass > ignored , ImportOption options ) {
676+ static CacheKey of (Class <?> type , DescribedPredicate <? super JavaClass > ignored , ImportOption options ) {
675677 return new CacheKey (ignored , options , type , () -> ModulithMetadata .of (type ));
676678 }
677679
678- DescribedPredicate <JavaClass > getIgnored () {
680+ DescribedPredicate <? super JavaClass > getIgnored () {
679681 return ignored ;
680682 }
681683
0 commit comments