Skip to content

Commit b9f0758

Browse files
Copilotlaeubi
andcommitted
Address code review feedback on Resources API documentation
Co-authored-by: laeubi <[email protected]>
1 parent 47df1a9 commit b9f0758

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

src/main/java/org/codehaus/plexus/build/resources/DefaultResources.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ public OutputStream newOutputStream(Path file) throws IOException {
7575
public OutputStream newOutputStream(Path file, boolean derived) throws IOException {
7676
OutputStream outputStream = newOutputStream(file);
7777
if (derived) {
78-
// Mark the file as derived after creating the output stream
79-
// The marking happens here so that implementations can wrap the stream
80-
// if needed to defer the marking until after successful write
78+
// Mark the file as derived after creating the output stream.
79+
// In the default implementation, markDerived is a no-op, so the timing doesn't matter.
80+
// Custom implementations that track derived files should consider wrapping the stream
81+
// to defer marking until successful close() to avoid marking files on failed writes.
8182
markDerived(file);
8283
}
8384
return outputStream;
@@ -96,10 +97,10 @@ public Path getPath(String relpath) {
9697
if (relpath == null) {
9798
throw new IllegalArgumentException("relpath cannot be null");
9899
}
99-
// Get the basedir from the build context by checking a known file
100-
// The BuildContext API doesn't expose basedir directly, so we need to work around this
101-
// For the default implementation, we'll resolve against the current working directory
102-
// Custom implementations should override this to use the actual basedir
100+
// Note: The BuildContext API doesn't expose basedir directly.
101+
// This default implementation resolves paths relative to the current working directory.
102+
// Custom implementations (e.g., IDE integrations) should override this method
103+
// to resolve against the actual build context basedir.
103104
return java.nio.file.Paths.get(relpath);
104105
}
105106

src/main/java/org/codehaus/plexus/build/resources/Resources.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ public interface Resources {
7575
* explicitly refreshed using {@link #refresh(Path)}.
7676
* </p>
7777
* <p>
78-
* As an optimization, OutputStreams created by incremental build contexts will
79-
* attempt to avoid writing to the file if the file content has not changed.
80-
* This ensures that file timestamps are only updated when actual changes occur,
81-
* which is important for incremental build performance.
78+
* As an optimization, some implementations may attempt to avoid writing to the file
79+
* if the file content has not changed. This ensures that file timestamps are only
80+
* updated when actual changes occur, which is important for incremental build performance.
81+
* This optimization is implementation-dependent and may not apply to all implementations.
8282
* </p>
8383
*
8484
* @param file the file to write to
@@ -95,8 +95,9 @@ public interface Resources {
9595
* explicitly refreshed using {@link #refresh(Path)}.
9696
* </p>
9797
* <p>
98-
* As an optimization, OutputStreams created by incremental build contexts will
99-
* attempt to avoid writing to the file if the file content has not changed.
98+
* As an optimization, some implementations may attempt to avoid writing to the file
99+
* if the file content has not changed. This optimization is implementation-dependent
100+
* and may not apply to all implementations.
100101
* </p>
101102
* <p>
102103
* When <code>derived</code> is <code>true</code>, the file is marked as generated/derived,

0 commit comments

Comments
 (0)