-
CSR
-
Resolution: Approved
-
P4
-
None
-
behavioral
-
minimal
-
We don't expect that anything will be impacted by this change.
-
Java API
-
SE
Summary
Clarify the specification of java.lang.module.ResolvedModule::reads
to specify that the set of resolved modules returned does not include "self".
Problem
Every module reads itself but it isn't clear if the set of modules returned by ResolvedModule::reads
includes itself or not. The original intent was that it didn't include itself, e.g. the method allows an empty set to be returned. The long standing behavior is that the set does not include itself when the configuration consists solely of explicit modules. However, if the configuration contains two or more automatic modules then the set includes self, a side effect of the augmenting the readability graph due to the implied readability.
Solution
Clarify the specification to make it clear that the returned set does not include self. The alternative to include self would be an incompatible change as the readability graph would no longer be a DAG due to self-loops.
Change the implementation to align with the specification. This is a behavior change for configurations that contain two or more automatic modules.
Specification
/**
* Returns the set of resolved modules that this resolved module reads.
+ * The readability relation is reflexive (every module reads itself). The
+ * set of resolved modules returned by this method does not include itself.
*
* @return A possibly-empty unmodifiable set of resolved modules that
* this resolved module reads
- csr of
-
JDK-8320716 ResolvedModule::reads includes self when configuration contains two or more automatic modules
- Resolved