Skip to content

Commit 3dfe363

Browse files
cpovirkGoogle Java Core Libraries
authored and
Google Java Core Libraries
committed
Warn that Files.createTempDir and FileBackedOutputStream don't work under Windows anymore (if ever they did).
Relates to: - #4011 - #2575 - #2686 Also, fix some Javadoc. RELNOTES=n/a PiperOrigin-RevId: 536752422
1 parent b047302 commit 3dfe363

File tree

6 files changed

+36
-10
lines changed

6 files changed

+36
-10
lines changed

Diff for: android/guava/src/com/google/common/io/FileBackedOutputStream.java

+7
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@
5858
*
5959
* <p>This class is thread-safe.
6060
*
61+
* <p><b>Warning for Windows users:</b> This class is one of the Guava APIs known to <i>not</i> work
62+
* under Windows. Note that <a href="https://github.com/google/guava/issues/2686">we do not run our
63+
* CI under Windows</a>, <a href="https://github.com/google/guava/issues/2130">we know that some of
64+
* our tests fail under Windows</a>, and <a href="https://guava.dev/#important-warnings">we warn
65+
* about using some features of Guava under Windows</a>, especially I/O features, and that warning
66+
* applies even to APIs whose documentation doesn't include individual warnings like this one.
67+
*
6168
* @author Chris Nokleberg
6269
* @since 1.0
6370
*/

Diff for: android/guava/src/com/google/common/io/Files.java

+10-3
Original file line numberDiff line numberDiff line change
@@ -412,13 +412,20 @@ public static boolean equal(File file1, File file2) throws IOException {
412412
* <p>This method assumes that the temporary volume is writable, has free inodes and free blocks,
413413
* and that it will not be called thousands of times per second.
414414
*
415+
* <p><b>Warning for Windows users:</b> This method is one of the Guava APIs known to <i>not</i>
416+
* work under Windows. Note that <a href="https://github.com/google/guava/issues/2686">we do not
417+
* run our CI under Windows</a>, <a href="https://github.com/google/guava/issues/2130">we know
418+
* that some of our tests fail under Windows</a>, and <a
419+
* href="https://guava.dev/#important-warnings">we warn about using some features of Guava under
420+
* Windows</a>, especially I/O features, and that warning applies even to APIs whose documentation
421+
* doesn't include individual warnings like this one.
422+
*
415423
* <p><b>{@link java.nio.file.Path} equivalent:</b> {@link
416424
* java.nio.file.Files#createTempDirectory}.
417425
*
418426
* @return the newly-created directory
419-
* @throws IllegalStateException if the directory could not be created
420-
* @throws UnsupportedOperationException if the system does not support creating temporary
421-
* directories securely
427+
* @throws IllegalStateException if the directory could not be created, such as if the system does
428+
* not support creating temporary directories securely
422429
* @deprecated For Android users, see the <a
423430
* href="https://developer.android.com/training/data-storage" target="_blank">Data and File
424431
* Storage overview</a> to select an appropriate temporary directory (perhaps {@code

Diff for: android/guava/src/com/google/common/io/TempFileCreator.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ abstract class TempFileCreator {
4242

4343
/**
4444
* @throws IllegalStateException if the directory could not be created (to implement the contract
45-
* of {@link Files#createTempDir()}
46-
* @throws UnsupportedOperationException if the system does not support creating temporary
45+
* of {@link Files#createTempDir()}, such as if the system does not support creating temporary
4746
* directories securely
4847
*/
4948
abstract File createTempDir();

Diff for: guava/src/com/google/common/io/FileBackedOutputStream.java

+7
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@
5858
*
5959
* <p>This class is thread-safe.
6060
*
61+
* <p><b>Warning for Windows users:</b> This class is one of the Guava APIs known to <i>not</i> work
62+
* under Windows. Note that <a href="https://github.com/google/guava/issues/2686">we do not run our
63+
* CI under Windows</a>, <a href="https://github.com/google/guava/issues/2130">we know that some of
64+
* our tests fail under Windows</a>, and <a href="https://guava.dev/#important-warnings">we warn
65+
* about using some features of Guava under Windows</a>, especially I/O features, and that warning
66+
* applies even to APIs whose documentation doesn't include individual warnings like this one.
67+
*
6168
* @author Chris Nokleberg
6269
* @since 1.0
6370
*/

Diff for: guava/src/com/google/common/io/Files.java

+10-3
Original file line numberDiff line numberDiff line change
@@ -412,13 +412,20 @@ public static boolean equal(File file1, File file2) throws IOException {
412412
* <p>This method assumes that the temporary volume is writable, has free inodes and free blocks,
413413
* and that it will not be called thousands of times per second.
414414
*
415+
* <p><b>Warning for Windows users:</b> This method is one of the Guava APIs known to <i>not</i>
416+
* work under Windows. Note that <a href="https://github.com/google/guava/issues/2686">we do not
417+
* run our CI under Windows</a>, <a href="https://github.com/google/guava/issues/2130">we know
418+
* that some of our tests fail under Windows</a>, and <a
419+
* href="https://guava.dev/#important-warnings">we warn about using some features of Guava under
420+
* Windows</a>, especially I/O features, and that warning applies even to APIs whose documentation
421+
* doesn't include individual warnings like this one.
422+
*
415423
* <p><b>{@link java.nio.file.Path} equivalent:</b> {@link
416424
* java.nio.file.Files#createTempDirectory}.
417425
*
418426
* @return the newly-created directory
419-
* @throws IllegalStateException if the directory could not be created
420-
* @throws UnsupportedOperationException if the system does not support creating temporary
421-
* directories securely
427+
* @throws IllegalStateException if the directory could not be created, such as if the system does
428+
* not support creating temporary directories securely
422429
* @deprecated For Android users, see the <a
423430
* href="https://developer.android.com/training/data-storage" target="_blank">Data and File
424431
* Storage overview</a> to select an appropriate temporary directory (perhaps {@code

Diff for: guava/src/com/google/common/io/TempFileCreator.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ abstract class TempFileCreator {
4242

4343
/**
4444
* @throws IllegalStateException if the directory could not be created (to implement the contract
45-
* of {@link Files#createTempDir()}
46-
* @throws UnsupportedOperationException if the system does not support creating temporary
45+
* of {@link Files#createTempDir()}, such as if the system does not support creating temporary
4746
* directories securely
4847
*/
4948
abstract File createTempDir();

0 commit comments

Comments
 (0)