Aaron's Blog

https://aaronchenwei.github.io/

View on GitHub
15 March 2023

What's the difference between --add-exports and --add-opens in Java 9?

by aaronchenwei

Difference

So the main difference at run time is that --add-opens allows “deep reflection”, meaning access of non-public members. You can typically identify this kind of access by the reflecting code making calls to setAccessible(true).

It is worth adding that at runtime -add-opens implicates -add-exports.

For more, please review details through JEP 261.