-
Notifications
You must be signed in to change notification settings - Fork 140
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
Named interface detection accidentally picks up nested declarations in nested interfaces scenario #650
Comments
Thanks for bringing this up. Any chance you can provide a reproducer? |
Took me a bit, was on vacation :) https://github.com/jwedel/spring-modulith-dependency-error-reproducer So, maybe this is not 100% the intended use (we are currently in the process of pulling public api to module root level) but this error message is still kind of weird. So if you run
If you change the dependencies from module 1 as follows it works: @org.springframework.modulith.ApplicationModule(
allowedDependencies = {
"domain2",
"domain2 :: *",
}
)
package com.reproducer.modulith.domain1; |
It looks like there's a bug in our named interface detection that currently invalidly assigns |
If named interfaces are declared in nested packages, the name detection might accidentally pick up the names declared in child packages. We now deliberately only inspect the base package.
On the one hand, as I mentioned before, we are currently on the way of factoring our application. To do this, It would actually help to see some more complex examples either in the documentation or maybe in repository. Ok the other hand, the separation of public APIs on root level generally sounds like a great idea, but in our case, we have a quite complex application and in this example, the DTO package has around 15 files as our base DTO is quite complex as well. And by the rule of seven, we start introducing sub packages if things grow too much. |
I get this error:
So A is a module. Also B is a module. A needs to access NamedInterface which has a package-info.java inside the package with a NamedInterface of 'NamedInterface'.
ApplicationModule 'A' has the following
allowedDependencies
:Still I get the violation error.
When I change the
allowedDependencies
as follows, it works without an error:I'm also using named interfaces in the exact same way in other places and it works perfectly when explicitly declaring it as dependency. I could not find any reason why it does not work, especially as the violoation error message lists exactly that as allowed.
It's really puzzling me.
I'm using 1.2.0 of modulith.
The text was updated successfully, but these errors were encountered: