New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
6245663: (spec) File.renameTo(File) changes the file-system object, not the File instance #2618
Conversation
…ot the File instance
|
/csr |
@bplb has indicated that a compatibility and specification (CSR) request is needed for this pull request. |
Webrevs
|
* that the rename operation was successful. As instances of {@code File} | ||
* are immutable, the abstract pathname represented by this {@code File} | ||
* object does not itself change although the filesystem object it denoted | ||
* might have moved. | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to mix in a mention of the {@ code "dest"} argument.
"might have moved to the abstract pathname provided in the dest argument".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea.
* that the rename operation was successful. | ||
* that the rename operation was successful. As instances of {@code File} | ||
* are immutable, the abstract pathname represented by this {@code File} | ||
* object does not itself change although the filesystem object it denoted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you meant file
object here, instead of filesystem
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I intended filesystem
but in the sense of "object in the filesystem" but it does seem awkward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be clearer if the end of the sentence were changed to something like "... this File object is not changed to name destination file or directory".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like so?
--- a/src/java.base/share/classes/java/io/File.java
+++ b/src/java.base/share/classes/java/io/File.java
@@ -1376,7 +1376,9 @@ public class File
* file from one filesystem to another, it might not be atomic, and it
* might not succeed if a file with the destination abstract pathname
* already exists. The return value should always be checked to make sure
- * that the rename operation was successful.
+ * that the rename operation was successful. As instances of {@code File}
+ * are immutable, this File object is not changed to name the destination
+ * file or directory.
*
* <p> Note that the {@link java.nio.file.Files} class defines the {@link
* java.nio.file.Files#move move} method to move or rename a file in a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I think that works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CSR also so updated.
@bplb This change now passes all automated pre-integration checks. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 17 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.
|
/integrate |
@bplb Since your change was applied there have been 28 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 851b2e3. |
Please review this minor specification update to highlight that
File.renameTo(File)
does not modify theFile
instance on which the method is invoked.Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/2618/head:pull/2618
$ git checkout pull/2618