what is undesired usage of the Java API?

Andrew Dinn adinn at redhat.com
Tue Apr 4 17:23:00 UTC 2017

On 04/04/17 16:51, Jochen Theodorou wrote:
> I think the recent discussion about the agent loading mechanism do show
> one fundamental problem that many have with the changes through the
> restricted module system. That is, it is unclear what undesired usage of
> the Java APIs actually is.
> So let me write down an unfinished list as discussion base (jigsaw):
> (1) usage of internal modules, classes, methods or fields
> (2) transforming any of (1)
> (3) non-public elements are not to be accessed if normal Java does not
> allow for it

I am afraid it's not so simple.

When using Byteman to diagnose a problem in an app, usages (2) and (3)
are very often needed to be sure what is going wrong. This can happen at
the point where the app calls into a library or even the JDK and does
something like pass bad data in. It is sometimes only possible to prove
that this has happened if you can trace internal execution or inject
assertions that the library/JDK code does not itself include (invariably
for performance reasons). It can also happen because there is actually
something wrong in the library/JDK code. Yes, we live in an imperfect world.

Indeed, the same thing can also happen during integration or unit
testing and Byteman is useful at these stages for much the same reason.

Obviously when you have ironed out many problems in code there is no
need for any guarantee that certain invariants apply to internal states.
However, that Nirvana is rarely if ever reached (never mind the problem
of maintaining such bliss).


Andrew Dinn
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander

More information about the jigsaw-dev mailing list