Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,7 @@ public void execute() throws MojoExecutionException, CompilationFailureException
String value = entry.getValue();
if (value == null) {
entry = entryIter.next();
value = entry.getKey();
value = entry.getKey().replaceAll(new File("").getAbsolutePath(), ".");
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new path replacement logic for making builds reproducible lacks test coverage. Consider adding a test case that verifies absolute paths in JPMS arguments are correctly converted to relative paths in the generated jpms.args file.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating a new File object on every iteration is inefficient. Consider computing the absolute path once outside the loop and storing it in a variable for reuse.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The path replacement approach is fragile. This assumes that entry.getKey() always contains absolute paths starting with the current directory's absolute path, which may not be true in all cases. If entry.getKey() doesn't contain the absolute path prefix, this replacement will have no effect. Consider validating that the replacement actually occurred or using a more robust approach like converting absolute paths to relative paths using Path.relativize().

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Windows systems, File.getAbsolutePath() returns paths with backslashes which are regex special characters. When used with replaceAll (which treats the first parameter as a regex), this will cause a PatternSyntaxException. Additionally, dots in the path (which are common, e.g., in version numbers in parent directories) are also regex metacharacters that will cause incorrect matching.

Suggested change
value = entry.getKey().replaceAll(new File("").getAbsolutePath(), ".");
value = entry.getKey().replace(new File("").getAbsolutePath(), ".");

Copilot uses AI. Check for mistakes.
}
jpmsLines.add(value);
} else if ("--patch-module".equals(entry.getKey())) {
Expand Down
Loading