When instrumenting code, typically one adds calls of foreign methods to the instrumented class. For example, a Java agent might want to inject additional logging by adding log calls to code of the instrumented class. Wth Jigsaw, these log classes must also be read by the instrumented code's module.
For adapting Jigsaw, I need the hypothetical log framework to be read from the instrumented class's module. However, calling addReads is impossible as the method is caller sensitive. Currently I found two operating work arounds but I think Java should offer a clean solutuion: 1. I avoid the check by calling implAddReads(Module, boolean) via reflection. This is guarded by a security manager but at least possible if the security manager is not set or if it allows that call. 2. I add a static initializer to the instrumented class from where I add the read edge to the added code. As I am now within a class of the module, this goes without a problem. Maybe the caller-sensitive methods should rather be checked by a security manager to allow such manipulations? Thank you for considering my problem. Best regards, Rafael