RFR: 8341342: Elements.getAllModuleElements() does not work properly before JavacTask.analyze() [v3]

Chen Liang liach at openjdk.org
Tue Aug 12 14:49:12 UTC 2025


On Tue, 12 Aug 2025 12:54:57 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

>> When calling `Elements.getTypeElement(...)` or `Elements.getPackageElement(...)`, javac itself ensures that the enter phase is already done. That is, sadly, not done for `Elements.getAllModuleElements()`. This PR fixes that.
>> 
>> See:
>> https://github.com/openjdk/jdk/pull/18934/files#r1767657515
>> for a practical case.
>
> Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Removing unnecessary explicit module initialization.

Thanks. This test is indeed a bit hard to organize due to being stateful. We can reorganize it if we need later.

-------------

Marked as reviewed by liach (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/26694#pullrequestreview-3111121499


More information about the compiler-dev mailing list