Closed SuryaEnjarapu closed 2 days ago
Can you provide a minimal sample? Not that the JVM usually inlines references to static final fields of primitives and String
s (see this ticket in ArchUnit), so that — technically, when inspecting the byte code — the referring class does not have a dependency on the target one.
"Hi, I'm still encountering this issue in a company project (which I cannot share). However, I tested the same scenario using an example from SivaLabs with Spring Modulith, and it worked as expected. The main differences are that I'm using Java 17 with Spring Modulith 1.2.2, while the SivaLabs example uses Java 21 with Spring Modulith 1.3. I don't believe these differences are causing the issue; it might be related to environment or dependency issues. @sivaprasadreddy Please refer to the screenshot of my scenario, where it’s working as expected."
In this below example, I a directly trying use the InventoryConstants in common module
As described above, this is a side effect of the JVM inlining the constants. In other words, the compiled code does not contain that reference. Things might look different if you rather expose the constant as a method, though.
Ok Thank you for the response, will try to figure out and update here if i found solution or root cause. Thank you!!
Able to use constants from another module thats present submodule/package. while executing verify() its does throwing any violations, is it right behavior?