Skip to content

Commit

Permalink
Fix EnvHelper#chDir on JDK 21 (#802)
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet authored Mar 10, 2023
1 parent 65da451 commit c2e4ee2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion daemon/src/main/java/org/mvndaemon/mvnd/cli/EnvHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ static void chDir(String workingDir) throws Exception {
// change current dir for the java.io.File class
Class<?> fileClass = Class.forName("java.io.File");
if (JavaVersion.getJavaSpec() >= 11.0) {
Field fsField = fileClass.getDeclaredField("fs");
Field fsField = fileClass.getDeclaredField(JavaVersion.getJavaSpec() >= 21.0 ? "FS" : "fs");
fsField.setAccessible(true);
Object fs = fsField.get(null);
Field userDirField = fs.getClass().getDeclaredField("userDir");
Expand Down

0 comments on commit c2e4ee2

Please sign in to comment.