Here is an example directory structure, created for patching classes in java.base
, java.logging
:
src
+- java.base
+ module-info.java
+- java
+- lang
+- Object.java
+- java.logging
+ module-info.java
+- java
+- util
+- logging
+- FileHandler.java
Assume that both Object.java
and FileHandler.java
are modified. For example when compiling FileHandler.java it should only use the locally modified Object.java for the compilation.
Currently I created module descriptors in both 'java.base', and 'java.logging' directories (with empty bodies) though I'm not sure if this is the right way to proceed.
java.base/module-info.java
module java.base {
}
java.logging/module-info.java
module java.logging {
}
If I do:
javac --patch-module java.base=src/java.logging -module-source-path src
-d build
- Will it use the modified
Object.java
for patching the classes injava.logging
module directory? - It also seems to me that declaring module descriptors like this overrides the whole module and not just the classes, so how can I preserve the classes in the original module?
It would be great if I could patch several classes which belongs to different modules at once.