-
Notifications
You must be signed in to change notification settings - Fork 300
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
Cycles not detected #474
Comments
Ah, I think you need the pattern |
Hi Peter, Unfortunately the test passes even with this expression:
|
Do you know how exactly the cycle is formed? I.e. which class from |
You can check it out yourself. It's a public project: https://github.com/72services/jtaf4 These lines of code that produces the cycle: SecurityContext
ConfigureUIServiceInitListener
|
Ah, I see. Yes, the problem is, that for a simple |
So far ArchUnit has not been able to detect the pure usage of class objects as dependencies. E.g. the following example would not have detected a dependency on `Evil`, since besides the reference to the class object no further dependency on `Evil` (like a field access or method call) has occurred. ``` class Example { final Map<Class<?>, Object> association = Map.of(Evil.class, anything); } ``` With this PR `JavaClass` now knows its `referencedClassObjects`, including the respective line number. Furthermore class objects are now parts of the `dependencies{From/To}Self` of a `JavaClass`. Resolves: #309 Issue: #446 Resolves: #474 Resolves: #515
Hi @codecholeric Yes the fix works. Thanks a lot! |
So far ArchUnit has not been able to detect the pure usage of class objects as dependencies. E.g. the following example would not have detected a dependency on `Evil`, since besides the reference to the class object no further dependency on `Evil` (like a field access or method call) has occurred. ``` class Example { final Map<Class<?>, Object> association = Map.of(Evil.class, anything); } ``` With this PR `JavaClass` now knows its `referencedClassObjects`, including the respective line number. Furthermore class objects are now parts of the `dependencies{From/To}Self` of a `JavaClass`. Resolves: #309 Issue: #446 Resolves: #474 Resolves: #515
slices().matching("ch.jtaf.(*)").should().beFreeOfCycles().check(classes);
does not detect cycle between ch.jtaf.ui and ch.jtaf.security packages.
I assume that the problem is that the cycle comes from a subpackage of ch.jtaf.ui (see attchached image).
The text was updated successfully, but these errors were encountered: