J.VIII · Java 25 practice question

How does an `open module` differ from a normal module with respect to the Core Reflection API?

Choose one answer
Check answer and explanation

Correct answer: An open module grants reflective access to types in all of its packages, as if every package were opened

Explanation

An open module grants reflective access to types across all of its packages as though every package had been explicitly opened, whereas a normal module restricts reflective access to explicitly exported or opened packages.

Common trap

Marking a module open affects reflective access, not compile-time accessibility; packages still need exports directives to be accessible at compile time. Restricting reflection to explicitly exported or opened packages is the behavior of a normal module, not an open module.

Source: JLS SE 25 §7.7. Module Declarations
Checked against the cited text on 2026-11-25.

Report an error in this question