You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No, sorry, this is not intended ☹️ I think the second one should have a contravariant predicate type as well. Must have slipped through. Maybe I should write some sort of ArchRule for that 😉
There is some "convenience" method annotatedWith(Foo.class).<JavaClass>forSubtype() to mitigate such pain points (even though in this place it should just work out of the box).
I've adjusted the API, there were a couple of places where this slipped through.
Also added an ArchTest to make sure future methods will always be written correctly with respect to DescribedPredicate 😉
Thanks for reporting this issue and helping to make ArchUnit better 😃
For example, FieldsShould#haveRawType(DescribedPredicate) is contravariant (takes in a
DescribedPredicate<? super JavaClass>
), whereas CodeUnitsShould#haveRawReturnType(DescribedPredicate) is invariant (takes in aDescribedPredicate<JavaClass>
).This makes it possible to do:
(because CanBeAnnotated.Predicates#annotatedWith(Class) returns a
DescribedPredicate<CanBeAnnotated>
, andJavaClass
implementsCanBeAnnotated
)but not possible to do:
Is this intended?
The text was updated successfully, but these errors were encountered: