Skip to content

Commit ab6aa89

Browse files
j2objc-copybaracopybara-github
authored andcommitted
This CL adds missing Instant-based methods to FileTime in J2ObjC JRE emulation to satisfy symbol resolution during transpilation of apache_commons_io.
Context: yaqs/4512214300974120960 This can unblock users from adding a j2objc version of apache_commons_io through external annotations (see https://fusion2.corp.google.com/invocations/acf259d0-e208-4c8a-89da-442f24d83f05). PiperOrigin-RevId: 896703197
1 parent 83dcb8c commit ab6aa89

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

jre_emul/Classes/java/nio/file/attribute/FileTime.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package java.nio.file.attribute;
1919

20+
import java.time.Instant;
2021
import java.util.concurrent.TimeUnit;
2122

2223
/**
@@ -52,6 +53,14 @@ public static FileTime fromMillis(long value) {
5253
return new FileTime(value);
5354
}
5455

56+
public Instant toInstant() {
57+
return Instant.ofEpochMilli(millis);
58+
}
59+
60+
public static FileTime from(Instant instant) {
61+
return new FileTime(instant.toEpochMilli());
62+
}
63+
5564
@Override
5665
public int compareTo(FileTime o) {
5766
if (o.millis < millis) {

0 commit comments

Comments
 (0)