@@ -96,13 +96,15 @@ public class ApplicationModules implements Iterable<ApplicationModule> {
96
96
private boolean verified ;
97
97
98
98
protected ApplicationModules (ModulithMetadata metadata , Collection <String > packages ,
99
- DescribedPredicate <JavaClass > ignored , boolean useFullyQualifiedModuleNames , ImportOption option ) {
99
+ DescribedPredicate <? super JavaClass > ignored , boolean useFullyQualifiedModuleNames , ImportOption option ) {
100
+
101
+ DescribedPredicate <? super JavaClass > excluded = DescribedPredicate .or (ignored , IS_AOT_TYPE );
100
102
101
103
this .metadata = metadata ;
102
104
this .allClasses = new ClassFileImporter () //
103
105
.withImportOption (option ) //
104
106
.importPackages (packages ) //
105
- .that (not (ignored . or ( IS_AOT_TYPE ) ));
107
+ .that (not (excluded ));
106
108
107
109
Classes classes = Classes .of (allClasses );
108
110
@@ -185,7 +187,7 @@ public static ApplicationModules of(Class<?> modulithType) {
185
187
* @param ignored must not be {@literal null}.
186
188
* @return will never be {@literal null}.
187
189
*/
188
- public static ApplicationModules of (Class <?> modulithType , DescribedPredicate <JavaClass > ignored ) {
190
+ public static ApplicationModules of (Class <?> modulithType , DescribedPredicate <? super JavaClass > ignored ) {
189
191
190
192
CacheKey key = new TypeKey (modulithType , ignored );
191
193
@@ -215,7 +217,7 @@ public static ApplicationModules of(String javaPackage) {
215
217
* @param ignored must not be {@literal null}.
216
218
* @return will never be {@literal null}.
217
219
*/
218
- public static ApplicationModules of (String javaPackage , DescribedPredicate <JavaClass > ignored ) {
220
+ public static ApplicationModules of (String javaPackage , DescribedPredicate <? super JavaClass > ignored ) {
219
221
220
222
CacheKey key = new PackageKey (javaPackage , ignored );
221
223
@@ -613,23 +615,23 @@ private static interface CacheKey {
613
615
614
616
String getBasePackage ();
615
617
616
- DescribedPredicate <JavaClass > getIgnored ();
618
+ DescribedPredicate <? super JavaClass > getIgnored ();
617
619
618
620
ModulithMetadata getMetadata ();
619
621
}
620
622
621
623
private static final class TypeKey implements CacheKey {
622
624
623
625
private final Class <?> type ;
624
- private final DescribedPredicate <JavaClass > ignored ;
626
+ private final DescribedPredicate <? super JavaClass > ignored ;
625
627
626
628
/**
627
629
* Creates a new {@link TypeKey} for the given type and {@link DescribedPredicate} of ignored {@link JavaClass}es.
628
630
*
629
631
* @param type must not be {@literal null}.
630
632
* @param ignored must not be {@literal null}.
631
633
*/
632
- TypeKey (Class <?> type , DescribedPredicate <JavaClass > ignored ) {
634
+ TypeKey (Class <?> type , DescribedPredicate <? super JavaClass > ignored ) {
633
635
634
636
this .type = type ;
635
637
this .ignored = ignored ;
@@ -658,7 +660,7 @@ public ModulithMetadata getMetadata() {
658
660
* @see org.springframework.modulith.model.ApplicationModules.CacheKey#getIgnored()
659
661
*/
660
662
@ Override
661
- public DescribedPredicate <JavaClass > getIgnored () {
663
+ public DescribedPredicate <? super JavaClass > getIgnored () {
662
664
return ignored ;
663
665
}
664
666
@@ -694,7 +696,7 @@ public int hashCode() {
694
696
private static final class PackageKey implements CacheKey {
695
697
696
698
private final String basePackage ;
697
- private final DescribedPredicate <JavaClass > ignored ;
699
+ private final DescribedPredicate <? super JavaClass > ignored ;
698
700
699
701
/**
700
702
* Creates a new {@link PackageKey} for the given base package and {@link DescribedPredicate} of ignored
@@ -703,7 +705,7 @@ private static final class PackageKey implements CacheKey {
703
705
* @param basePackage must not be {@literal null}.
704
706
* @param ignored must not be {@literal null}.
705
707
*/
706
- PackageKey (String basePackage , DescribedPredicate <JavaClass > ignored ) {
708
+ PackageKey (String basePackage , DescribedPredicate <? super JavaClass > ignored ) {
707
709
708
710
this .basePackage = basePackage ;
709
711
this .ignored = ignored ;
@@ -722,7 +724,7 @@ public String getBasePackage() {
722
724
* (non-Javadoc)
723
725
* @see org.springframework.modulith.model.ApplicationModules.CacheKey#getIgnored()
724
726
*/
725
- public DescribedPredicate <JavaClass > getIgnored () {
727
+ public DescribedPredicate <? super JavaClass > getIgnored () {
726
728
return ignored ;
727
729
}
728
730
0 commit comments