Hi I know it's a bit late in the game, but was looking over the provided API, both native and in Java, for redefining modules, and it seems to lack a way to introduce new packages to an existing module?
In Java 8, creating a class in a new package and loading that class is no problem, you simply compile to a place that's already on the classpath, and, if needed, redefine an existing class to access the new class. With named modules in Java 9, this is no longer the case! As the newly created package is not in the modules' list of known packages, it's simply ignored, and you cannot load the classes from it, and I don't see a way neither through redefineModule, the Module API nor the JNI API, to add this package to the module. This seems like an oversight? I could successfully load a new class in a new package in the unnamed module, so the JVM obviously has the capability to extend the list of known packages for a give Module! It might not be the most common scenario, but creating new packages during development is definitely not uncommon, and from my experience with JRebel and our customers, I can also say that we do see these kind of changes. So, if the JVM can automatically do it for unnamed modules, why is this not a supported redefinition for (named) modules? Regards, Michael Rasmussen JRebel, ZeroTurnaround