Skip to content

Commit

Permalink
Improve comment on why properties need to also be set in doStartup
Browse files Browse the repository at this point in the history
  • Loading branch information
zakkak committed Oct 22, 2024
1 parent 7f7d3d0 commit 7f39ccc
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,9 @@ void build(List<StaticBytecodeRecorderBuildItem> staticInitTasks,
createAppCDS.returnValue(null);
}

// very first thing is to set system props (for run time, which use substitutions for a different
// storage from build-time)
// Make sure we set properties in doStartup as well. This is necessary because setting them in the static-init
// sets them at build-time, on the host JVM, while SVM has substitutions for System. get/ setProperty at
// run-time which will never see those properties unless we also set them at run-time.
for (SystemPropertyBuildItem i : properties) {
mv.invokeStaticMethod(ofMethod(System.class, "setProperty", String.class, String.class, String.class),
mv.load(i.getKey()), mv.load(i.getValue()));
Expand Down

0 comments on commit 7f39ccc

Please sign in to comment.