Merge "Migration of ZoneInfo to 64-bit times from 32-bit"
diff --git a/JavaLibrary.bp b/JavaLibrary.bp
index 53d0a10..317ef4b 100644
--- a/JavaLibrary.bp
+++ b/JavaLibrary.bp
@@ -255,14 +255,20 @@
// Device files put in /system.
"tzdata",
"tz_version",
- // Files used to simulate the /system and runtime APEX dir
- // structure on host.
- "tzdata_host",
- "tzdata_host_runtime_apex",
- "tzlookup.xml_host_runtime_apex",
- "tz_version_host",
- "tz_version_host_runtime_apex",
],
+ target: {
+ hostdex: {
+ required: [
+ // Files used to simulate the /system and runtime APEX dir
+ // structure on host.
+ "tzdata_host",
+ "tzdata_host_runtime_apex",
+ "tzlookup.xml_host_runtime_apex",
+ "tz_version_host",
+ "tz_version_host_runtime_apex",
+ ],
+ },
+ },
}
// Provided solely to contribute information about which hidden parts of the
diff --git a/luni/src/main/java/libcore/timezone/TzDataSetVersion.java b/luni/src/main/java/libcore/timezone/TzDataSetVersion.java
index 2ba64a0..c2e7d7b 100644
--- a/luni/src/main/java/libcore/timezone/TzDataSetVersion.java
+++ b/luni/src/main/java/libcore/timezone/TzDataSetVersion.java
@@ -45,7 +45,7 @@
* version to 1 when doing so.
*/
// @VisibleForTesting : Keep this inline-able: it is used from CTS tests.
- public static final int CURRENT_FORMAT_MAJOR_VERSION = 3; // Android Q
+ public static final int CURRENT_FORMAT_MAJOR_VERSION = 4; // Android R
/**
* Returns the major tz data format version supported by this device.
diff --git a/luni/src/test/java/libcore/java/lang/invoke/MethodHandleCombinersTest.java b/luni/src/test/java/libcore/java/lang/invoke/MethodHandleCombinersTest.java
index 5866ae4..a8cfa24 100644
--- a/luni/src/test/java/libcore/java/lang/invoke/MethodHandleCombinersTest.java
+++ b/luni/src/test/java/libcore/java/lang/invoke/MethodHandleCombinersTest.java
@@ -1214,7 +1214,7 @@
Object ret = handle.invokeWithArguments(new Object[]{"a", "b", "c"});
assertEquals(42, (int) ret);
- ret = handle.invokeWithArguments(new String[]{"a", "b", "c"});
+ ret = handle.invokeWithArguments((Object[]) new String[]{"a", "b", "c"});
assertEquals(42, (int) ret);
// Also test the versions that take a List<?> instead of an array.
diff --git a/luni/src/test/java/libcore/java/lang/invoke/MethodTypeTest.java b/luni/src/test/java/libcore/java/lang/invoke/MethodTypeTest.java
index f833840..0c4d18b 100644
--- a/luni/src/test/java/libcore/java/lang/invoke/MethodTypeTest.java
+++ b/luni/src/test/java/libcore/java/lang/invoke/MethodTypeTest.java
@@ -96,7 +96,7 @@
}
try {
- MethodType.methodType(int.class, String.class, null);
+ MethodType.methodType(int.class, String.class, (Class<?>) null);
fail();
} catch (NullPointerException expected) {
}
@@ -334,7 +334,7 @@
}
try {
- mt.insertParameterTypes(1, Arrays.asList(null));
+ mt.insertParameterTypes(1, Arrays.asList((Class<?>) null));
fail();
} catch (NullPointerException expected) {
}
@@ -404,7 +404,7 @@
}
try {
- mt.appendParameterTypes(Arrays.asList(null));
+ mt.appendParameterTypes(Arrays.asList((Class<?>) null));
fail();
} catch (NullPointerException expected) {
}
diff --git a/luni/src/test/java/libcore/java/nio/file/DefaultFileSystemProvider2Test.java b/luni/src/test/java/libcore/java/nio/file/DefaultFileSystemProvider2Test.java
index 2916b03..42d0f05 100644
--- a/luni/src/test/java/libcore/java/nio/file/DefaultFileSystemProvider2Test.java
+++ b/luni/src/test/java/libcore/java/nio/file/DefaultFileSystemProvider2Test.java
@@ -600,7 +600,8 @@
} catch (NullPointerException expected) {}
try {
- provider.newByteChannel(filesSetup.getTestPath(), new HashSet<>(), null);
+ provider.newByteChannel(filesSetup.getTestPath(), new HashSet<>(),
+ (FileAttribute<?>) null);
fail();
} catch (NullPointerException expected) {}
}
diff --git a/luni/src/test/java/libcore/java/nio/file/DefaultSecureDirectoryStreamTest.java b/luni/src/test/java/libcore/java/nio/file/DefaultSecureDirectoryStreamTest.java
index 2c9c2cd..273ff8f 100644
--- a/luni/src/test/java/libcore/java/nio/file/DefaultSecureDirectoryStreamTest.java
+++ b/luni/src/test/java/libcore/java/nio/file/DefaultSecureDirectoryStreamTest.java
@@ -185,7 +185,7 @@
// NPE
try (DirectoryStream<Path> ds_path_dir1 = ds_path_root.newDirectoryStream(path_root.
- relativize(path_f1), null)) {
+ relativize(path_f1), (LinkOption) null)) {
fail();
} catch (NullPointerException expected) {}
@@ -380,7 +380,7 @@
try {
ds_path_dir1.move(path_dir1, ds_path_dir1,
- Paths.get(path_root.getParent().toString(), null));
+ Paths.get(path_root.getParent().toString(), (String) null));
fail();
} catch (NullPointerException expected) {}
@@ -498,7 +498,7 @@
try (SecureDirectoryStream<Path> ds_path_root = (SecureDirectoryStream<Path>)
Files.newDirectoryStream(path_root)) {
ds_path_root.getFileAttributeView(path_root.relativize(path_f1),
- BasicFileAttributeView.class, null);
+ BasicFileAttributeView.class, (LinkOption) null);
fail();
} catch (NullPointerException expected) {}
}
diff --git a/luni/src/test/java/libcore/java/nio/file/Files2Test.java b/luni/src/test/java/libcore/java/nio/file/Files2Test.java
index 436d3e3..a3357e3 100644
--- a/luni/src/test/java/libcore/java/nio/file/Files2Test.java
+++ b/luni/src/test/java/libcore/java/nio/file/Files2Test.java
@@ -1683,7 +1683,7 @@
} catch (NullPointerException expected) {}
try {
- Files.createTempDirectory(filesSetup.getTestDirPath(), tmpDir, null);
+ Files.createTempDirectory(filesSetup.getTestDirPath(), tmpDir, (FileAttribute<?>) null);
fail();
} catch (NullPointerException expected) {}
}
@@ -1710,7 +1710,7 @@
assertEquals(attr.value(), Files.getAttribute(tmpDirPath, attr.name()));
try {
- Files.createTempDirectory(tmpDir, null);
+ Files.createTempDirectory(tmpDir, (FileAttribute<?>) null);
fail();
} catch (NullPointerException expected) {}
}
@@ -1757,7 +1757,7 @@
try {
Files.createTempFile(filesSetup.getTestDirPath(), tmpFilePrefix, tmpFileSuffix,
- null);
+ (FileAttribute<?>) null);
fail();
} catch (NullPointerException expected) {}
}
@@ -1796,7 +1796,7 @@
assertEquals(attr.value(), Files.getAttribute(tmpFilePath, attr.name()));
try {
- Files.createTempFile(tmpFilePrefix, tmpFileSuffix, null);
+ Files.createTempFile(tmpFilePrefix, tmpFileSuffix, (FileAttribute<?>) null);
fail();
} catch (NullPointerException expected) {}
}
diff --git a/luni/src/test/java/libcore/java/nio/file/LinuxPathTest.java b/luni/src/test/java/libcore/java/nio/file/LinuxPathTest.java
index e95f5bc..458804c 100644
--- a/luni/src/test/java/libcore/java/nio/file/LinuxPathTest.java
+++ b/luni/src/test/java/libcore/java/nio/file/LinuxPathTest.java
@@ -18,6 +18,7 @@
import com.sun.nio.file.ExtendedWatchEventModifier;
+import java.nio.file.WatchEvent.Kind;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
@@ -454,7 +455,7 @@
} catch (NullPointerException expected) {}
try {
- directory.register(watchService, null);
+ directory.register(watchService, (Kind<?>) null);
fail();
} catch (NullPointerException expected) {}
}
diff --git a/ojluni/src/main/java/java/lang/System.java b/ojluni/src/main/java/java/lang/System.java
index d698446..8235bf7 100644
--- a/ojluni/src/main/java/java/lang/System.java
+++ b/ojluni/src/main/java/java/lang/System.java
@@ -509,9 +509,13 @@
* The byte[] specialized version of arraycopy().
* Note: This method is required for runtime ART compiler optimizations.
* Do not remove or change the signature.
+ * Note: Unlike the others, this variant is public due to a dependency we
+ * are working on removing. b/74103559
+ *
+ * @hide
*/
@SuppressWarnings("unused")
- private static void arraycopy(byte[] src, int srcPos, byte[] dst, int dstPos, int length) {
+ public static void arraycopy(byte[] src, int srcPos, byte[] dst, int dstPos, int length) {
if (src == null) {
throw new NullPointerException("src == null");
}
diff --git a/ojluni/src/main/java/java/util/ArrayDeque.java b/ojluni/src/main/java/java/util/ArrayDeque.java
index ecaf0e8..b1fb41e 100644
--- a/ojluni/src/main/java/java/util/ArrayDeque.java
+++ b/ojluni/src/main/java/java/util/ArrayDeque.java
@@ -159,6 +159,12 @@
Object[] a = new Object[newCapacity];
System.arraycopy(elements, p, a, 0, r);
System.arraycopy(elements, 0, a, r, p);
+ // Android-added: Clear old array instance that's about to become eligible for GC.
+ // This ensures that array elements can be eligible for garbage collection even
+ // before the array itself is recognized as being eligible; the latter might
+ // take a while in some GC implementations, if the array instance is longer lived
+ // (its liveness rarely checked) than some of its contents.
+ Arrays.fill(elements, null);
elements = a;
head = 0;
tail = n;
diff --git a/ojluni/src/test/java/time/tck/java/time/chrono/TCKJapaneseChronology.java b/ojluni/src/test/java/time/tck/java/time/chrono/TCKJapaneseChronology.java
index 091b385..951b30c 100644
--- a/ojluni/src/test/java/time/tck/java/time/chrono/TCKJapaneseChronology.java
+++ b/ojluni/src/test/java/time/tck/java/time/chrono/TCKJapaneseChronology.java
@@ -176,7 +176,7 @@
@DataProvider(name="createByEra")
Object[][] data_createByEra() {
return new Object[][] {
- {JapaneseEra.of(3), 2020 - YDIFF_REIWA, 2, 29, 60, LocalDate.of(2020, 2, 29)}, // NEWERA
+ {JapaneseEra.of(3), 2020 - YDIFF_REIWA, 2, 29, 60, LocalDate.of(2020, 2, 29)},
{JapaneseEra.HEISEI, 1996 - YDIFF_HEISEI, 2, 29, 60, LocalDate.of(1996, 2, 29)},
{JapaneseEra.HEISEI, 2000 - YDIFF_HEISEI, 2, 29, 60, LocalDate.of(2000, 2, 29)},
{JapaneseEra.MEIJI, 1874 - YDIFF_MEIJI, 2, 28, 59, LocalDate.of(1874, 2, 28)},
diff --git a/ojluni/src/test/java/time/test/java/time/format/TestNonIsoFormatter.java b/ojluni/src/test/java/time/test/java/time/format/TestNonIsoFormatter.java
index e2c2b4a..310f008 100644
--- a/ojluni/src/test/java/time/test/java/time/format/TestNonIsoFormatter.java
+++ b/ojluni/src/test/java/time/test/java/time/format/TestNonIsoFormatter.java
@@ -149,9 +149,8 @@
{ JAPANESE, "Meiji 123", "Heisei 2" },
// Android-changed: Eras names have been changed in CLDR data.
// { JAPANESE, "Showa 65", "Heisei 2" }
- // { JAPANESE, "Heisei 32", "NewEra 2" }, // NewEra
{ JAPANESE, "Shōwa 65", "Heisei 2" },
- { JAPANESE, "Heisei 32", "Qqqq 2" }, // NewEra
+ { JAPANESE, "Heisei 32", "Reiwa 2" },
};
}