Skip to content

Commit 56dc928

Browse files
cpovirkGoogle Java Core Libraries
authored and
Google Java Core Libraries
committedMay 19, 2023
Mark Files.createTempDir and FileBackedOutputStream as @J2ObjCIncompatible.
While we believe they're secure under iOS (thanks to OS-level protections on the temporary directory), we are looking into reimplementing them atop `java.nio.file` to improve security under other platforms. And if we do so, then we need to add `java.nio.file` to the JRE deps of every J2ObjC user, possibly increasing app size (at least until improvements to J2ObjC land). After discussion with the J2ObjC team, we've settled on hiding the APIs from J2ObjC for now. Inside Google, the APIs already had no J2ObjC users. If you use them outside Google, let us know, and we can make them available there. RELNOTES=`io`: Marked `Files.createTempDir` and `FileBackedOutputStream` as `@J2ObjCIncompatible`. Contact us if you need to use them under J2ObjC. PiperOrigin-RevId: 533564397
1 parent 3a8d7e4 commit 56dc928

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed
 

‎android/guava/src/com/google/common/io/FileBackedOutputStream.java

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.google.common.annotations.J2ktIncompatible;
2222
import com.google.common.annotations.VisibleForTesting;
2323
import com.google.errorprone.annotations.concurrent.GuardedBy;
24+
import com.google.j2objc.annotations.J2ObjCIncompatible;
2425
import java.io.ByteArrayInputStream;
2526
import java.io.ByteArrayOutputStream;
2627
import java.io.File;
@@ -54,6 +55,7 @@
5455
@Beta
5556
@J2ktIncompatible
5657
@GwtIncompatible
58+
@J2ObjCIncompatible
5759
@ElementTypesAreNonnullByDefault
5860
public final class FileBackedOutputStream extends OutputStream {
5961
private final int fileThreshold;

‎android/guava/src/com/google/common/io/Files.java

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import com.google.common.hash.HashFunction;
3535
import com.google.errorprone.annotations.CanIgnoreReturnValue;
3636
import com.google.errorprone.annotations.InlineMe;
37+
import com.google.j2objc.annotations.J2ObjCIncompatible;
3738
import java.io.BufferedReader;
3839
import java.io.BufferedWriter;
3940
import java.io.File;
@@ -426,6 +427,7 @@ public static boolean equal(File file1, File file2) throws IOException {
426427
*/
427428
@Beta
428429
@Deprecated
430+
@J2ObjCIncompatible
429431
public static File createTempDir() {
430432
File baseDir = new File(System.getProperty("java.io.tmpdir"));
431433
@SuppressWarnings("GoodTime") // reading system time without TimeSource

‎guava/src/com/google/common/io/FileBackedOutputStream.java

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.google.common.annotations.J2ktIncompatible;
2222
import com.google.common.annotations.VisibleForTesting;
2323
import com.google.errorprone.annotations.concurrent.GuardedBy;
24+
import com.google.j2objc.annotations.J2ObjCIncompatible;
2425
import java.io.ByteArrayInputStream;
2526
import java.io.ByteArrayOutputStream;
2627
import java.io.File;
@@ -54,6 +55,7 @@
5455
@Beta
5556
@J2ktIncompatible
5657
@GwtIncompatible
58+
@J2ObjCIncompatible
5759
@ElementTypesAreNonnullByDefault
5860
public final class FileBackedOutputStream extends OutputStream {
5961
private final int fileThreshold;

‎guava/src/com/google/common/io/Files.java

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import com.google.common.hash.HashFunction;
3535
import com.google.errorprone.annotations.CanIgnoreReturnValue;
3636
import com.google.errorprone.annotations.InlineMe;
37+
import com.google.j2objc.annotations.J2ObjCIncompatible;
3738
import java.io.BufferedReader;
3839
import java.io.BufferedWriter;
3940
import java.io.File;
@@ -426,6 +427,7 @@ public static boolean equal(File file1, File file2) throws IOException {
426427
*/
427428
@Beta
428429
@Deprecated
430+
@J2ObjCIncompatible
429431
public static File createTempDir() {
430432
File baseDir = new File(System.getProperty("java.io.tmpdir"));
431433
@SuppressWarnings("GoodTime") // reading system time without TimeSource

0 commit comments

Comments
 (0)
Please sign in to comment.