Skip to Main Content

Circular dependencies for modules: "requires circular <module-name>".

Owen_Jan 14 2023

I think there should be a "circular" clause of the requires statement for a module. My rationale for making this assertion is because I would like to seal classes that sit on different modules, and I cannot do this as things currently stand.
If the keyword "circular" appears as specified, the compiler will check to see if the module already appears in the dependency graph and produce an error if this is not the case. The compiler can further use this relationship to ensure that a class from one module that extends a sealed class from another is one that appears in the sealed classes permits clause.
What say the Java community?

Post Details
Added on Jan 14 2023