Skip to content

Commit c9c9608

Browse files
author
Maxim Butov
committed
Agent.
1 parent 211befd commit c9c9608

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,9 @@ Default configuration of reflection cloner does not clone lambdas and method ref
217217
218218
Java 9+ restricts accessing objects members via Reflection API. To solve this one may
219219
- use `--illegal-access=permit` JVM argument (works on Java below 17);
220-
- use `--add-opens` JVM arguments, e.g. `--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED`.
220+
- if you add the cloner into classpath, use `--add-opens` JVM arguments, e.g. `--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED`;
221+
- if you have an application with the modules which are properly configured, then use cloner's module name, i.e. `--add-opens java.base/java.lang=io.github.sugarcubes.cloner --add-opens java.base/java.lang.invoke=io.github.sugarcubes.cloner --add-opens java.base/java.util=io.github.sugarcubes.cloner --add-opens java.base/java.util.concurrent=io.github.sugarcubes.cloner`;
222+
- the library also contains a Java agent which opens modules for the cloner, just run java with arg `-javaagent:/path/to/sugar-cubes-cloner-1.2.2.jar`.
221223

222224
### Versioning
223225

jdk9-agent/src/main/java/io/github/sugarcubes/cloner/ModuleOpeningAgent.java

+3
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ void check(Instrumentation instrumentation, Module module, boolean isClonerModul
6969
open(instrumentation, m, module);
7070
}
7171
}
72+
else {
73+
modules.add(module);
74+
}
7275
}
7376
else if (module != clonerModule && modules.add(module)) {
7477
open(instrumentation, module, clonerModule);

0 commit comments

Comments
 (0)