On 1/15/25 11:22, Andrew Dinn wrote:
On 14/01/2025 17:12, Code Ranger wrote:
Regarding the agent — who is ready to add such an agent to their application to
manage module directives and present it to the community?
Well, there is already one example of an agent that manages access to module
private code which is widely in use by the community. On JDK9+ Byteman allows
injected code to access methods that are not exported by modules, using the
module open APIs provided to class Instrumentation. It does so using its own
module layer and associated controller. It is also implemented to behave
compatibly on JDK8 where it achieves the same outcome using reflection. Most
notably, on JDK9+ Byteman avoids exposing those unexported methods to anything
other than the injected code.
Andrew, thank you for you this example. From
https://github.com/bytemanproject/byteman (if this is the project you are
talking about):
Byteman supports injection of side effects into Java programs for the purpose
of *tracing *and *testing* application behaviour.
No, I am sure, using agents to add open/export to a module from the boot layer
can hardly be called an optimal and elegant solution.
Therefore, I decided to abandon their use. The topic is closed. --add-* forever.