-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not all interfaces being reported #100
Comments
I could imagine this to be a problem with the import, are you sure, you're catching all these interfaces, when you do
and then you import via
In this case ArchUnit doesn't know anything about If all those classes are really contained in the import (you can check that, by calling |
Thank you! the issue was what you guessed, i wasnt importing the classes. I had, wrongly, assumed that if the classes where on my classpath they would be found even when i had used the @AnalyzeClasses annotation to only bring in the classes i wished to check. The interfaces that where not being found where outside that specific package and once added worked correctly. Closing. |
Glad you could solve your problem and it was no bug 😃 In short, if you put an
then ArchUnit will resolve all missing classes from the classpath (maybe causing less surprises in such cases). It's deactivated by default since it makes the import slightly slower (in the end it has to import more classes, e.g. JDK base classes). |
Hi,
I am working on a rule for a project which uses a large amount of interfaces that extend interfaces. The rule i am working on is ensuring that certain interfaces exist in the tree for each interface in a certain package. For the majority of the cases this seems to work perfectly and even with many levels of extends it picks them all up but for some reason on some interfaces it goes one level deep then stops. When i check the JavaClass object for the interface on that first level it shows no interfaces even though there are interfaces defined.
For example:
Interface intA extends intB
Interface intB extends intC, intD, intE
Interface intC extends intF
interface intF extends intG
In the rule im looking at interfaces that are assignable to intG and it tells me intA fails that check. When using a breakpoint i see that intA has one interface in the set of interfaces (intB) and if i look at the JavaClass for intB it shows 0 items in the interfaces set, when i would expect to see 5 (intC, intD, intE, intF, intG).
I tried to duplicate it in a stand alone small project using a similar structure but have so far been unable to duplicate it, so im unsure what the variable is that causes it to behave differently here. If you could point me to the right location in the arch unit code, where interfaces are converted into JavaClass objects or similar, to set a breakpoint i can spend some more time trying to figure out why it is not being picked up.
I'm running in Java 7 (oracle, 1.7.0_80), MacOS
archunit version 0.8.3 and i am using the junit library as well
Thanks
Jeff
The text was updated successfully, but these errors were encountered: