Merge "Revert "Add SCRYPT to expected SecretKeyFactories.""
diff --git a/Android.bp b/Android.bp
index b599141..6d8a0f5 100644
--- a/Android.bp
+++ b/Android.bp
@@ -60,6 +60,7 @@
build = [
"JavaLibrary.bp",
"NativeCode.bp",
+ "Extras.bp",
]
java_genrule {
diff --git a/EXPECTED_UPSTREAM b/EXPECTED_UPSTREAM
index 00eda88..eefa580 100644
--- a/EXPECTED_UPSTREAM
+++ b/EXPECTED_UPSTREAM
@@ -32,7 +32,7 @@
ojluni/src/main/java/java/io/Bits.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/io/Bits.java
ojluni/src/main/java/java/io/BufferedInputStream.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/io/BufferedInputStream.java
ojluni/src/main/java/java/io/BufferedOutputStream.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/io/BufferedOutputStream.java
-ojluni/src/main/java/java/io/BufferedReader.java,jdk11u/jdk-11+28,src/java.base/share/classes/java/io/BufferedReader.java
+ojluni/src/main/java/java/io/BufferedReader.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/io/BufferedReader.java
ojluni/src/main/java/java/io/BufferedWriter.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/io/BufferedWriter.java
ojluni/src/main/java/java/io/ByteArrayInputStream.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/io/ByteArrayInputStream.java
ojluni/src/main/java/java/io/ByteArrayOutputStream.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/io/ByteArrayOutputStream.java
@@ -56,7 +56,7 @@
ojluni/src/main/java/java/io/FileInputStream.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/io/FileInputStream.java
ojluni/src/main/java/java/io/FileNotFoundException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/io/FileNotFoundException.java
ojluni/src/main/java/java/io/FileOutputStream.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/io/FileOutputStream.java
-ojluni/src/main/java/java/io/FilePermission.java,jdk11u/jdk-11+28,src/java.base/share/classes/java/io/FilePermission.java
+ojluni/src/main/java/java/io/FilePermission.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/io/FilePermission.java
ojluni/src/main/java/java/io/FileReader.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/io/FileReader.java
ojluni/src/main/java/java/io/FileSystem.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/io/FileSystem.java
ojluni/src/main/java/java/io/FileWriter.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/io/FileWriter.java
@@ -69,12 +69,12 @@
ojluni/src/main/java/java/io/IOError.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/io/IOError.java
ojluni/src/main/java/java/io/IOException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/io/IOException.java
ojluni/src/main/java/java/io/InputStream.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/io/InputStream.java
-ojluni/src/main/java/java/io/InputStreamReader.java,jdk11u/jdk-11+28,src/java.base/share/classes/java/io/InputStreamReader.java
+ojluni/src/main/java/java/io/InputStreamReader.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/io/InputStreamReader.java
ojluni/src/main/java/java/io/InterruptedIOException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/io/InterruptedIOException.java
ojluni/src/main/java/java/io/InvalidClassException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/io/InvalidClassException.java
ojluni/src/main/java/java/io/InvalidObjectException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/io/InvalidObjectException.java
ojluni/src/main/java/java/io/LineNumberInputStream.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/io/LineNumberInputStream.java
-ojluni/src/main/java/java/io/LineNumberReader.java,jdk11u/jdk-11+28,src/java.base/share/classes/java/io/LineNumberReader.java
+ojluni/src/main/java/java/io/LineNumberReader.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/io/LineNumberReader.java
ojluni/src/main/java/java/io/NotActiveException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/io/NotActiveException.java
ojluni/src/main/java/java/io/NotSerializableException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/io/NotSerializableException.java
ojluni/src/main/java/java/io/ObjectInput.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/io/ObjectInput.java
@@ -159,13 +159,13 @@
ojluni/src/main/java/java/lang/InheritableThreadLocal.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/InheritableThreadLocal.java
ojluni/src/main/java/java/lang/InstantiationError.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/InstantiationError.java
ojluni/src/main/java/java/lang/InstantiationException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/InstantiationException.java
-ojluni/src/main/java/java/lang/Integer.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/lang/Integer.java
+ojluni/src/main/java/java/lang/Integer.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/Integer.java
ojluni/src/main/java/java/lang/InternalError.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/InternalError.java
ojluni/src/main/java/java/lang/InterruptedException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/InterruptedException.java
ojluni/src/main/java/java/lang/Iterable.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/Iterable.java
ojluni/src/main/java/java/lang/LinkageError.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/LinkageError.java
-ojluni/src/main/java/java/lang/Long.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/lang/Long.java
-ojluni/src/main/java/java/lang/Math.java,jdk11u/jdk-11+28,src/java.base/share/classes/java/lang/Math.java
+ojluni/src/main/java/java/lang/Long.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/Long.java
+ojluni/src/main/java/java/lang/Math.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/Math.java
ojluni/src/main/java/java/lang/NegativeArraySizeException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/NegativeArraySizeException.java
ojluni/src/main/java/java/lang/NoClassDefFoundError.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/NoClassDefFoundError.java
ojluni/src/main/java/java/lang/NoSuchFieldError.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/NoSuchFieldError.java
@@ -195,18 +195,19 @@
ojluni/src/main/java/java/lang/Short.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/Short.java
ojluni/src/main/java/java/lang/StackOverflowError.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/StackOverflowError.java
ojluni/src/main/java/java/lang/StackTraceElement.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/lang/StackTraceElement.java
-ojluni/src/main/java/java/lang/StrictMath.java,jdk11u/jdk-11+28,src/java.base/share/classes/java/lang/StrictMath.java
-ojluni/src/main/java/java/lang/String.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/lang/String.java
+ojluni/src/main/java/java/lang/StrictMath.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/StrictMath.java
+ojluni/src/main/java/java/lang/String.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/String.java
ojluni/src/main/java/java/lang/StringBuffer.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/lang/StringBuffer.java
ojluni/src/main/java/java/lang/StringBuilder.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/lang/StringBuilder.java
ojluni/src/main/java/java/lang/StringIndexOutOfBoundsException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/StringIndexOutOfBoundsException.java
+ojluni/src/main/java/java/lang/StringUTF16.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/StringUTF16.java
ojluni/src/main/java/java/lang/SuppressWarnings.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/lang/SuppressWarnings.java
ojluni/src/main/java/java/lang/System.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/lang/System.java
-ojluni/src/main/java/java/lang/Thread.java,jdk11u/jdk-11+28,src/java.base/share/classes/java/lang/Thread.java
+ojluni/src/main/java/java/lang/Thread.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/Thread.java
ojluni/src/main/java/java/lang/ThreadDeath.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/ThreadDeath.java
ojluni/src/main/java/java/lang/ThreadGroup.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/lang/ThreadGroup.java
ojluni/src/main/java/java/lang/ThreadLocal.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/lang/ThreadLocal.java
-ojluni/src/main/java/java/lang/Throwable.java,jdk11u/jdk-11+28,src/java.base/share/classes/java/lang/Throwable.java
+ojluni/src/main/java/java/lang/Throwable.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/Throwable.java
ojluni/src/main/java/java/lang/TypeNotPresentException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/TypeNotPresentException.java
ojluni/src/main/java/java/lang/UNIXProcess.java,jdk8u/jdk8u121-b13,jdk/src/solaris/classes/java/lang/UNIXProcess.java
ojluni/src/main/java/java/lang/UnknownError.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/UnknownError.java
@@ -243,10 +244,11 @@
ojluni/src/main/java/java/lang/invoke/MutableCallSite.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/lang/invoke/MutableCallSite.java
ojluni/src/main/java/java/lang/invoke/Stable.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/lang/invoke/Stable.java
# java.lang.invoke.Transformers isn't in the upstream OpenJDK
-ojluni/src/main/java/java/lang/invoke/VarHandle.java,jdk9/jdk-9+181,jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java
+ojluni/src/main/java/java/lang/invoke/VarHandle.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/invoke/VarHandle.java
ojluni/src/main/java/java/lang/invoke/VolatileCallSite.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/lang/invoke/VolatileCallSite.java
ojluni/src/main/java/java/lang/invoke/WrongMethodTypeException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/invoke/WrongMethodTypeException.java
ojluni/src/main/java/java/lang/package-info.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/package-info.java
+ojluni/src/main/java/java/lang/ref/Cleaner.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/ref/Cleaner.java
ojluni/src/main/java/java/lang/ref/PhantomReference.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/ref/PhantomReference.java
ojluni/src/main/java/java/lang/ref/Reference.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/lang/ref/Reference.java
ojluni/src/main/java/java/lang/ref/ReferenceQueue.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/lang/ref/ReferenceQueue.java
@@ -279,91 +281,91 @@
ojluni/src/main/java/java/lang/reflect/WeakCache.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/lang/reflect/WeakCache.java
ojluni/src/main/java/java/lang/reflect/WildcardType.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/lang/reflect/WildcardType.java
ojluni/src/main/java/java/lang/reflect/package-info.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/lang/reflect/package-info.java
-ojluni/src/main/java/java/math/BigDecimal.java,jdk11u/jdk-11+28,src/java.base/share/classes/java/math/BigDecimal.java
-ojluni/src/main/java/java/math/BigInteger.java,jdk11u/jdk-11+28,src/java.base/share/classes/java/math/BigInteger.java
+ojluni/src/main/java/java/math/BigDecimal.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/math/BigDecimal.java
+ojluni/src/main/java/java/math/BigInteger.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/math/BigInteger.java
ojluni/src/main/java/java/math/BitSieve.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/math/BitSieve.java
ojluni/src/main/java/java/math/MathContext.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/math/MathContext.java
-ojluni/src/main/java/java/math/MutableBigInteger.java,jdk11u/jdk-11+28,src/java.base/share/classes/java/math/MutableBigInteger.java
+ojluni/src/main/java/java/math/MutableBigInteger.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/math/MutableBigInteger.java
ojluni/src/main/java/java/math/RoundingMode.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/math/RoundingMode.java
ojluni/src/main/java/java/math/SignedMutableBigInteger.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/math/SignedMutableBigInteger.java
ojluni/src/main/java/java/math/package-info.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/math/package-info.java
ojluni/src/main/java/java/net/AbstractPlainDatagramSocketImpl.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/net/AbstractPlainDatagramSocketImpl.java
ojluni/src/main/java/java/net/AbstractPlainSocketImpl.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/net/AbstractPlainSocketImpl.java
ojluni/src/main/java/java/net/Authenticator.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/net/Authenticator.java
-ojluni/src/main/java/java/net/BindException.java,jjdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/BindException.java
+ojluni/src/main/java/java/net/BindException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/BindException.java
ojluni/src/main/java/java/net/CacheRequest.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/CacheRequest.java
ojluni/src/main/java/java/net/CacheResponse.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/CacheResponse.java
-ojluni/src/main/java/java/net/ConnectException.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/ConnectException.java
+ojluni/src/main/java/java/net/ConnectException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/ConnectException.java
ojluni/src/main/java/java/net/ContentHandler.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/net/ContentHandler.java
-ojluni/src/main/java/java/net/ContentHandlerFactory.jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/ContentHandlerFactory.java
-ojluni/src/main/java/java/net/CookieHandler.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/CookieHandler.java
-ojluni/src/main/java/java/net/CookieManager.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/CookieManager.java
+ojluni/src/main/java/java/net/ContentHandlerFactory.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/ContentHandlerFactory.java
+ojluni/src/main/java/java/net/CookieHandler.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/CookieHandler.java
+ojluni/src/main/java/java/net/CookieManager.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/CookieManager.java
ojluni/src/main/java/java/net/CookiePolicy.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/CookiePolicy.java
ojluni/src/main/java/java/net/CookieStore.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/CookieStore.java
-ojluni/src/main/java/java/net/DatagramPacket.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/DatagramPacket.java
-ojluni/src/main/java/java/net/DatagramSocket.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/DatagramSocket.java
-ojluni/src/main/java/java/net/DatagramSocketImpl.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/DatagramSocketImpl.java
+ojluni/src/main/java/java/net/DatagramPacket.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/DatagramPacket.java
+ojluni/src/main/java/java/net/DatagramSocket.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/DatagramSocket.java
+ojluni/src/main/java/java/net/DatagramSocketImpl.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/DatagramSocketImpl.java
ojluni/src/main/java/java/net/DatagramSocketImplFactory.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/DatagramSocketImplFactory.java
ojluni/src/main/java/java/net/DefaultDatagramSocketImplFactory.java,jdk8u/jdk8u121-b13,jdk/src/solaris/classes/java/net/DefaultDatagramSocketImplFactory.java
ojluni/src/main/java/java/net/DefaultInterface.java,jdk11u/jdk-11.0.13-ga,src/java.base/unix/classes/java/net/DefaultInterface.java
-ojluni/src/main/java/java/net/FileNameMap.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/FileNameMap.java
+ojluni/src/main/java/java/net/FileNameMap.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/FileNameMap.java
ojluni/src/main/java/java/net/HttpCookie.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/net/HttpCookie.java
ojluni/src/main/java/java/net/HttpRetryException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/HttpRetryException.java
ojluni/src/main/java/java/net/HttpURLConnection.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/net/HttpURLConnection.java
ojluni/src/main/java/java/net/IDN.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/net/IDN.java
-ojluni/src/main/java/java/net/InMemoryCookieStore.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/InMemoryCookieStore.java
-ojluni/src/main/java/java/net/Inet4Address.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/Inet4Address.java
+ojluni/src/main/java/java/net/InMemoryCookieStore.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/InMemoryCookieStore.java
+ojluni/src/main/java/java/net/Inet4Address.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/Inet4Address.java
ojluni/src/main/java/java/net/Inet6Address.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/net/Inet6Address.java
ojluni/src/main/java/java/net/Inet6AddressImpl.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/net/Inet6AddressImpl.java
ojluni/src/main/java/java/net/InetAddress.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/net/InetAddress.java
ojluni/src/main/java/java/net/InetAddressContainer.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/InetAddressContainer.java
ojluni/src/main/java/java/net/InetAddressImpl.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/InetAddressImpl.java
-ojluni/src/main/java/java/net/InetSocketAddress.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/InetSocketAddress.java
+ojluni/src/main/java/java/net/InetSocketAddress.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/InetSocketAddress.java
ojluni/src/main/java/java/net/InterfaceAddress.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/InterfaceAddress.java
-ojluni/src/main/java/java/net/JarURLConnection.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/JarURLConnection.java
+ojluni/src/main/java/java/net/JarURLConnection.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/JarURLConnection.java
ojluni/src/main/java/java/net/MalformedURLException.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/net/MalformedURLException.java
-ojluni/src/main/java/java/net/MulticastSocket.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/MulticastSocket.java
-ojluni/src/main/java/java/net/NetPermission.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/NetPermission.java
+ojluni/src/main/java/java/net/MulticastSocket.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/MulticastSocket.java
+ojluni/src/main/java/java/net/NetPermission.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/NetPermission.java
ojluni/src/main/java/java/net/NetworkInterface.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/net/NetworkInterface.java
-ojluni/src/main/java/java/net/NoRouteToHostException.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/NoRouteToHostException.java
+ojluni/src/main/java/java/net/NoRouteToHostException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/NoRouteToHostException.java
ojluni/src/main/java/java/net/PasswordAuthentication.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/PasswordAuthentication.java
ojluni/src/main/java/java/net/PlainDatagramSocketImpl.java,jdk8u/jdk8u121-b13,jdk/src/solaris/classes/java/net/PlainDatagramSocketImpl.java
ojluni/src/main/java/java/net/PlainSocketImpl.java,jdk8u/jdk8u121-b13,jdk/src/solaris/classes/java/net/PlainSocketImpl.java
ojluni/src/main/java/java/net/PortUnreachableException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/PortUnreachableException.java
-ojluni/src/main/java/java/net/ProtocolException.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/ProtocolException.java
+ojluni/src/main/java/java/net/ProtocolException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/ProtocolException.java
ojluni/src/main/java/java/net/ProtocolFamily.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/ProtocolFamily.java
-ojluni/src/main/java/java/net/Proxy.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/Proxy.java
+ojluni/src/main/java/java/net/Proxy.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/Proxy.java
ojluni/src/main/java/java/net/ProxySelector.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/net/ProxySelector.java
-ojluni/src/main/java/java/net/ResponseCache.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/ResponseCache.java
+ojluni/src/main/java/java/net/ResponseCache.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/ResponseCache.java
ojluni/src/main/java/java/net/SecureCacheResponse.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/SecureCacheResponse.java
-ojluni/src/main/java/java/net/ServerSocket.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/ServerSocket.java
-ojluni/src/main/java/java/net/Socket.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/Socket.java
+ojluni/src/main/java/java/net/ServerSocket.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/ServerSocket.java
+ojluni/src/main/java/java/net/Socket.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/Socket.java
ojluni/src/main/java/java/net/SocketAddress.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/SocketAddress.java
-ojluni/src/main/java/java/net/SocketException.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/SocketException.java
-ojluni/src/main/java/java/net/SocketImpl.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/SocketImpl.java
-ojluni/src/main/java/java/net/SocketImplFactory.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/SocketImplFactory.java
-ojluni/src/main/java/java/net/SocketInputStream.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/SocketInputStream.java
+ojluni/src/main/java/java/net/SocketException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/SocketException.java
+ojluni/src/main/java/java/net/SocketImpl.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/SocketImpl.java
+ojluni/src/main/java/java/net/SocketImplFactory.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/SocketImplFactory.java
+ojluni/src/main/java/java/net/SocketInputStream.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/SocketInputStream.java
ojluni/src/main/java/java/net/SocketOption.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/SocketOption.java
-ojluni/src/main/java/java/net/SocketOptions.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/SocketOptions.java
-ojluni/src/main/java/java/net/SocketOutputStream.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/SocketOutputStream.java
-ojluni/src/main/java/java/net/SocketPermission.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/SocketPermission.java
+ojluni/src/main/java/java/net/SocketOptions.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/SocketOptions.java
+ojluni/src/main/java/java/net/SocketOutputStream.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/SocketOutputStream.java
+ojluni/src/main/java/java/net/SocketPermission.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/SocketPermission.java
ojluni/src/main/java/java/net/SocketSecrets.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/net/SocketSecrets.java
ojluni/src/main/java/java/net/SocketTimeoutException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/SocketTimeoutException.java
ojluni/src/main/java/java/net/SocksConsts.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/SocksConsts.java
ojluni/src/main/java/java/net/SocksSocketImpl.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/net/SocksSocketImpl.java
ojluni/src/main/java/java/net/StandardProtocolFamily.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/StandardProtocolFamily.java
-ojluni/src/main/java/java/net/StandardSocketOptions.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/StandardSocketOptions.java
+ojluni/src/main/java/java/net/StandardSocketOptions.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/StandardSocketOptions.java
ojluni/src/main/java/java/net/URI.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/net/URI.java
-ojluni/src/main/java/java/net/URISyntaxException.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/URISyntaxException.java
+ojluni/src/main/java/java/net/URISyntaxException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/URISyntaxException.java
ojluni/src/main/java/java/net/URL.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/net/URL.java
ojluni/src/main/java/java/net/URLClassLoader.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/net/URLClassLoader.java
ojluni/src/main/java/java/net/URLConnection.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/net/URLConnection.java
-ojluni/src/main/java/java/net/URLDecoder.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/URLDecoder.java
-ojluni/src/main/java/java/net/URLEncoder.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/URLEncoder.java
+ojluni/src/main/java/java/net/URLDecoder.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/URLDecoder.java
+ojluni/src/main/java/java/net/URLEncoder.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/URLEncoder.java
ojluni/src/main/java/java/net/URLStreamHandler.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/net/URLStreamHandler.java
-ojluni/src/main/java/java/net/URLStreamHandlerFactory.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/URLStreamHandlerFactory.java
-ojluni/src/main/java/java/net/UnknownHostException.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/UnknownHostException.java
-ojluni/src/main/java/java/net/UnknownServiceException.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/net/UnknownServiceException.java
+ojluni/src/main/java/java/net/URLStreamHandlerFactory.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/URLStreamHandlerFactory.java
+ojluni/src/main/java/java/net/UnknownHostException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/UnknownHostException.java
+ojluni/src/main/java/java/net/UnknownServiceException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/net/UnknownServiceException.java
ojluni/src/main/java/java/net/package-info.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/net/package-info.java
# Some java.nio Buffer and Exception classes are generated from templates, and thus has no direct mapping to an upstream file.
ojluni/src/main/java/java/nio/Bits.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/nio/Bits.java
@@ -396,7 +398,7 @@
ojluni/src/main/java/java/nio/channels/SeekableByteChannel.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/nio/channels/SeekableByteChannel.java
ojluni/src/main/java/java/nio/channels/SelectableChannel.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/nio/channels/SelectableChannel.java
ojluni/src/main/java/java/nio/channels/SelectionKey.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/nio/channels/SelectionKey.java
-ojluni/src/main/java/java/nio/channels/Selector.java,jdk11u/jdk-11+28,src/java.base/share/classes/java/nio/channels/Selector.java
+ojluni/src/main/java/java/nio/channels/Selector.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/nio/channels/Selector.java
ojluni/src/main/java/java/nio/channels/ServerSocketChannel.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/nio/channels/ServerSocketChannel.java
ojluni/src/main/java/java/nio/channels/SocketChannel.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/nio/channels/SocketChannel.java
ojluni/src/main/java/java/nio/channels/WritableByteChannel.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/nio/channels/WritableByteChannel.java
@@ -443,7 +445,7 @@
ojluni/src/main/java/java/nio/file/Files.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/nio/file/Files.java
ojluni/src/main/java/java/nio/file/InvalidPathException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/nio/file/InvalidPathException.java
ojluni/src/main/java/java/nio/file/LinkOption.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/nio/file/LinkOption.java
-ojluni/src/main/java/java/nio/file/LinkPermission.java,jdk11u/jdk-11+28,src/java.base/share/classes/java/nio/file/LinkPermission.java
+ojluni/src/main/java/java/nio/file/LinkPermission.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/nio/file/LinkPermission.java
ojluni/src/main/java/java/nio/file/NoSuchFileException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/nio/file/NoSuchFileException.java
ojluni/src/main/java/java/nio/file/NotDirectoryException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/nio/file/NotDirectoryException.java
ojluni/src/main/java/java/nio/file/NotLinkException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/nio/file/NotLinkException.java
@@ -492,7 +494,7 @@
ojluni/src/main/java/java/nio/file/spi/FileTypeDetector.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/nio/file/spi/FileTypeDetector.java
ojluni/src/main/java/java/nio/package-info.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/nio/package-info.java
ojluni/src/main/java/java/security/AccessControlContext.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/AccessControlContext.java
-ojluni/src/main/java/java/security/AccessControlException.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/AccessControlException.java
+ojluni/src/main/java/java/security/AccessControlException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/AccessControlException.java
ojluni/src/main/java/java/security/AccessController.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/AccessController.java
ojluni/src/main/java/java/security/AlgorithmConstraints.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/AlgorithmConstraints.java
ojluni/src/main/java/java/security/AlgorithmParameterGenerator.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/AlgorithmParameterGenerator.java
@@ -502,77 +504,77 @@
ojluni/src/main/java/java/security/AllPermission.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/AllPermission.java
ojluni/src/main/java/java/security/AuthProvider.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/AuthProvider.java
ojluni/src/main/java/java/security/BasicPermission.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/BasicPermission.java
-ojluni/src/main/java/java/security/Certificate.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/Certificate.java
+ojluni/src/main/java/java/security/Certificate.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/Certificate.java
ojluni/src/main/java/java/security/CodeSigner.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/CodeSigner.java
ojluni/src/main/java/java/security/CodeSource.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/CodeSource.java
ojluni/src/main/java/java/security/CryptoPrimitive.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/CryptoPrimitive.java
ojluni/src/main/java/java/security/DigestException.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/DigestException.java
-ojluni/src/main/java/java/security/DigestInputStream.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/DigestInputStream.java
-ojluni/src/main/java/java/security/DigestOutputStream.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/DigestOutputStream.java
-ojluni/src/main/java/java/security/DomainCombiner.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/DomainCombiner.java
+ojluni/src/main/java/java/security/DigestInputStream.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/DigestInputStream.java
+ojluni/src/main/java/java/security/DigestOutputStream.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/DigestOutputStream.java
+ojluni/src/main/java/java/security/DomainCombiner.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/DomainCombiner.java
ojluni/src/main/java/java/security/DomainLoadStoreParameter.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/DomainLoadStoreParameter.java
-ojluni/src/main/java/java/security/GeneralSecurityException.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/GeneralSecurityException.java
-ojluni/src/main/java/java/security/Guard.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/Guard.java
-ojluni/src/main/java/java/security/GuardedObject.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/GuardedObject.java
-ojluni/src/main/java/java/security/Identity.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/Identity.java
+ojluni/src/main/java/java/security/GeneralSecurityException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/GeneralSecurityException.java
+ojluni/src/main/java/java/security/Guard.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/Guard.java
+ojluni/src/main/java/java/security/GuardedObject.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/GuardedObject.java
+ojluni/src/main/java/java/security/Identity.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/Identity.java
ojluni/src/main/java/java/security/IdentityScope.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/IdentityScope.java
-ojluni/src/main/java/java/security/InvalidAlgorithmParameterException.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/InvalidAlgorithmParameterException.java
-ojluni/src/main/java/java/security/InvalidKeyException.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/InvalidKeyException.java
-ojluni/src/main/java/java/security/InvalidParameterException.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/InvalidParameterException.java
-ojluni/src/main/java/java/security/Key.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/Key.java
-ojluni/src/main/java/java/security/KeyException.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/KeyException.java
+ojluni/src/main/java/java/security/InvalidAlgorithmParameterException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/InvalidAlgorithmParameterException.java
+ojluni/src/main/java/java/security/InvalidKeyException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/InvalidKeyException.java
+ojluni/src/main/java/java/security/InvalidParameterException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/InvalidParameterException.java
+ojluni/src/main/java/java/security/Key.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/Key.java
+ojluni/src/main/java/java/security/KeyException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/KeyException.java
ojluni/src/main/java/java/security/KeyFactory.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/KeyFactory.java
ojluni/src/main/java/java/security/KeyFactorySpi.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/KeyFactorySpi.java
-ojluni/src/main/java/java/security/KeyManagementException.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/KeyManagementException.java
-ojluni/src/main/java/java/security/KeyPair.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/KeyPair.java
-ojluni/src/main/java/java/security/KeyPairGenerator.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/KeyPairGenerator.java
-ojluni/src/main/java/java/security/KeyPairGeneratorSpi.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/KeyPairGeneratorSpi.java
-ojluni/src/main/java/java/security/KeyRep.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/KeyRep.java
-ojluni/src/main/java/java/security/KeyStore.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/KeyStore.java
+ojluni/src/main/java/java/security/KeyManagementException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/KeyManagementException.java
+ojluni/src/main/java/java/security/KeyPair.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/KeyPair.java
+ojluni/src/main/java/java/security/KeyPairGenerator.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/KeyPairGenerator.java
+ojluni/src/main/java/java/security/KeyPairGeneratorSpi.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/KeyPairGeneratorSpi.java
+ojluni/src/main/java/java/security/KeyRep.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/KeyRep.java
+ojluni/src/main/java/java/security/KeyStore.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/KeyStore.java
ojluni/src/main/java/java/security/KeyStoreException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/KeyStoreException.java
-ojluni/src/main/java/java/security/KeyStoreSpi.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/KeyStoreSpi.java
-ojluni/src/main/java/java/security/MessageDigest.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/MessageDigest.java
-ojluni/src/main/java/java/security/MessageDigestSpi.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/MessageDigestSpi.java
-ojluni/src/main/java/java/security/NoSuchAlgorithmException.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/NoSuchAlgorithmException.java
+ojluni/src/main/java/java/security/KeyStoreSpi.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/KeyStoreSpi.java
+ojluni/src/main/java/java/security/MessageDigest.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/MessageDigest.java
+ojluni/src/main/java/java/security/MessageDigestSpi.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/MessageDigestSpi.java
+ojluni/src/main/java/java/security/NoSuchAlgorithmException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/NoSuchAlgorithmException.java
ojluni/src/main/java/java/security/NoSuchProviderException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/NoSuchProviderException.java
-ojluni/src/main/java/java/security/PKCS12Attribute.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/PKCS12Attribute.java
+ojluni/src/main/java/java/security/PKCS12Attribute.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/PKCS12Attribute.java
ojluni/src/main/java/java/security/Permission.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/Permission.java
ojluni/src/main/java/java/security/PermissionCollection.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/PermissionCollection.java
ojluni/src/main/java/java/security/Permissions.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/Permissions.java
ojluni/src/main/java/java/security/Policy.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/Policy.java
ojluni/src/main/java/java/security/PolicySpi.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/PolicySpi.java
-ojluni/src/main/java/java/security/Principal.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/Principal.java
-ojluni/src/main/java/java/security/PrivateKey.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/PrivateKey.java
+ojluni/src/main/java/java/security/Principal.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/Principal.java
+ojluni/src/main/java/java/security/PrivateKey.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/PrivateKey.java
ojluni/src/main/java/java/security/PrivilegedAction.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/PrivilegedAction.java
-ojluni/src/main/java/java/security/PrivilegedActionException.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/PrivilegedActionException.java
+ojluni/src/main/java/java/security/PrivilegedActionException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/PrivilegedActionException.java
ojluni/src/main/java/java/security/PrivilegedExceptionAction.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/PrivilegedExceptionAction.java
-ojluni/src/main/java/java/security/ProtectionDomain.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/ProtectionDomain.java
+ojluni/src/main/java/java/security/ProtectionDomain.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/ProtectionDomain.java
ojluni/src/main/java/java/security/Provider.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/Provider.java
ojluni/src/main/java/java/security/ProviderException.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/ProviderException.java
-ojluni/src/main/java/java/security/PublicKey.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/PublicKey.java
+ojluni/src/main/java/java/security/PublicKey.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/PublicKey.java
ojluni/src/main/java/java/security/SecureClassLoader.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/SecureClassLoader.java
ojluni/src/main/java/java/security/SecureRandom.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/SecureRandom.java
ojluni/src/main/java/java/security/SecureRandomSpi.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/SecureRandomSpi.java
ojluni/src/main/java/java/security/Security.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/Security.java
-ojluni/src/main/java/java/security/SecurityPermission.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/SecurityPermission.java
+ojluni/src/main/java/java/security/SecurityPermission.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/SecurityPermission.java
ojluni/src/main/java/java/security/Signature.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/Signature.java
-ojluni/src/main/java/java/security/SignatureException.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/SignatureException.java
+ojluni/src/main/java/java/security/SignatureException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/SignatureException.java
ojluni/src/main/java/java/security/SignatureSpi.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/SignatureSpi.java
-ojluni/src/main/java/java/security/SignedObject.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/SignedObject.java
-ojluni/src/main/java/java/security/Signer.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/Signer.java
-ojluni/src/main/java/java/security/Timestamp.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/Timestamp.java
+ojluni/src/main/java/java/security/SignedObject.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/SignedObject.java
+ojluni/src/main/java/java/security/Signer.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/Signer.java
+ojluni/src/main/java/java/security/Timestamp.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/Timestamp.java
ojluni/src/main/java/java/security/UnrecoverableEntryException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/UnrecoverableEntryException.java
ojluni/src/main/java/java/security/UnrecoverableKeyException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/UnrecoverableKeyException.java
-ojluni/src/main/java/java/security/UnresolvedPermission.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/UnresolvedPermission.java
-ojluni/src/main/java/java/security/UnresolvedPermissionCollection.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/UnresolvedPermissionCollection.java
-ojluni/src/main/java/java/security/acl/Acl.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/acl/Acl.java
-ojluni/src/main/java/java/security/acl/AclEntry.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/acl/AclEntry.java
-ojluni/src/main/java/java/security/acl/AclNotFoundException.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/acl/AclNotFoundException.java
-ojluni/src/main/java/java/security/acl/Group.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/acl/Group.java
-ojluni/src/main/java/java/security/acl/LastOwnerException.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/acl/LastOwnerException.java
-ojluni/src/main/java/java/security/acl/NotOwnerException.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/acl/NotOwnerException.java
-ojluni/src/main/java/java/security/acl/Owner.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/acl/Owner.java
-ojluni/src/main/java/java/security/acl/Permission.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/acl/Permission.java
+ojluni/src/main/java/java/security/UnresolvedPermission.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/UnresolvedPermission.java
+ojluni/src/main/java/java/security/UnresolvedPermissionCollection.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/UnresolvedPermissionCollection.java
+ojluni/src/main/java/java/security/acl/Acl.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/acl/Acl.java
+ojluni/src/main/java/java/security/acl/AclEntry.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/acl/AclEntry.java
+ojluni/src/main/java/java/security/acl/AclNotFoundException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/acl/AclNotFoundException.java
+ojluni/src/main/java/java/security/acl/Group.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/acl/Group.java
+ojluni/src/main/java/java/security/acl/LastOwnerException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/acl/LastOwnerException.java
+ojluni/src/main/java/java/security/acl/NotOwnerException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/acl/NotOwnerException.java
+ojluni/src/main/java/java/security/acl/Owner.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/acl/Owner.java
+ojluni/src/main/java/java/security/acl/Permission.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/acl/Permission.java
ojluni/src/main/java/java/security/acl/package-info.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/acl/package-info.java
ojluni/src/main/java/java/security/cert/CRL.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/cert/CRL.java
ojluni/src/main/java/java/security/cert/CRLException.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/cert/CRLException.java
@@ -625,25 +627,25 @@
ojluni/src/main/java/java/security/cert/X509Certificate.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/cert/X509Certificate.java
ojluni/src/main/java/java/security/cert/X509Extension.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/cert/X509Extension.java
ojluni/src/main/java/java/security/cert/package-info.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/cert/package-info.java
-ojluni/src/main/java/java/security/interfaces/DSAKey.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/interfaces/DSAKey.java
-ojluni/src/main/java/java/security/interfaces/DSAKeyPairGenerator.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/interfaces/DSAKeyPairGenerator.java
-ojluni/src/main/java/java/security/interfaces/DSAParams.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/interfaces/DSAParams.java
-ojluni/src/main/java/java/security/interfaces/DSAPrivateKey.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/interfaces/DSAPrivateKey.java
-ojluni/src/main/java/java/security/interfaces/DSAPublicKey.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/interfaces/DSAPublicKey.java
+ojluni/src/main/java/java/security/interfaces/DSAKey.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/interfaces/DSAKey.java
+ojluni/src/main/java/java/security/interfaces/DSAKeyPairGenerator.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/interfaces/DSAKeyPairGenerator.java
+ojluni/src/main/java/java/security/interfaces/DSAParams.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/interfaces/DSAParams.java
+ojluni/src/main/java/java/security/interfaces/DSAPrivateKey.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/interfaces/DSAPrivateKey.java
+ojluni/src/main/java/java/security/interfaces/DSAPublicKey.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/interfaces/DSAPublicKey.java
ojluni/src/main/java/java/security/interfaces/ECKey.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/interfaces/ECKey.java
ojluni/src/main/java/java/security/interfaces/ECPrivateKey.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/interfaces/ECPrivateKey.java
ojluni/src/main/java/java/security/interfaces/ECPublicKey.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/interfaces/ECPublicKey.java
-ojluni/src/main/java/java/security/interfaces/EdECKey.java,jdk-17.0.2-ga,src/java.base/share/classes/java/security/interfaces/EdECKey.java
-ojluni/src/main/java/java/security/interfaces/EdECPrivateKey.java,jdk-17.0.2-ga,src/java.base/share/classes/java/security/interfaces/EdECPrivateKey.java
-ojluni/src/main/java/java/security/interfaces/EdECPublicKey.java,jdk-17.0.2-ga,src/java.base/share/classes/java/security/interfaces/EdECPublicKey.java
+ojluni/src/main/java/java/security/interfaces/EdECKey.java,jdk17u/jdk-17.0.2-ga,src/java.base/share/classes/java/security/interfaces/EdECKey.java
+ojluni/src/main/java/java/security/interfaces/EdECPrivateKey.java,jdk17u/jdk-17.0.2-ga,src/java.base/share/classes/java/security/interfaces/EdECPrivateKey.java
+ojluni/src/main/java/java/security/interfaces/EdECPublicKey.java,jdk17u/jdk-17.0.2-ga,src/java.base/share/classes/java/security/interfaces/EdECPublicKey.java
ojluni/src/main/java/java/security/interfaces/RSAKey.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/interfaces/RSAKey.java
-ojluni/src/main/java/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java
-ojluni/src/main/java/java/security/interfaces/RSAPrivateCrtKey.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/interfaces/RSAPrivateCrtKey.java
-ojluni/src/main/java/java/security/interfaces/RSAPrivateKey.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/interfaces/RSAPrivateKey.java
-ojluni/src/main/java/java/security/interfaces/RSAPublicKey.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/interfaces/RSAPublicKey.java
-ojluni/src/main/java/java/security/interfaces/XECKey.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/interfaces/XECKey.java
-ojluni/src/main/java/java/security/interfaces/XECPrivateKey.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/interfaces/XECPrivateKey.java
-ojluni/src/main/java/java/security/interfaces/XECPublicKey.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/interfaces/XECPublicKey.java
+ojluni/src/main/java/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java
+ojluni/src/main/java/java/security/interfaces/RSAPrivateCrtKey.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/interfaces/RSAPrivateCrtKey.java
+ojluni/src/main/java/java/security/interfaces/RSAPrivateKey.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/interfaces/RSAPrivateKey.java
+ojluni/src/main/java/java/security/interfaces/RSAPublicKey.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/interfaces/RSAPublicKey.java
+ojluni/src/main/java/java/security/interfaces/XECKey.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/interfaces/XECKey.java
+ojluni/src/main/java/java/security/interfaces/XECPrivateKey.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/interfaces/XECPrivateKey.java
+ojluni/src/main/java/java/security/interfaces/XECPublicKey.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/interfaces/XECPublicKey.java
ojluni/src/main/java/java/security/interfaces/package-info.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/interfaces/package-info.java
ojluni/src/main/java/java/security/package-info.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/package-info.java
ojluni/src/main/java/java/security/spec/AlgorithmParameterSpec.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/spec/AlgorithmParameterSpec.java
@@ -653,21 +655,21 @@
ojluni/src/main/java/java/security/spec/ECField.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/spec/ECField.java
ojluni/src/main/java/java/security/spec/ECFieldF2m.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/spec/ECFieldF2m.java
ojluni/src/main/java/java/security/spec/ECFieldFp.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/spec/ECFieldFp.java
-ojluni/src/main/java/java/security/spec/ECGenParameterSpec.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/spec/ECGenParameterSpec.java
+ojluni/src/main/java/java/security/spec/ECGenParameterSpec.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/spec/ECGenParameterSpec.java
ojluni/src/main/java/java/security/spec/ECParameterSpec.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/spec/ECParameterSpec.java
ojluni/src/main/java/java/security/spec/ECPoint.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/spec/ECPoint.java
ojluni/src/main/java/java/security/spec/ECPrivateKeySpec.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/spec/ECPrivateKeySpec.java
ojluni/src/main/java/java/security/spec/ECPublicKeySpec.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/spec/ECPublicKeySpec.java
-ojluni/src/main/java/java/security/spec/EdECPoint.java,jdk-17.0.2-ga,src/java.base/share/classes/java/security/spec/EdECPoint.java
-ojluni/src/main/java/java/security/spec/EdECPrivateKeySpec.java,jdk-17.0.2-ga,src/java.base/share/classes/java/security/spec/EdECPrivateKeySpec.java
-ojluni/src/main/java/java/security/spec/EdECPublicKeySpec.java,jdk-17.0.2-ga,src/java.base/share/classes/java/security/spec/EdECPublicKeySpec.java
+ojluni/src/main/java/java/security/spec/EdECPoint.java,jdk17u/jdk-17.0.2-ga,src/java.base/share/classes/java/security/spec/EdECPoint.java
+ojluni/src/main/java/java/security/spec/EdECPrivateKeySpec.java,jdk17u/jdk-17.0.2-ga,src/java.base/share/classes/java/security/spec/EdECPrivateKeySpec.java
+ojluni/src/main/java/java/security/spec/EdECPublicKeySpec.java,jdk17u/jdk-17.0.2-ga,src/java.base/share/classes/java/security/spec/EdECPublicKeySpec.java
ojluni/src/main/java/java/security/spec/EllipticCurve.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/spec/EllipticCurve.java
ojluni/src/main/java/java/security/spec/EncodedKeySpec.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/spec/EncodedKeySpec.java
ojluni/src/main/java/java/security/spec/InvalidKeySpecException.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/spec/InvalidKeySpecException.java
ojluni/src/main/java/java/security/spec/InvalidParameterSpecException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/spec/InvalidParameterSpecException.java
ojluni/src/main/java/java/security/spec/KeySpec.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/spec/KeySpec.java
ojluni/src/main/java/java/security/spec/MGF1ParameterSpec.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/spec/MGF1ParameterSpec.java
-ojluni/src/main/java/java/security/spec/NamedGenParameterSpec.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/security/spec/NamedGenParameterSpec.java
+ojluni/src/main/java/java/security/spec/NamedParameterSpec.java,jdk17u/jdk-17.0.2-ga,src/java.base/share/classes/java/security/spec/NamedParameterSpec.java
ojluni/src/main/java/java/security/spec/PKCS8EncodedKeySpec.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/spec/PKCS8EncodedKeySpec.java
ojluni/src/main/java/java/security/spec/PSSParameterSpec.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/spec/PSSParameterSpec.java
ojluni/src/main/java/java/security/spec/RSAKeyGenParameterSpec.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/spec/RSAKeyGenParameterSpec.java
@@ -676,9 +678,9 @@
ojluni/src/main/java/java/security/spec/RSAPrivateCrtKeySpec.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/spec/RSAPrivateCrtKeySpec.java
ojluni/src/main/java/java/security/spec/RSAPrivateKeySpec.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/spec/RSAPrivateKeySpec.java
ojluni/src/main/java/java/security/spec/RSAPublicKeySpec.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/spec/RSAPublicKeySpec.java
-ojluni/src/main/java/java/security/spec/XECPrivateKeySpec.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/spec/XECPrivateKeySpec.java
-ojluni/src/main/java/java/security/spec/XECPublicKeySpec.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/spec/XECPublicKeySpec.java
ojluni/src/main/java/java/security/spec/X509EncodedKeySpec.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/spec/X509EncodedKeySpec.java
+ojluni/src/main/java/java/security/spec/XECPrivateKeySpec.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/spec/XECPrivateKeySpec.java
+ojluni/src/main/java/java/security/spec/XECPublicKeySpec.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/security/spec/XECPublicKeySpec.java
ojluni/src/main/java/java/security/spec/package-info.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/security/spec/package-info.java
ojluni/src/main/java/java/sql/Array.java,jdk7u/jdk7u40-b60,jdk/src/share/classes/java/sql/Array.java
ojluni/src/main/java/java/sql/BatchUpdateException.java,jdk7u/jdk7u40-b60,jdk/src/share/classes/java/sql/BatchUpdateException.java
@@ -759,71 +761,71 @@
ojluni/src/main/java/java/text/RuleBasedCollator.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/text/RuleBasedCollator.java
ojluni/src/main/java/java/text/SimpleDateFormat.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/text/SimpleDateFormat.java
ojluni/src/main/java/java/text/StringCharacterIterator.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/text/StringCharacterIterator.java
-ojluni/src/main/java/java/time/Clock.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/Clock.java
+ojluni/src/main/java/java/time/Clock.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/Clock.java
ojluni/src/main/java/java/time/DateTimeException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/DateTimeException.java
-ojluni/src/main/java/java/time/DayOfWeek.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/DayOfWeek.java
+ojluni/src/main/java/java/time/DayOfWeek.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/DayOfWeek.java
ojluni/src/main/java/java/time/Duration.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/Duration.java
-ojluni/src/main/java/java/time/Instant.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/Instant.java
-ojluni/src/main/java/java/time/LocalDate.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/LocalDate.java
-ojluni/src/main/java/java/time/LocalDateTime.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/LocalDateTime.java
+ojluni/src/main/java/java/time/Instant.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/Instant.java
+ojluni/src/main/java/java/time/LocalDate.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/LocalDate.java
+ojluni/src/main/java/java/time/LocalDateTime.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/LocalDateTime.java
ojluni/src/main/java/java/time/LocalTime.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/LocalTime.java
ojluni/src/main/java/java/time/Month.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/Month.java
-ojluni/src/main/java/java/time/MonthDay.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/MonthDay.java
-ojluni/src/main/java/java/time/OffsetDateTime.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/OffsetDateTime.java
-ojluni/src/main/java/java/time/OffsetTime.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/OffsetTime.java
-ojluni/src/main/java/java/time/Period.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/Period.java
+ojluni/src/main/java/java/time/MonthDay.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/MonthDay.java
+ojluni/src/main/java/java/time/OffsetDateTime.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/OffsetDateTime.java
+ojluni/src/main/java/java/time/OffsetTime.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/OffsetTime.java
+ojluni/src/main/java/java/time/Period.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/Period.java
ojluni/src/main/java/java/time/Ser.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/Ser.java
-ojluni/src/main/java/java/time/Year.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/Year.java
-ojluni/src/main/java/java/time/YearMonth.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/YearMonth.java
-ojluni/src/main/java/java/time/ZoneId.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/ZoneId.java
-ojluni/src/main/java/java/time/ZoneOffset.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/ZoneOffset.java
+ojluni/src/main/java/java/time/Year.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/Year.java
+ojluni/src/main/java/java/time/YearMonth.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/YearMonth.java
+ojluni/src/main/java/java/time/ZoneId.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/ZoneId.java
+ojluni/src/main/java/java/time/ZoneOffset.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/ZoneOffset.java
ojluni/src/main/java/java/time/ZoneRegion.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/ZoneRegion.java
-ojluni/src/main/java/java/time/ZonedDateTime.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/ZonedDateTime.java
-ojluni/src/main/java/java/time/chrono/AbstractChronology.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/chrono/AbstractChronology.java
-ojluni/src/main/java/java/time/chrono/ChronoLocalDate.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java
-ojluni/src/main/java/java/time/chrono/ChronoLocalDateImpl.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/chrono/ChronoLocalDateImpl.java
-ojluni/src/main/java/java/time/chrono/ChronoLocalDateTime.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java
+ojluni/src/main/java/java/time/ZonedDateTime.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/ZonedDateTime.java
+ojluni/src/main/java/java/time/chrono/AbstractChronology.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/AbstractChronology.java
+ojluni/src/main/java/java/time/chrono/ChronoLocalDate.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/ChronoLocalDate.java
+ojluni/src/main/java/java/time/chrono/ChronoLocalDateImpl.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/ChronoLocalDateImpl.java
+ojluni/src/main/java/java/time/chrono/ChronoLocalDateTime.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/ChronoLocalDateTime.java
ojluni/src/main/java/java/time/chrono/ChronoLocalDateTimeImpl.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java
ojluni/src/main/java/java/time/chrono/ChronoPeriod.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/ChronoPeriod.java
-ojluni/src/main/java/java/time/chrono/ChronoPeriodImpl.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/chrono/ChronoPeriodImpl.java
-ojluni/src/main/java/java/time/chrono/ChronoZonedDateTime.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java
+ojluni/src/main/java/java/time/chrono/ChronoPeriodImpl.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/ChronoPeriodImpl.java
+ojluni/src/main/java/java/time/chrono/ChronoZonedDateTime.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/ChronoZonedDateTime.java
ojluni/src/main/java/java/time/chrono/ChronoZonedDateTimeImpl.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/ChronoZonedDateTimeImpl.java
-ojluni/src/main/java/java/time/chrono/Chronology.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/chrono/Chronology.java
-ojluni/src/main/java/java/time/chrono/Era.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/chrono/Era.java
-ojluni/src/main/java/java/time/chrono/HijrahChronology.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/chrono/HijrahChronology.java
-ojluni/src/main/java/java/time/chrono/HijrahDate.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/chrono/HijrahDate.java
-ojluni/src/main/java/java/time/chrono/HijrahEra.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/chrono/HijrahEra.java
-ojluni/src/main/java/java/time/chrono/IsoChronology.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/chrono/IsoChronology.java
-ojluni/src/main/java/java/time/chrono/IsoEra.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/chrono/IsoEra.java
-ojluni/src/main/java/java/time/chrono/JapaneseChronology.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/chrono/JapaneseChronology.java
-ojluni/src/main/java/java/time/chrono/JapaneseDate.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/chrono/JapaneseDate.java
-ojluni/src/main/java/java/time/chrono/JapaneseEra.java,jdk8u/jdk8u222-b01,jdk/src/share/classes/java/time/chrono/JapaneseEra.java
-ojluni/src/main/java/java/time/chrono/MinguoChronology.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/chrono/MinguoChronology.java
-ojluni/src/main/java/java/time/chrono/MinguoDate.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/chrono/MinguoDate.java
-ojluni/src/main/java/java/time/chrono/MinguoEra.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/chrono/MinguoEra.java
+ojluni/src/main/java/java/time/chrono/Chronology.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/Chronology.java
+ojluni/src/main/java/java/time/chrono/Era.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/Era.java
+ojluni/src/main/java/java/time/chrono/HijrahChronology.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/HijrahChronology.java
+ojluni/src/main/java/java/time/chrono/HijrahDate.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/HijrahDate.java
+ojluni/src/main/java/java/time/chrono/HijrahEra.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/HijrahEra.java
+ojluni/src/main/java/java/time/chrono/IsoChronology.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/IsoChronology.java
+ojluni/src/main/java/java/time/chrono/IsoEra.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/IsoEra.java
+ojluni/src/main/java/java/time/chrono/JapaneseChronology.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/JapaneseChronology.java
+ojluni/src/main/java/java/time/chrono/JapaneseDate.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/JapaneseDate.java
+ojluni/src/main/java/java/time/chrono/JapaneseEra.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/JapaneseEra.java
+ojluni/src/main/java/java/time/chrono/MinguoChronology.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/MinguoChronology.java
+ojluni/src/main/java/java/time/chrono/MinguoDate.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/MinguoDate.java
+ojluni/src/main/java/java/time/chrono/MinguoEra.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/MinguoEra.java
ojluni/src/main/java/java/time/chrono/Ser.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/Ser.java
-ojluni/src/main/java/java/time/chrono/ThaiBuddhistChronology.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java
-ojluni/src/main/java/java/time/chrono/ThaiBuddhistDate.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/chrono/ThaiBuddhistDate.java
-ojluni/src/main/java/java/time/chrono/ThaiBuddhistEra.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/chrono/ThaiBuddhistEra.java
-ojluni/src/main/java/java/time/chrono/package-info.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/chrono/package-info.java
-ojluni/src/main/java/java/time/format/DateTimeFormatter.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/format/DateTimeFormatter.java
-ojluni/src/main/java/java/time/format/DateTimeFormatterBuilder.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/format/DateTimeFormatterBuilder.java
-ojluni/src/main/java/java/time/format/DateTimeParseContext.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/format/DateTimeParseContext.java
+ojluni/src/main/java/java/time/chrono/ThaiBuddhistChronology.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/ThaiBuddhistChronology.java
+ojluni/src/main/java/java/time/chrono/ThaiBuddhistDate.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/ThaiBuddhistDate.java
+ojluni/src/main/java/java/time/chrono/ThaiBuddhistEra.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/ThaiBuddhistEra.java
+ojluni/src/main/java/java/time/chrono/package-info.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/package-info.java
+ojluni/src/main/java/java/time/format/DateTimeFormatter.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/format/DateTimeFormatter.java
+ojluni/src/main/java/java/time/format/DateTimeFormatterBuilder.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java
+ojluni/src/main/java/java/time/format/DateTimeParseContext.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/format/DateTimeParseContext.java
ojluni/src/main/java/java/time/format/DateTimeParseException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/format/DateTimeParseException.java
-ojluni/src/main/java/java/time/format/DateTimePrintContext.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/format/DateTimePrintContext.java
-ojluni/src/main/java/java/time/format/DateTimeTextProvider.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/format/DateTimeTextProvider.java
-ojluni/src/main/java/java/time/format/DecimalStyle.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/format/DecimalStyle.java
+ojluni/src/main/java/java/time/format/DateTimePrintContext.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/format/DateTimePrintContext.java
+ojluni/src/main/java/java/time/format/DateTimeTextProvider.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/format/DateTimeTextProvider.java
+ojluni/src/main/java/java/time/format/DecimalStyle.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/format/DecimalStyle.java
ojluni/src/main/java/java/time/format/FormatStyle.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/format/FormatStyle.java
-ojluni/src/main/java/java/time/format/Parsed.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/format/Parsed.java
+ojluni/src/main/java/java/time/format/Parsed.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/format/Parsed.java
ojluni/src/main/java/java/time/format/ResolverStyle.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/format/ResolverStyle.java
ojluni/src/main/java/java/time/format/SignStyle.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/format/SignStyle.java
ojluni/src/main/java/java/time/format/TextStyle.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/format/TextStyle.java
-ojluni/src/main/java/java/time/format/ZoneName.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/format/ZoneName.java
-ojluni/src/main/java/java/time/format/package-info.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/format/package-info.java
-ojluni/src/main/java/java/time/package-info.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/package-info.java
-ojluni/src/main/java/java/time/temporal/ChronoField.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/temporal/ChronoField.java
+ojluni/src/main/java/java/time/format/ZoneName.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/format/ZoneName.java.template
+ojluni/src/main/java/java/time/format/package-info.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/format/package-info.java
+ojluni/src/main/java/java/time/package-info.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/package-info.java
+ojluni/src/main/java/java/time/temporal/ChronoField.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/temporal/ChronoField.java
ojluni/src/main/java/java/time/temporal/ChronoUnit.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/temporal/ChronoUnit.java
-ojluni/src/main/java/java/time/temporal/IsoFields.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/temporal/IsoFields.java
+ojluni/src/main/java/java/time/temporal/IsoFields.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/temporal/IsoFields.java
ojluni/src/main/java/java/time/temporal/JulianFields.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/temporal/JulianFields.java
ojluni/src/main/java/java/time/temporal/Temporal.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/temporal/Temporal.java
ojluni/src/main/java/java/time/temporal/TemporalAccessor.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/temporal/TemporalAccessor.java
@@ -831,21 +833,21 @@
ojluni/src/main/java/java/time/temporal/TemporalAdjusters.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/temporal/TemporalAdjusters.java
ojluni/src/main/java/java/time/temporal/TemporalAmount.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/temporal/TemporalAmount.java
ojluni/src/main/java/java/time/temporal/TemporalField.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/temporal/TemporalField.java
-ojluni/src/main/java/java/time/temporal/TemporalQueries.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/temporal/TemporalQueries.java
+ojluni/src/main/java/java/time/temporal/TemporalQueries.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/temporal/TemporalQueries.java
ojluni/src/main/java/java/time/temporal/TemporalQuery.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/temporal/TemporalQuery.java
ojluni/src/main/java/java/time/temporal/TemporalUnit.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/temporal/TemporalUnit.java
ojluni/src/main/java/java/time/temporal/UnsupportedTemporalTypeException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/temporal/UnsupportedTemporalTypeException.java
ojluni/src/main/java/java/time/temporal/ValueRange.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/temporal/ValueRange.java
-ojluni/src/main/java/java/time/temporal/WeekFields.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/temporal/WeekFields.java
+ojluni/src/main/java/java/time/temporal/WeekFields.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/temporal/WeekFields.java
ojluni/src/main/java/java/time/temporal/package-info.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/temporal/package-info.java
# java.time.zone.IcuZoneRulesProvider doesn't come from the upstream OpenJDK.
-ojluni/src/main/java/java/time/zone/Ser.java,jdk11u/jdk-11+28,src/java.base/share/classes/java/time/zone/Ser.java
-ojluni/src/main/java/java/time/zone/ZoneOffsetTransition.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/zone/ZoneOffsetTransition.java
-ojluni/src/main/java/java/time/zone/ZoneOffsetTransitionRule.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/zone/ZoneOffsetTransitionRule.java
-ojluni/src/main/java/java/time/zone/ZoneRules.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/zone/ZoneRules.java
+ojluni/src/main/java/java/time/zone/Ser.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/zone/Ser.java
+ojluni/src/main/java/java/time/zone/ZoneOffsetTransition.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/zone/ZoneOffsetTransition.java
+ojluni/src/main/java/java/time/zone/ZoneOffsetTransitionRule.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/zone/ZoneOffsetTransitionRule.java
+ojluni/src/main/java/java/time/zone/ZoneRules.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/zone/ZoneRules.java
ojluni/src/main/java/java/time/zone/ZoneRulesException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/zone/ZoneRulesException.java
-ojluni/src/main/java/java/time/zone/ZoneRulesProvider.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/zone/ZoneRulesProvider.java
-ojluni/src/main/java/java/time/zone/package-info.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/time/zone/package-info.java
+ojluni/src/main/java/java/time/zone/ZoneRulesProvider.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/zone/ZoneRulesProvider.java
+ojluni/src/main/java/java/time/zone/package-info.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/zone/package-info.java
ojluni/src/main/java/java/util/AbstractCollection.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/AbstractCollection.java
ojluni/src/main/java/java/util/AbstractList.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/AbstractList.java
ojluni/src/main/java/java/util/AbstractMap.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/AbstractMap.java
@@ -875,7 +877,7 @@
ojluni/src/main/java/java/util/DuplicateFormatFlagsException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/DuplicateFormatFlagsException.java
ojluni/src/main/java/java/util/EmptyStackException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/EmptyStackException.java
ojluni/src/main/java/java/util/EnumMap.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/EnumMap.java
-ojluni/src/main/java/java/util/EnumSet.java,jdk11u/jdk-11+28,src/java.base/share/classes/java/util/EnumSet.java
+ojluni/src/main/java/java/util/EnumSet.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/EnumSet.java
ojluni/src/main/java/java/util/Enumeration.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/Enumeration.java
ojluni/src/main/java/java/util/EventListener.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/EventListener.java
ojluni/src/main/java/java/util/EventListenerProxy.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/EventListenerProxy.java
@@ -897,12 +899,12 @@
ojluni/src/main/java/java/util/IllegalFormatPrecisionException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/IllegalFormatPrecisionException.java
ojluni/src/main/java/java/util/IllegalFormatWidthException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/IllegalFormatWidthException.java
ojluni/src/main/java/java/util/IllformedLocaleException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/IllformedLocaleException.java
-ojluni/src/main/java/java/util/ImmutableCollections.java,jdk11u/jdk-11+28,src/java.base/share/classes/java/util/ImmutableCollections.java
+ojluni/src/main/java/java/util/ImmutableCollections.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/ImmutableCollections.java
ojluni/src/main/java/java/util/InputMismatchException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/InputMismatchException.java
ojluni/src/main/java/java/util/IntSummaryStatistics.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/IntSummaryStatistics.java
ojluni/src/main/java/java/util/InvalidPropertiesFormatException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/InvalidPropertiesFormatException.java
ojluni/src/main/java/java/util/Iterator.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/Iterator.java
-ojluni/src/main/java/java/util/JapaneseImperialCalendar.java,jdk11u/jdk-11+28,src/java.base/share/classes/java/util/JapaneseImperialCalendar.java
+ojluni/src/main/java/java/util/JapaneseImperialCalendar.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/JapaneseImperialCalendar.java
ojluni/src/main/java/java/util/JumboEnumSet.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/JumboEnumSet.java
ojluni/src/main/java/java/util/KeyValueHolder.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/KeyValueHolder.java
ojluni/src/main/java/java/util/LinkedHashMap.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/LinkedHashMap.java
@@ -917,8 +919,8 @@
ojluni/src/main/java/java/util/MissingFormatArgumentException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/MissingFormatArgumentException.java
ojluni/src/main/java/java/util/MissingFormatWidthException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/MissingFormatWidthException.java
ojluni/src/main/java/java/util/MissingResourceException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/MissingResourceException.java
-ojluni/src/main/java/java/util/NavigableMap.java,jdk9/jdk-9+113,jdk/src/java.base/share/classes/java/util/NavigableMap.java
-ojluni/src/main/java/java/util/NavigableSet.java,jdk9/jdk-9+113,jdk/src/java.base/share/classes/java/util/NavigableSet.java
+ojluni/src/main/java/java/util/NavigableMap.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/NavigableMap.java
+ojluni/src/main/java/java/util/NavigableSet.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/NavigableSet.java
ojluni/src/main/java/java/util/NoSuchElementException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/NoSuchElementException.java
ojluni/src/main/java/java/util/Objects.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/Objects.java
ojluni/src/main/java/java/util/Observable.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/Observable.java
@@ -1017,6 +1019,7 @@
ojluni/src/main/java/java/util/concurrent/ScheduledFuture.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/concurrent/ScheduledFuture.java
ojluni/src/main/java/java/util/concurrent/ScheduledThreadPoolExecutor.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java
ojluni/src/main/java/java/util/concurrent/Semaphore.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/concurrent/Semaphore.java
+ojluni/src/main/java/java/util/concurrent/SubmissionPublisher.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java
ojluni/src/main/java/java/util/concurrent/SynchronousQueue.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/concurrent/SynchronousQueue.java
ojluni/src/main/java/java/util/concurrent/ThreadFactory.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/concurrent/ThreadFactory.java
ojluni/src/main/java/java/util/concurrent/ThreadLocalRandom.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java
@@ -1052,6 +1055,8 @@
ojluni/src/main/java/java/util/concurrent/locks/ReentrantLock.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/concurrent/locks/ReentrantLock.java
ojluni/src/main/java/java/util/concurrent/locks/ReentrantReadWriteLock.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java
ojluni/src/main/java/java/util/concurrent/locks/StampedLock.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/concurrent/locks/StampedLock.java
+ojluni/src/main/java/java/util/concurrent/locks/package-info.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/concurrent/locks/package-info.java
+ojluni/src/main/java/java/util/concurrent/package-info.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/concurrent/package-info.java
ojluni/src/main/java/java/util/function/BiConsumer.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/function/BiConsumer.java
ojluni/src/main/java/java/util/function/BiFunction.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/function/BiFunction.java
ojluni/src/main/java/java/util/function/BiPredicate.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/function/BiPredicate.java
@@ -1147,7 +1152,7 @@
ojluni/src/main/java/java/util/stream/AbstractTask.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/util/stream/AbstractTask.java
ojluni/src/main/java/java/util/stream/BaseStream.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/stream/BaseStream.java
ojluni/src/main/java/java/util/stream/Collector.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/util/stream/Collector.java
-ojluni/src/main/java/java/util/stream/Collectors.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/java/util/stream/Collectors.java
+ojluni/src/main/java/java/util/stream/Collectors.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/stream/Collectors.java
ojluni/src/main/java/java/util/stream/DistinctOps.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/util/stream/DistinctOps.java
ojluni/src/main/java/java/util/stream/DoublePipeline.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/util/stream/DoublePipeline.java
ojluni/src/main/java/java/util/stream/DoubleStream.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/java/util/stream/DoubleStream.java
@@ -1244,10 +1249,10 @@
ojluni/src/main/java/javax/crypto/spec/DHParameterSpec.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/javax/crypto/spec/DHParameterSpec.java
ojluni/src/main/java/javax/crypto/spec/DHPrivateKeySpec.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/javax/crypto/spec/DHPrivateKeySpec.java
ojluni/src/main/java/javax/crypto/spec/DHPublicKeySpec.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/javax/crypto/spec/DHPublicKeySpec.java
-ojluni/src/main/java/javax/crypto/spec/GCMParameterSpec.java,jdk11u/jdk-11+28,src/java.base/share/classes/javax/crypto/spec/GCMParameterSpec.java
-ojluni/src/main/java/javax/crypto/spec/IvParameterSpec.java,jdk11u/jdk-11+28,src/java.base/share/classes/javax/crypto/spec/IvParameterSpec.java
+ojluni/src/main/java/javax/crypto/spec/GCMParameterSpec.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/javax/crypto/spec/GCMParameterSpec.java
+ojluni/src/main/java/javax/crypto/spec/IvParameterSpec.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/javax/crypto/spec/IvParameterSpec.java
ojluni/src/main/java/javax/crypto/spec/OAEPParameterSpec.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/javax/crypto/spec/OAEPParameterSpec.java
-ojluni/src/main/java/javax/crypto/spec/PBEKeySpec.java,jdk11u/jdk-11+28,src/java.base/share/classes/javax/crypto/spec/PBEKeySpec.java
+ojluni/src/main/java/javax/crypto/spec/PBEKeySpec.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/javax/crypto/spec/PBEKeySpec.java
ojluni/src/main/java/javax/crypto/spec/PBEParameterSpec.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/javax/crypto/spec/PBEParameterSpec.java
ojluni/src/main/java/javax/crypto/spec/PSource.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/javax/crypto/spec/PSource.java
ojluni/src/main/java/javax/crypto/spec/RC2ParameterSpec.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/javax/crypto/spec/RC2ParameterSpec.java
@@ -1285,7 +1290,7 @@
ojluni/src/main/java/javax/net/ssl/SSLSession.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/javax/net/ssl/SSLSession.java
ojluni/src/main/java/javax/net/ssl/SSLSessionBindingEvent.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/javax/net/ssl/SSLSessionBindingEvent.java
ojluni/src/main/java/javax/net/ssl/SSLSessionBindingListener.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/javax/net/ssl/SSLSessionBindingListener.java
-ojluni/src/main/java/javax/net/ssl/SSLSessionContext.java,jdk11u/jdk-11+28,src/java.base/share/classes/javax/net/ssl/SSLSessionContext.java
+ojluni/src/main/java/javax/net/ssl/SSLSessionContext.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/javax/net/ssl/SSLSessionContext.java
ojluni/src/main/java/javax/net/ssl/SSLSocket.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/javax/net/ssl/SSLSocket.java
ojluni/src/main/java/javax/net/ssl/SSLSocketFactory.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/javax/net/ssl/SSLSocketFactory.java
ojluni/src/main/java/javax/net/ssl/StandardConstants.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/javax/net/ssl/StandardConstants.java
@@ -1341,20 +1346,26 @@
ojluni/src/main/java/jdk/internal/math/FloatConsts.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/jdk/internal/math/FloatConsts.java
ojluni/src/main/java/jdk/internal/math/FloatingDecimal.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/jdk/internal/math/FloatingDecimal.java
ojluni/src/main/java/jdk/internal/math/FormattedFloatingDecimal.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/jdk/internal/math/FormattedFloatingDecimal.java
+ojluni/src/main/java/jdk/internal/misc/InnocuousThread.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/jdk/internal/misc/InnocuousThread.java
ojluni/src/main/java/jdk/internal/misc/JavaIOFileDescriptorAccess.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/jdk/internal/misc/JavaIOFileDescriptorAccess.java
ojluni/src/main/java/jdk/internal/misc/JavaObjectInputStreamAccess.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/jdk/internal/misc/JavaObjectInputStreamAccess.java
-ojluni/src/main/java/jdk/internal/misc/SharedSecrets.java,jdk11u/jdk-11+28,src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java
-ojluni/src/main/java/jdk/internal/misc/Unsafe.java,jdk11u/jdk-11+28,src/java.base/share/classes/jdk/internal/misc/Unsafe.java
-ojluni/src/main/java/jdk/internal/misc/VM.java,jdk11u/jdk-11+28,src/java.base/share/classes/jdk/internal/misc/VM.java
+ojluni/src/main/java/jdk/internal/misc/SharedSecrets.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java
+ojluni/src/main/java/jdk/internal/misc/Unsafe.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/jdk/internal/misc/Unsafe.java
+ojluni/src/main/java/jdk/internal/misc/VM.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/jdk/internal/misc/VM.java
+ojluni/src/main/java/jdk/internal/ref/Cleaner.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/jdk/internal/ref/Cleaner.java
+ojluni/src/main/java/jdk/internal/ref/CleanerFactory.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/jdk/internal/ref/CleanerFactory.java
+ojluni/src/main/java/jdk/internal/ref/CleanerImpl.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/jdk/internal/ref/CleanerImpl.java
+ojluni/src/main/java/jdk/internal/ref/PhantomCleanable.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java
ojluni/src/main/java/jdk/internal/reflect/CallerSensitive.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/jdk/internal/reflect/CallerSensitive.java
ojluni/src/main/java/jdk/internal/reflect/Reflection.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/jdk/internal/reflect/Reflection.java
-ojluni/src/main/java/jdk/internal/util/Preconditions.java,jdk11u/jdk-11+28,src/java.base/share/classes/jdk/internal/util/Preconditions.java
+ojluni/src/main/java/jdk/internal/util/ArraysSupport.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/jdk/internal/util/ArraysSupport.java
+ojluni/src/main/java/jdk/internal/util/Preconditions.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/jdk/internal/util/Preconditions.java
ojluni/src/main/java/jdk/internal/vm/annotation/Contended.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/jdk/internal/vm/annotation/Contended.java
ojluni/src/main/java/jdk/internal/vm/annotation/ReservedStackAccess.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/jdk/internal/vm/annotation/ReservedStackAccess.java
ojluni/src/main/java/jdk/internal/vm/annotation/Stable.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/jdk/internal/vm/annotation/Stable.java
-ojluni/src/main/java/jdk/net/ExtendedSocketOptions.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/jdk/net/ExtendedSocketOptions.java
+ojluni/src/main/java/jdk/net/ExtendedSocketOptions.java,jdk11u/jdk-11.0.13-ga,src/jdk.net/share/classes/jdk/net/ExtendedSocketOptions.java
ojluni/src/main/java/jdk/net/NetworkPermission.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/jdk/net/NetworkPermission.java
-ojluni/src/main/java/jdk/net/SocketFlow.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/jdk/net/SocketFlow.java
+ojluni/src/main/java/jdk/net/SocketFlow.java,jdk11u/jdk-11.0.13-ga,src/jdk.net/share/classes/jdk/net/SocketFlow.java
ojluni/src/main/java/jdk/net/Sockets.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/jdk/net/Sockets.java
ojluni/src/main/java/sun/invoke/util/BytecodeDescriptor.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/invoke/util/BytecodeDescriptor.java
ojluni/src/main/java/sun/invoke/util/VerifyAccess.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/invoke/util/VerifyAccess.java
@@ -1403,6 +1414,7 @@
ojluni/src/main/java/sun/net/TelnetInputStream.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/net/TelnetInputStream.java
ojluni/src/main/java/sun/net/TelnetOutputStream.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/net/TelnetOutputStream.java
ojluni/src/main/java/sun/net/TelnetProtocolException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/net/TelnetProtocolException.java
+ojluni/src/main/java/sun/net/ext/ExtendedSocketOptions.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/net/ext/ExtendedSocketOptions.java
ojluni/src/main/java/sun/net/ftp/FtpClient.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/net/ftp/FtpClient.java
ojluni/src/main/java/sun/net/ftp/FtpClientProvider.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/net/ftp/FtpClientProvider.java
ojluni/src/main/java/sun/net/ftp/FtpDirEntry.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/net/ftp/FtpDirEntry.java
@@ -1431,13 +1443,13 @@
ojluni/src/main/java/sun/nio/ByteBuffered.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/ByteBuffered.java
ojluni/src/main/java/sun/nio/ch/AbstractPollArrayWrapper.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/ch/AbstractPollArrayWrapper.java
ojluni/src/main/java/sun/nio/ch/AbstractPollSelectorImpl.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/ch/AbstractPollSelectorImpl.java
-ojluni/src/main/java/sun/nio/ch/AllocatedNativeObject.java,jdk11u/jdk-11+28,jdk/src/share/classes/sun/nio/ch/AllocatedNativeObject.java
+ojluni/src/main/java/sun/nio/ch/AllocatedNativeObject.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/nio/ch/AllocatedNativeObject.java
ojluni/src/main/java/sun/nio/ch/AsynchronousChannelGroupImpl.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/ch/AsynchronousChannelGroupImpl.java
ojluni/src/main/java/sun/nio/ch/AsynchronousFileChannelImpl.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/ch/AsynchronousFileChannelImpl.java
ojluni/src/main/java/sun/nio/ch/AsynchronousServerSocketChannelImpl.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/ch/AsynchronousServerSocketChannelImpl.java
ojluni/src/main/java/sun/nio/ch/AsynchronousSocketChannelImpl.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java
ojluni/src/main/java/sun/nio/ch/Cancellable.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/nio/ch/Cancellable.java
-ojluni/src/main/java/sun/nio/ch/ChannelInputStream.java,jdk11u/jdk-11+28,src/java.base/share/classes/sun/nio/ch/ChannelInputStream.java
+ojluni/src/main/java/sun/nio/ch/ChannelInputStream.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/nio/ch/ChannelInputStream.java
ojluni/src/main/java/sun/nio/ch/CompletedFuture.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/nio/ch/CompletedFuture.java
ojluni/src/main/java/sun/nio/ch/DatagramChannelImpl.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
ojluni/src/main/java/sun/nio/ch/DatagramDispatcher.java,jdk11u/jdk-11.0.13-ga,src/java.base/unix/classes/sun/nio/ch/DatagramDispatcher.java
@@ -1452,18 +1464,18 @@
# sun.nio.ch.FileDescriptorHolderSocketImpl doesn’t come from the upstream OpenJDK.
ojluni/src/main/java/sun/nio/ch/FileDispatcher.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/ch/FileDispatcher.java
ojluni/src/main/java/sun/nio/ch/FileDispatcherImpl.java,jdk8u/jdk8u121-b13,jdk/src/solaris/classes/sun/nio/ch/FileDispatcherImpl.java
-ojluni/src/main/java/sun/nio/ch/FileKey.java,jdk11u/jdk-11+28,src/java.base/unix/classes/sun/nio/ch/FileKey.java
-ojluni/src/main/java/sun/nio/ch/FileLockImpl.java,jdk11u/jdk-11+28,jdk/src/share/classes/sun/nio/ch/FileLockImpl.java
+ojluni/src/main/java/sun/nio/ch/FileKey.java,jdk11u/jdk-11.0.13-ga,src/java.base/unix/classes/sun/nio/ch/FileKey.java
+ojluni/src/main/java/sun/nio/ch/FileLockImpl.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/nio/ch/FileLockImpl.java
ojluni/src/main/java/sun/nio/ch/FileLockTable.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/ch/FileLockTable.java
ojluni/src/main/java/sun/nio/ch/Groupable.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/nio/ch/Groupable.java
ojluni/src/main/java/sun/nio/ch/IOStatus.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/nio/ch/IOStatus.java
ojluni/src/main/java/sun/nio/ch/IOUtil.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/ch/IOUtil.java
ojluni/src/main/java/sun/nio/ch/IOVecWrapper.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/ch/IOVecWrapper.java
ojluni/src/main/java/sun/nio/ch/Interruptible.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/nio/ch/Interruptible.java
-ojluni/src/main/java/sun/nio/ch/Invoker.java,jdk11u/jdk-11+28,jdk/src/share/classes/sun/nio/ch/Invoker.java
+ojluni/src/main/java/sun/nio/ch/Invoker.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/nio/ch/Invoker.java
ojluni/src/main/java/sun/nio/ch/LinuxAsynchronousChannelProvider.java,jdk11u/jdk-11.0.13-ga,src/java.base/linux/classes/sun/nio/ch/LinuxAsynchronousChannelProvider.java
-ojluni/src/main/java/sun/nio/ch/MembershipKeyImpl.java,jdk11u/jdk-11+28,jdk/src/share/classes/sun/nio/ch/MembershipKeyImpl.java
-ojluni/src/main/java/sun/nio/ch/MembershipRegistry.java,jdk11u/jdk-11+28,jdk/src/share/classes/sun/nio/ch/MembershipRegistry.java
+ojluni/src/main/java/sun/nio/ch/MembershipKeyImpl.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/nio/ch/MembershipKeyImpl.java
+ojluni/src/main/java/sun/nio/ch/MembershipRegistry.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/nio/ch/MembershipRegistry.java
ojluni/src/main/java/sun/nio/ch/NativeDispatcher.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/nio/ch/NativeDispatcher.java
ojluni/src/main/java/sun/nio/ch/NativeObject.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/ch/NativeObject.java
ojluni/src/main/java/sun/nio/ch/NativeThread.java,jdk11u/jdk-11.0.13-ga,src/java.base/unix/classes/sun/nio/ch/NativeThread.java
@@ -1471,10 +1483,10 @@
ojluni/src/main/java/sun/nio/ch/Net.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/ch/Net.java
ojluni/src/main/java/sun/nio/ch/OptionKey.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/nio/ch/OptionKey.java
ojluni/src/main/java/sun/nio/ch/PendingFuture.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/ch/PendingFuture.java
-ojluni/src/main/java/sun/nio/ch/PipeImpl.java,jdk11u/jdk-11+28,jdk/src/solaris/classes/sun/nio/ch/PipeImpl.java
+ojluni/src/main/java/sun/nio/ch/PipeImpl.java,jdk11u/jdk-11.0.13-ga,src/java.base/unix/classes/sun/nio/ch/PipeImpl.java
ojluni/src/main/java/sun/nio/ch/PollArrayWrapper.java,jdk8u/jdk8u121-b13,jdk/src/solaris/classes/sun/nio/ch/PollArrayWrapper.java
ojluni/src/main/java/sun/nio/ch/PollSelectorImpl.java,jdk8u/jdk8u121-b13,jdk/src/solaris/classes/sun/nio/ch/PollSelectorImpl.java
-ojluni/src/main/java/sun/nio/ch/PollSelectorProvider.java,jdk11u/jdk-11+28,jdk/src/share/classes/sun/nio/ch/PollSelectorProvider.java
+ojluni/src/main/java/sun/nio/ch/PollSelectorProvider.java,jdk11u/jdk-11.0.13-ga,src/java.base/unix/classes/sun/nio/ch/PollSelectorProvider.java
ojluni/src/main/java/sun/nio/ch/Port.java,jdk11u/jdk-11.0.13-ga,src/java.base/unix/classes/sun/nio/ch/Port.java
ojluni/src/main/java/sun/nio/ch/SelChImpl.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/ch/SelChImpl.java
ojluni/src/main/java/sun/nio/ch/SelectionKeyImpl.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/ch/SelectionKeyImpl.java
@@ -1489,10 +1501,10 @@
ojluni/src/main/java/sun/nio/ch/SocketDispatcher.java,jdk8u/jdk8u121-b13,jdk/src/solaris/classes/sun/nio/ch/SocketDispatcher.java
# sun.nio.ch.SocketOptionRegistry was generated by C code and Make file in 8u121-b13. In the future, we can map this file to
# src/java.base/share/classes/sun/nio/ch/SocketOptionRegistry.java.template when the file is upgraded to OpenJDK 11
-# ojluni/src/main/java/sun/nio/ch/SocketOptionRegistry.java,jdk11u/jdk-11+28,src/java.base/share/classes/sun/nio/ch/SocketOptionRegistry.java.template
+# ojluni/src/main/java/sun/nio/ch/SocketOptionRegistry.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/nio/ch/SocketOptionRegistry.java.template
ojluni/src/main/java/sun/nio/ch/SourceChannelImpl.java,jdk8u/jdk8u121-b13,jdk/src/solaris/classes/sun/nio/ch/SourceChannelImpl.java
ojluni/src/main/java/sun/nio/ch/ThreadPool.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/ch/ThreadPool.java
-ojluni/src/main/java/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java,jdk11u/jdk-11+28,jdk/src/solaris/classes/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java
+ojluni/src/main/java/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java,jdk11u/jdk-11.0.13-ga,src/java.base/unix/classes/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java
ojluni/src/main/java/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java,jdk8u/jdk8u121-b13,jdk/src/solaris/classes/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java
ojluni/src/main/java/sun/nio/ch/Util.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/ch/Util.java
ojluni/src/main/java/sun/nio/cs/ArrayDecoder.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/cs/ArrayDecoder.java
@@ -1506,7 +1518,7 @@
ojluni/src/main/java/sun/nio/fs/AbstractFileTypeDetector.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/fs/AbstractFileTypeDetector.java
ojluni/src/main/java/sun/nio/fs/AbstractPath.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/fs/AbstractPath.java
ojluni/src/main/java/sun/nio/fs/AbstractPoller.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/fs/AbstractPoller.java
-ojluni/src/main/java/sun/nio/fs/AbstractUserDefinedFileAttributeView.java,jdk11u/jdk-11+28,src/java.base/share/classes/sun/nio/fs/AbstractUserDefinedFileAttributeView.java
+ojluni/src/main/java/sun/nio/fs/AbstractUserDefinedFileAttributeView.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/nio/fs/AbstractUserDefinedFileAttributeView.java
ojluni/src/main/java/sun/nio/fs/AbstractWatchKey.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/nio/fs/AbstractWatchKey.java
ojluni/src/main/java/sun/nio/fs/AbstractWatchService.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/nio/fs/AbstractWatchService.java
ojluni/src/main/java/sun/nio/fs/BasicFileAttributesHolder.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/nio/fs/BasicFileAttributesHolder.java
@@ -1530,7 +1542,7 @@
ojluni/src/main/java/sun/nio/fs/UnixChannelFactory.java,jdk8u/jdk8u121-b13,jdk/src/solaris/classes/sun/nio/fs/UnixChannelFactory.java
# sun.nio.fs.UnixConstants was generated by C code and Make-like file in jdk8u/jdk8u121. But in a later version, the file
# is generated by a template file, and we can map to the template when the file is upgraded to OpenJDK 11.
-# ojluni/src/main/java/sun/nio/fs/UnixConstants.java,jdk11u/jdk-11+28,src/java.base/unix/classes/sun/nio/fs/UnixConstants.java.template
+# ojluni/src/main/java/sun/nio/fs/UnixConstants.java,jdk11u/jdk-11.0.13-ga,src/java.base/unix/classes/sun/nio/fs/UnixConstants.java.template
ojluni/src/main/java/sun/nio/fs/UnixCopyFile.java,jdk8u/jdk8u121-b13,jdk/src/solaris/classes/sun/nio/fs/UnixCopyFile.java
ojluni/src/main/java/sun/nio/fs/UnixDirectoryStream.java,jdk8u/jdk8u121-b13,jdk/src/solaris/classes/sun/nio/fs/UnixDirectoryStream.java
ojluni/src/main/java/sun/nio/fs/UnixException.java,jdk8u/jdk8u121-b13,jdk/src/solaris/classes/sun/nio/fs/UnixException.java
@@ -1571,7 +1583,7 @@
ojluni/src/main/java/sun/security/pkcs/SigningCertificateInfo.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/security/pkcs/SigningCertificateInfo.java
# CertPathProvider was introduced in bf0403930ae8d1e86b3914d18b9711eeeec0adb9. Apparently, it came from SunEntries in the upstream.
# CertPathProvider implemented only some of SunEntries because Android kept CertPathBuilder and CertPathValidator providers.
-ojluni/src/main/java/sun/security/provider/CertPathProvider.java,jdk8u/jdk8u60-b31,jdk/src/share/classes/sun/security/provider/SunEntries.java
+ojluni/src/main/java/sun/security/provider/CertPathProvider.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/security/provider/SunEntries.java
ojluni/src/main/java/sun/security/provider/X509Factory.java,jdk8u/jdk8u60-b31,jdk/src/share/classes/sun/security/provider/X509Factory.java
ojluni/src/main/java/sun/security/provider/certpath/AdaptableX509CertSelector.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/security/provider/certpath/AdaptableX509CertSelector.java
ojluni/src/main/java/sun/security/provider/certpath/AdjacencyList.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/security/provider/certpath/AdjacencyList.java
@@ -1604,6 +1616,7 @@
ojluni/src/main/java/sun/security/provider/certpath/Vertex.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/security/provider/certpath/Vertex.java
ojluni/src/main/java/sun/security/provider/certpath/X509CertPath.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/security/provider/certpath/X509CertPath.java
ojluni/src/main/java/sun/security/provider/certpath/X509CertificatePair.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/security/provider/certpath/X509CertificatePair.java
+ojluni/src/main/java/sun/security/timestamp/TimestampToken.java,jdk8u/jdk8u60-b31,jdk/src/share/classes/sun/security/timestamp/TimestampToken.java
ojluni/src/main/java/sun/security/util/AbstractAlgorithmConstraints.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/security/util/AbstractAlgorithmConstraints.java
ojluni/src/main/java/sun/security/util/AlgorithmDecomposer.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/security/util/AlgorithmDecomposer.java
ojluni/src/main/java/sun/security/util/AnchorCertificates.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/security/util/AnchorCertificates.java
@@ -1628,7 +1641,7 @@
ojluni/src/main/java/sun/security/util/PropertyExpander.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/security/util/PropertyExpander.java
ojluni/src/main/java/sun/security/util/Resources.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/security/util/Resources.java
ojluni/src/main/java/sun/security/util/ResourcesMgr.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/security/util/ResourcesMgr.java
-ojluni/src/main/java/sun/security/util/SecurityConstants.java,jdk11u/jdk-11.0.13-ga,jdk/src/share/classes/sun/security/util/SecurityConstants.java
+ojluni/src/main/java/sun/security/util/SecurityConstants.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/security/util/SecurityConstants.java
ojluni/src/main/java/sun/security/util/SignatureFileVerifier.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/security/util/SignatureFileVerifier.java
ojluni/src/main/java/sun/security/x509/AVA.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/security/x509/AVA.java
ojluni/src/main/java/sun/security/x509/AccessDescription.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/security/x509/AccessDescription.java
@@ -1677,7 +1690,7 @@
ojluni/src/main/java/sun/security/x509/KeyUsageExtension.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/security/x509/KeyUsageExtension.java
ojluni/src/main/java/sun/security/x509/NameConstraintsExtension.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/security/x509/NameConstraintsExtension.java
ojluni/src/main/java/sun/security/x509/NetscapeCertTypeExtension.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/security/x509/NetscapeCertTypeExtension.java
-ojluni/src/main/java/sun/security/x509/OCSPNoCheckExtension.java,jdk11u/jdk-11+28,src/java.base/share/classes/sun/security/x509/OCSPNoCheckExtension.java
+ojluni/src/main/java/sun/security/x509/OCSPNoCheckExtension.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/security/x509/OCSPNoCheckExtension.java
ojluni/src/main/java/sun/security/x509/OIDMap.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/security/x509/OIDMap.java
ojluni/src/main/java/sun/security/x509/OIDName.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/security/x509/OIDName.java
ojluni/src/main/java/sun/security/x509/OtherName.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/security/x509/OtherName.java
@@ -1709,21 +1722,21 @@
ojluni/src/main/java/sun/util/calendar/CalendarDate.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/util/calendar/CalendarDate.java
ojluni/src/main/java/sun/util/calendar/CalendarSystem.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/util/calendar/CalendarSystem.java
ojluni/src/main/java/sun/util/calendar/CalendarUtils.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/util/calendar/CalendarUtils.java
-ojluni/src/main/java/sun/util/calendar/Era.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/util/calendar/Era.java
+ojluni/src/main/java/sun/util/calendar/Era.java,jdk8u/jdk8u212-b01,jdk/src/share/classes/sun/util/calendar/Era.java
ojluni/src/main/java/sun/util/calendar/Gregorian.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/util/calendar/Gregorian.java
ojluni/src/main/java/sun/util/calendar/ImmutableGregorianDate.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/util/calendar/ImmutableGregorianDate.java
ojluni/src/main/java/sun/util/calendar/JulianCalendar.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/util/calendar/JulianCalendar.java
ojluni/src/main/java/sun/util/calendar/LocalGregorianCalendar.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/util/calendar/LocalGregorianCalendar.java
ojluni/src/main/java/sun/util/locale/BaseLocale.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/util/locale/BaseLocale.java
ojluni/src/main/java/sun/util/locale/Extension.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/util/locale/Extension.java
-ojluni/src/main/java/sun/util/locale/InternalLocaleBuilder.java,jdk11u/jdk-11+28,src/java.base/share/classes/sun/util/locale/InternalLocaleBuilder.java
+ojluni/src/main/java/sun/util/locale/InternalLocaleBuilder.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/util/locale/InternalLocaleBuilder.java
ojluni/src/main/java/sun/util/locale/LanguageTag.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/util/locale/LanguageTag.java
ojluni/src/main/java/sun/util/locale/LocaleEquivalentMaps.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/util/locale/LocaleEquivalentMaps.java
ojluni/src/main/java/sun/util/locale/LocaleExtensions.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/util/locale/LocaleExtensions.java
ojluni/src/main/java/sun/util/locale/LocaleMatcher.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/util/locale/LocaleMatcher.java
ojluni/src/main/java/sun/util/locale/LocaleObjectCache.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/util/locale/LocaleObjectCache.java
ojluni/src/main/java/sun/util/locale/LocaleSyntaxException.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/util/locale/LocaleSyntaxException.java
-ojluni/src/main/java/sun/util/locale/LocaleUtils.java,jdk11u/jdk-11+28,src/java.base/share/classes/sun/util/locale/LocaleUtils.java
+ojluni/src/main/java/sun/util/locale/LocaleUtils.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/util/locale/LocaleUtils.java
ojluni/src/main/java/sun/util/locale/ParseStatus.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/util/locale/ParseStatus.java
ojluni/src/main/java/sun/util/locale/StringTokenIterator.java,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/sun/util/locale/StringTokenIterator.java
ojluni/src/main/java/sun/util/locale/UnicodeLocaleExtension.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/util/locale/UnicodeLocaleExtension.java
@@ -1732,47 +1745,47 @@
ojluni/src/main/java/sun/util/logging/LoggingSupport.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/util/logging/LoggingSupport.java
ojluni/src/main/java/sun/util/logging/PlatformLogger.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/util/logging/PlatformLogger.java
ojluni/src/main/java/sun/util/resources/OpenListResourceBundle.java,jdk8u/jdk8u121-b13,jdk/src/share/classes/sun/util/resources/OpenListResourceBundle.java
-ojluni/src/main/native/Adler32.c,jdk8u/jdk8u60-b31,jdk/src/share/native/java/util/zip/Adler32.c
-ojluni/src/main/native/CRC32.c,jdk8u/jdk8u60-b31,jdk/src/share/native/java/util/zip/CRC32.c
+ojluni/src/main/native/Adler32.c,jdk8u/jdk8u121-b13,jdk/src/share/native/java/util/zip/Adler32.c
+ojluni/src/main/native/CRC32.c,jdk8u/jdk8u121-b13,jdk/src/share/native/java/util/zip/CRC32.c
# Character.cpp doesn’t come from the upstream OpenJDK.
-ojluni/src/main/native/Console_md.c,jdk8u/jdk8u60-b31,jdk/src/solaris/native/java/io/Console_md.c
-ojluni/src/main/native/DatagramChannelImpl.c,jdk8u/jdk8u60-b31,jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
-ojluni/src/main/native/DatagramDispatcher.c,jdk8u/jdk8u60-b31,jdk/src/solaris/native/sun/nio/ch/DatagramDispatcher.c
+ojluni/src/main/native/Console_md.c,jdk8u/jdk8u121-b13,jdk/src/solaris/native/java/io/Console_md.c
+ojluni/src/main/native/DatagramChannelImpl.c,jdk8u/jdk8u121-b13,jdk/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c
+ojluni/src/main/native/DatagramDispatcher.c,jdk8u/jdk8u121-b13,jdk/src/solaris/native/sun/nio/ch/DatagramDispatcher.c
ojluni/src/main/native/Deflater.c,jdk8u/jdk8u60-b31,jdk/src/share/native/java/util/zip/Deflater.c
-ojluni/src/main/native/Double.c,jdk8u/jdk8u60-b31,jdk/src/share/native/java/lang/Double.c
-ojluni/src/main/native/EPoll.c,jdk8u/jdk8u60-b31,jdk/src/solaris/native/sun/nio/ch/EPoll.c
-ojluni/src/main/native/EPollPort.c,jdk8u/jdk8u60-b31,jdk/src/solaris/native/sun/nio/ch/EPollPort.c
-ojluni/src/main/native/FileChannelImpl.c,jdk8u/jdk8u60-b31,jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c
+ojluni/src/main/native/Double.c,jdk8u/jdk8u121-b13,jdk/src/share/native/java/lang/Double.c
+ojluni/src/main/native/EPoll.c,jdk8u/jdk8u121-b13,jdk/src/solaris/native/sun/nio/ch/EPoll.c
+ojluni/src/main/native/EPollPort.c,jdk8u/jdk8u121-b13,jdk/src/solaris/native/sun/nio/ch/EPollPort.c
+ojluni/src/main/native/FileChannelImpl.c,jdk8u/jdk8u121-b13,jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c
ojluni/src/main/native/FileDescriptor_md.c,jdk7u/jdk7u40-b60,jdk/src/solaris/native/java/io/FileDescriptor_md.c
-ojluni/src/main/native/FileDispatcherImpl.c,jdk8u/jdk8u60-b31,jdk/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c
+ojluni/src/main/native/FileDispatcherImpl.c,jdk8u/jdk8u121-b13,jdk/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c
ojluni/src/main/native/FileInputStream.c,jdk7u/jdk7u40-b60,jdk/src/share/native/java/io/FileInputStream.c
ojluni/src/main/native/FileKey.c,jdk7u/jdk7u40-b60,jdk/src/solaris/native/sun/nio/ch/FileKey.c
ojluni/src/main/native/FileSystemPreferences.c,jdk7u/jdk7u40-b60,jdk/src/solaris/native/java/util/FileSystemPreferences.c
-ojluni/src/main/native/Float.c,jdk8u/jdk8u60-b31,jdk/src/share/native/java/lang/Float.c
-ojluni/src/main/native/IOUtil.c,jdk8u/jdk8u60-b31,jdk/src/solaris/native/sun/nio/ch/IOUtil.c
+ojluni/src/main/native/Float.c,jdk8u/jdk8u121-b13,jdk/src/share/native/java/lang/Float.c
+ojluni/src/main/native/IOUtil.c,jdk8u/jdk8u121-b13,jdk/src/solaris/native/sun/nio/ch/IOUtil.c
ojluni/src/main/native/Inet4Address.c,jdk7u/jdk7u40-b60,jdk/src/share/native/java/net/Inet4Address.c
-ojluni/src/main/native/Inet6Address.c,jdk8u/jdk8u60-b31,jdk/src/share/native/java/net/Inet6Address.c
+ojluni/src/main/native/Inet6Address.c,jdk8u/jdk8u121-b13,jdk/src/share/native/java/net/Inet6Address.c
ojluni/src/main/native/InetAddress.c,jdk8u/jdk8u60-b31,jdk/src/share/native/java/net/InetAddress.c
ojluni/src/main/native/Inflater.c,jdk8u/jdk8u60-b31,jdk/src/share/native/java/util/zip/Inflater.c
# JniConstants.cpp doesn’t come from the upstream OpenJDK.
-ojluni/src/main/native/LinuxNativeDispatcher.c,jdk8u/jdk8u60-b31,jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c
-ojluni/src/main/native/LinuxWatchService.c,jdk8u/jdk8u60-b31,jdk/src/solaris/native/sun/nio/fs/LinuxWatchService.c
-ojluni/src/main/native/MappedByteBuffer.c,jdk8u/jdk8u60-b31,jdk/src/solaris/native/java/nio/MappedByteBuffer.c
+ojluni/src/main/native/LinuxNativeDispatcher.c,jdk8u/jdk8u121-b13,jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c
+ojluni/src/main/native/LinuxWatchService.c,jdk8u/jdk8u121-b13,jdk/src/solaris/native/sun/nio/fs/LinuxWatchService.c
+ojluni/src/main/native/MappedByteBuffer.c,jdk8u/jdk8u121-b13,jdk/src/solaris/native/java/nio/MappedByteBuffer.c
# Math.c doesn’t come from the upstream OpenJDK.
-ojluni/src/main/native/NativeThread.c,jdk8u/jdk8u60-b31,jdk/src/solaris/native/sun/nio/ch/NativeThread.c
-ojluni/src/main/native/Net.c,jdk8u/jdk8u60-b31,jdk/src/solaris/native/sun/nio/ch/Net.c
-ojluni/src/main/native/ObjectInputStream.c,jdk8u/jdk8u60-b31,jdk/src/share/native/java/io/ObjectInputStream.c
+ojluni/src/main/native/NativeThread.c,jdk8u/jdk8u121-b13,jdk/src/solaris/native/sun/nio/ch/NativeThread.c
+ojluni/src/main/native/Net.c,jdk8u/jdk8u121-b13,jdk/src/solaris/native/sun/nio/ch/Net.c
+ojluni/src/main/native/ObjectInputStream.c,jdk8u/jdk8u121-b13,jdk/src/share/native/java/io/ObjectInputStream.c
ojluni/src/main/native/ObjectOutputStream.c,jdk7u/jdk7u40-b60,jdk/src/share/native/java/io/ObjectOutputStream.c
-ojluni/src/main/native/ObjectStreamClass.c,jdk8u/jdk8u60-b31,jdk/src/share/native/java/io/ObjectStreamClass.c
+ojluni/src/main/native/ObjectStreamClass.c,jdk8u/jdk8u121-b13,jdk/src/share/native/java/io/ObjectStreamClass.c
# OnLoad.cpp doesn’t come from the upstream OpenJDK.
-ojluni/src/main/native/PollArrayWrapper.c,jdk8u/jdk8u60-b31,jdk/src/solaris/native/sun/nio/ch/PollArrayWrapper.c
+ojluni/src/main/native/PollArrayWrapper.c,jdk8u/jdk8u121-b13,jdk/src/solaris/native/sun/nio/ch/PollArrayWrapper.c
ojluni/src/main/native/ProcessEnvironment_md.c,jdk7u/jdk7u40-b60,jdk/src/solaris/native/java/lang/ProcessEnvironment_md.c
-ojluni/src/main/native/Runtime.c,jdk8u/jdk8u60-b31,jdk/src/share/native/java/lang/Runtime.c
-ojluni/src/main/native/ServerSocketChannelImpl.c,jdk8u/jdk8u60-b31,jdk/src/solaris/native/sun/nio/ch/ServerSocketChannelImpl.c
-ojluni/src/main/native/SocketChannelImpl.c,jdk8u/jdk8u60-b31,jdk/src/solaris/native/sun/nio/ch/SocketChannelImpl.c
+ojluni/src/main/native/Runtime.c,jdk8u/jdk8u121-b13,jdk/src/share/native/java/lang/Runtime.c
+ojluni/src/main/native/ServerSocketChannelImpl.c,jdk8u/jdk8u121-b13,jdk/src/solaris/native/sun/nio/ch/ServerSocketChannelImpl.c
+ojluni/src/main/native/SocketChannelImpl.c,jdk8u/jdk8u121-b13,jdk/src/solaris/native/sun/nio/ch/SocketChannelImpl.c
ojluni/src/main/native/SocketInputStream.c,jdk7u/jdk7u40-b60,jdk/src/solaris/native/java/net/SocketInputStream.c
ojluni/src/main/native/SocketOutputStream.c,jdk8u/jdk8u60-b31,jdk/src/solaris/native/java/net/SocketOutputStream.c
-ojluni/src/main/native/StrictMath.c,jdk8u/jdk8u60-b31,jdk/src/share/native/java/lang/StrictMath.c
+ojluni/src/main/native/StrictMath.c,jdk8u/jdk8u121-b13,jdk/src/share/native/java/lang/StrictMath.c
ojluni/src/main/native/System.c,jdk7u/jdk7u40-b60,jdk/src/share/native/java/lang/System.c
ojluni/src/main/native/UNIXProcess_md.c,jdk7u/jdk7u40-b60,jdk/src/solaris/native/java/lang/UNIXProcess_md.c
ojluni/src/main/native/UnixAsynchronousServerSocketChannelImpl.c,jdk8u/jdk8u121-b13,jdk/src/solaris/native/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.c
@@ -1791,8 +1804,10 @@
ojluni/src/main/native/net_util_md.c,jdk7u/jdk7u40-b60,jdk/src/solaris/native/java/net/net_util_md.c
# socket_tagger_util.cpp doesn’t come from the upstream OpenJDK.
ojluni/src/main/native/zip_util.c,jdk8u/jdk8u121-b13,jdk/src/share/native/java/util/zip/zip_util.c
+ojluni/src/main/resources/calendars.properties,jdk8u/jdk8u212-b01,jdk/src/share/lib/calendars.properties
+ojluni/src/main/resources/java/time/chrono/hijrah-config-islamic-umalqura.properties,jdk11u/jdk-11.0.13-ga,src/java.base/share/classes/java/time/chrono/hijrah-config-islamic-umalqura.properties
ojluni/src/test/java/io/Reader/NullReader.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/io/Reader/NullReader.java
-ojluni/src/test/java/io/Reader/TransferTo.java,jdk11u/jdk-11+28,test/jdk/java/io/Reader/TransferTo.java
+ojluni/src/test/java/io/Reader/TransferTo.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/io/Reader/TransferTo.java
ojluni/src/test/java/io/Writer/NullWriter.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/io/Writer/NullWriter.java
ojluni/src/test/java/lang/invoke/VarHandles/VarHandleBaseByteArrayTest.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/lang/invoke/VarHandles/VarHandleBaseByteArrayTest.java
ojluni/src/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/lang/invoke/VarHandles/VarHandleBaseTest.java
@@ -1843,9 +1858,9 @@
ojluni/src/test/java/lang/invoke/VarHandles/accessibility/pkg/subpkg/B_extends_A.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/lang/invoke/VarHandles/accessibility/pkg/subpkg/B_extends_A.java
ojluni/src/test/java/lang/invoke/VarHandles/accessibility/pkg/subpkg/C.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/lang/invoke/VarHandles/accessibility/pkg/subpkg/C.java
ojluni/src/test/java/lang/invoke/VarHandles/generate-vh-tests.sh,jdk11u/jdk-11.0.13-ga,test/jdk/java/lang/invoke/VarHandles/generate-vh-tests.sh
-ojluni/src/test/java/math/BigDecimal/AddTests.java,jdk11u/jdk-11+28,test/jdk/java/math/BigDecimal/AddTests.java
+ojluni/src/test/java/math/BigDecimal/AddTests.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/math/BigDecimal/AddTests.java
ojluni/src/test/java/math/BigDecimal/CompareToTests.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/math/BigDecimal/CompareToTests.java
-ojluni/src/test/java/math/BigDecimal/Constructor.java,jdk11u/jdk-11+28,test/jdk/java/math/BigDecimal/Constructor.java
+ojluni/src/test/java/math/BigDecimal/Constructor.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/math/BigDecimal/Constructor.java
ojluni/src/test/java/math/BigDecimal/DivideMcTests.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/math/BigDecimal/DivideMcTests.java
ojluni/src/test/java/math/BigDecimal/DivideTests.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/math/BigDecimal/DivideTests.java
ojluni/src/test/java/math/BigDecimal/EqualsTests.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/math/BigDecimal/EqualsTests.java
@@ -1860,7 +1875,7 @@
ojluni/src/test/java/math/BigDecimal/RoundingTests.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/math/BigDecimal/RoundingTests.java
ojluni/src/test/java/math/BigDecimal/ScaleByPowerOfTenTests.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/math/BigDecimal/ScaleByPowerOfTenTests.java
ojluni/src/test/java/math/BigDecimal/SerializationTests.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/math/BigDecimal/SerializationTests.java
-ojluni/src/test/java/math/BigDecimal/SquareRootTests.java,jdk11u/jdk-11+28,test/jdk/java/math/BigDecimal/SquareRootTests.java
+ojluni/src/test/java/math/BigDecimal/SquareRootTests.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/math/BigDecimal/SquareRootTests.java
ojluni/src/test/java/math/BigDecimal/StringConstructor.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/math/BigDecimal/StringConstructor.java
ojluni/src/test/java/math/BigDecimal/StrippingZerosTest.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/math/BigDecimal/StrippingZerosTest.java
ojluni/src/test/java/math/BigDecimal/ToPlainStringTests.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/math/BigDecimal/ToPlainStringTests.java
@@ -1870,7 +1885,7 @@
ojluni/src/test/java/math/BigInteger/ModPow.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/math/BigInteger/ModPow.java
ojluni/src/test/java/math/BigInteger/OperatorNpeTests.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/math/BigInteger/OperatorNpeTests.java
ojluni/src/test/java/math/BigInteger/PrimeTest.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/math/BigInteger/PrimeTest.java
-ojluni/src/test/java/math/BigInteger/PrimitiveConversionTests.java,jdk11u/jdk-11+28,test/jdk/java/math/BigInteger/PrimitiveConversionTests.java
+ojluni/src/test/java/math/BigInteger/PrimitiveConversionTests.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/math/BigInteger/PrimitiveConversionTests.java
ojluni/src/test/java/math/BigInteger/ProbablePrime.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/math/BigInteger/ProbablePrime.java
ojluni/src/test/java/math/BigInteger/StringConstructor.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/math/BigInteger/StringConstructor.java
ojluni/src/test/java/math/BigInteger/TestValueExact.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/math/BigInteger/TestValueExact.java
@@ -1878,8 +1893,188 @@
ojluni/src/test/java/nio/channels/SelectionKey/AtomicUpdates.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/nio/channels/SelectionKey/AtomicUpdates.java
ojluni/src/test/java/nio/channels/Selector/ByteServer.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/nio/channels/Selector/ByteServer.java
ojluni/src/test/java/nio/channels/Selector/SelectAfterRead.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/nio/channels/Selector/SelectAfterRead.java
-ojluni/src/test/java/nio/channels/Selector/SelectWithConsumer.java,jdk11u/jdk-11+28,test/jdk/java/nio/channels/Selector/SelectWithConsumer.java
+ojluni/src/test/java/nio/channels/Selector/SelectWithConsumer.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/nio/channels/Selector/SelectWithConsumer.java
ojluni/src/test/java/security/cert/CertPathEncodingTest.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/security/cert/CertPathEncodingTest.java
ojluni/src/test/java/security/cert/GetInstance.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/security/cert/GetInstance.java
ojluni/src/test/java/security/cert/URICertStoreParameters/TestBasic.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/security/cert/URICertStoreParameters/TestBasic.java
ojluni/src/test/java/security/cert/X509CertSelectorTest.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/security/cert/X509CertSelectorTest.java
+ojluni/src/test/java/time/jdk/testlibrary/RandomFactory.java,jdk11u/jdk-11.0.13-ga,test/lib/jdk/test/lib/RandomFactory.java
+ojluni/src/test/java/time/tck/java/time/AbstractDateTimeTest.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/AbstractDateTimeTest.java
+ojluni/src/test/java/time/tck/java/time/AbstractTCKTest.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/AbstractTCKTest.java
+ojluni/src/test/java/time/tck/java/time/MockSimplePeriod.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/MockSimplePeriod.java
+ojluni/src/test/java/time/tck/java/time/TCKClock.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/TCKClock.java
+ojluni/src/test/java/time/tck/java/time/TCKClock_Fixed.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/TCKClock_Fixed.java
+ojluni/src/test/java/time/tck/java/time/TCKClock_Offset.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/TCKClock_Offset.java
+ojluni/src/test/java/time/tck/java/time/TCKClock_System.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/TCKClock_System.java
+ojluni/src/test/java/time/tck/java/time/TCKClock_Tick.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/TCKClock_Tick.java
+ojluni/src/test/java/time/tck/java/time/TCKDayOfWeek.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/TCKDayOfWeek.java
+ojluni/src/test/java/time/tck/java/time/TCKDuration.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/TCKDuration.java
+ojluni/src/test/java/time/tck/java/time/TCKInstant.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/TCKInstant.java
+ojluni/src/test/java/time/tck/java/time/TCKLocalDate.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/TCKLocalDate.java
+ojluni/src/test/java/time/tck/java/time/TCKLocalDateTime.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/TCKLocalDateTime.java
+ojluni/src/test/java/time/tck/java/time/TCKLocalTime.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/TCKLocalTime.java
+ojluni/src/test/java/time/tck/java/time/TCKMonth.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/TCKMonth.java
+ojluni/src/test/java/time/tck/java/time/TCKMonthDay.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/TCKMonthDay.java
+ojluni/src/test/java/time/tck/java/time/TCKOffsetDateTime.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/TCKOffsetDateTime.java
+ojluni/src/test/java/time/tck/java/time/TCKOffsetTime.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/TCKOffsetTime.java
+ojluni/src/test/java/time/tck/java/time/TCKPeriod.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/TCKPeriod.java
+ojluni/src/test/java/time/tck/java/time/TCKYear.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/TCKYear.java
+ojluni/src/test/java/time/tck/java/time/TCKYearMonth.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/TCKYearMonth.java
+ojluni/src/test/java/time/tck/java/time/TCKZoneId.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/TCKZoneId.java
+ojluni/src/test/java/time/tck/java/time/TCKZoneOffset.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/TCKZoneOffset.java
+ojluni/src/test/java/time/tck/java/time/TCKZonedDateTime.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/TCKZonedDateTime.java
+ojluni/src/test/java/time/tck/java/time/TestIsoChronology.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/TestIsoChronology.java
+ojluni/src/test/java/time/tck/java/time/chrono/CopticChronology.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/CopticChronology.java
+ojluni/src/test/java/time/tck/java/time/chrono/CopticDate.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/CopticDate.java
+ojluni/src/test/java/time/tck/java/time/chrono/CopticEra.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/CopticEra.java
+ojluni/src/test/java/time/tck/java/time/chrono/TCKChronoLocalDate.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/TCKChronoLocalDate.java
+ojluni/src/test/java/time/tck/java/time/chrono/TCKChronoLocalDateTime.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/TCKChronoLocalDateTime.java
+ojluni/src/test/java/time/tck/java/time/chrono/TCKChronoPeriod.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/TCKChronoPeriod.java
+ojluni/src/test/java/time/tck/java/time/chrono/TCKChronoZonedDateTime.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/TCKChronoZonedDateTime.java
+ojluni/src/test/java/time/tck/java/time/chrono/TCKChronology.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/TCKChronology.java
+ojluni/src/test/java/time/tck/java/time/chrono/TCKHijrahChronology.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/TCKHijrahChronology.java
+ojluni/src/test/java/time/tck/java/time/chrono/TCKHijrahEra.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/TCKHijrahEra.java
+ojluni/src/test/java/time/tck/java/time/chrono/TCKIsoChronology.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/TCKIsoChronology.java
+ojluni/src/test/java/time/tck/java/time/chrono/TCKIsoEra.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/TCKIsoEra.java
+ojluni/src/test/java/time/tck/java/time/chrono/TCKJapaneseChronology.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/TCKJapaneseChronology.java
+ojluni/src/test/java/time/tck/java/time/chrono/TCKJapaneseEra.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/TCKJapaneseEra.java
+ojluni/src/test/java/time/tck/java/time/chrono/TCKMinguoChronology.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/TCKMinguoChronology.java
+ojluni/src/test/java/time/tck/java/time/chrono/TCKMinguoEra.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/TCKMinguoEra.java
+ojluni/src/test/java/time/tck/java/time/chrono/TCKTestServiceLoader.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/TCKTestServiceLoader.java
+ojluni/src/test/java/time/tck/java/time/chrono/TCKThaiBuddhistChronology.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/TCKThaiBuddhistChronology.java
+ojluni/src/test/java/time/tck/java/time/chrono/TCKThaiBuddhistEra.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/TCKThaiBuddhistEra.java
+ojluni/src/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateSerialization.java
+ojluni/src/test/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateTimeSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateTimeSerialization.java
+ojluni/src/test/java/time/tck/java/time/chrono/serial/TCKChronoZonedDateTimeSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/serial/TCKChronoZonedDateTimeSerialization.java
+ojluni/src/test/java/time/tck/java/time/chrono/serial/TCKChronologySerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/serial/TCKChronologySerialization.java
+ojluni/src/test/java/time/tck/java/time/chrono/serial/TCKCopticSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/serial/TCKCopticSerialization.java
+ojluni/src/test/java/time/tck/java/time/chrono/serial/TCKEraSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/chrono/serial/TCKEraSerialization.java
+ojluni/src/test/java/time/tck/java/time/format/TCKChronoPrinterParser.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/format/TCKChronoPrinterParser.java
+ojluni/src/test/java/time/tck/java/time/format/TCKDTFParsedInstant.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/format/TCKDTFParsedInstant.java
+ojluni/src/test/java/time/tck/java/time/format/TCKDateTimeFormatter.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/format/TCKDateTimeFormatter.java
+ojluni/src/test/java/time/tck/java/time/format/TCKDateTimeFormatterBuilder.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/format/TCKDateTimeFormatterBuilder.java
+ojluni/src/test/java/time/tck/java/time/format/TCKDateTimeFormatters.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/format/TCKDateTimeFormatters.java
+ojluni/src/test/java/time/tck/java/time/format/TCKDateTimeParseResolver.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/format/TCKDateTimeParseResolver.java
+ojluni/src/test/java/time/tck/java/time/format/TCKDateTimeTextPrinting.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/format/TCKDateTimeTextPrinting.java
+ojluni/src/test/java/time/tck/java/time/format/TCKDecimalStyle.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/format/TCKDecimalStyle.java
+ojluni/src/test/java/time/tck/java/time/format/TCKFormatStyle.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/format/TCKFormatStyle.java
+ojluni/src/test/java/time/tck/java/time/format/TCKInstantPrinterParser.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/format/TCKInstantPrinterParser.java
+ojluni/src/test/java/time/tck/java/time/format/TCKLocalizedFieldParser.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/format/TCKLocalizedFieldParser.java
+ojluni/src/test/java/time/tck/java/time/format/TCKLocalizedFieldPrinter.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/format/TCKLocalizedFieldPrinter.java
+ojluni/src/test/java/time/tck/java/time/format/TCKLocalizedOffsetIdPrinterParser.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/format/TCKLocalizedOffsetIdPrinterParser.java
+ojluni/src/test/java/time/tck/java/time/format/TCKLocalizedPrinterParser.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/format/TCKLocalizedPrinterParser.java
+ojluni/src/test/java/time/tck/java/time/format/TCKOffsetPrinterParser.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/format/TCKOffsetPrinterParser.java
+ojluni/src/test/java/time/tck/java/time/format/TCKPadPrinterParser.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/format/TCKPadPrinterParser.java
+ojluni/src/test/java/time/tck/java/time/format/TCKResolverStyle.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/format/TCKResolverStyle.java
+ojluni/src/test/java/time/tck/java/time/format/TCKSignStyle.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/format/TCKSignStyle.java
+ojluni/src/test/java/time/tck/java/time/format/TCKTextStyle.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/format/TCKTextStyle.java
+ojluni/src/test/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java
+ojluni/src/test/java/time/tck/java/time/serial/TCKClockSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/serial/TCKClockSerialization.java
+ojluni/src/test/java/time/tck/java/time/serial/TCKDurationSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/serial/TCKDurationSerialization.java
+ojluni/src/test/java/time/tck/java/time/serial/TCKInstantSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/serial/TCKInstantSerialization.java
+ojluni/src/test/java/time/tck/java/time/serial/TCKLocalDateSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/serial/TCKLocalDateSerialization.java
+ojluni/src/test/java/time/tck/java/time/serial/TCKLocalDateTimeSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/serial/TCKLocalDateTimeSerialization.java
+ojluni/src/test/java/time/tck/java/time/serial/TCKLocalTimeSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/serial/TCKLocalTimeSerialization.java
+ojluni/src/test/java/time/tck/java/time/serial/TCKMonthDaySerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/serial/TCKMonthDaySerialization.java
+ojluni/src/test/java/time/tck/java/time/serial/TCKOffsetDateTimeSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/serial/TCKOffsetDateTimeSerialization.java
+ojluni/src/test/java/time/tck/java/time/serial/TCKOffsetTimeSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/serial/TCKOffsetTimeSerialization.java
+ojluni/src/test/java/time/tck/java/time/serial/TCKPeriodSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/serial/TCKPeriodSerialization.java
+ojluni/src/test/java/time/tck/java/time/serial/TCKYearMonthSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/serial/TCKYearMonthSerialization.java
+ojluni/src/test/java/time/tck/java/time/serial/TCKYearSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/serial/TCKYearSerialization.java
+ojluni/src/test/java/time/tck/java/time/serial/TCKZoneIdSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/serial/TCKZoneIdSerialization.java
+ojluni/src/test/java/time/tck/java/time/serial/TCKZoneOffsetSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/serial/TCKZoneOffsetSerialization.java
+ojluni/src/test/java/time/tck/java/time/serial/TCKZonedDateTimeSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/serial/TCKZonedDateTimeSerialization.java
+ojluni/src/test/java/time/tck/java/time/temporal/TCKChronoField.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/temporal/TCKChronoField.java
+ojluni/src/test/java/time/tck/java/time/temporal/TCKChronoUnit.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/temporal/TCKChronoUnit.java
+ojluni/src/test/java/time/tck/java/time/temporal/TCKIsoFields.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/temporal/TCKIsoFields.java
+ojluni/src/test/java/time/tck/java/time/temporal/TCKJulianFields.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/temporal/TCKJulianFields.java
+ojluni/src/test/java/time/tck/java/time/temporal/TCKTemporalAdjusters.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/temporal/TCKTemporalAdjusters.java
+ojluni/src/test/java/time/tck/java/time/temporal/TCKWeekFields.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/temporal/TCKWeekFields.java
+ojluni/src/test/java/time/tck/java/time/temporal/serial/TCKChronoFieldSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/temporal/serial/TCKChronoFieldSerialization.java
+ojluni/src/test/java/time/tck/java/time/temporal/serial/TCKChronoUnitSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/temporal/serial/TCKChronoUnitSerialization.java
+ojluni/src/test/java/time/tck/java/time/temporal/serial/TCKJulianFieldsSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/temporal/serial/TCKJulianFieldsSerialization.java
+ojluni/src/test/java/time/tck/java/time/temporal/serial/TCKValueRangeSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/temporal/serial/TCKValueRangeSerialization.java
+ojluni/src/test/java/time/tck/java/time/temporal/serial/TCKWeekFieldsSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/temporal/serial/TCKWeekFieldsSerialization.java
+ojluni/src/test/java/time/tck/java/time/zone/TCKFixedZoneRules.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/zone/TCKFixedZoneRules.java
+ojluni/src/test/java/time/tck/java/time/zone/TCKZoneOffsetTransition.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/zone/TCKZoneOffsetTransition.java
+ojluni/src/test/java/time/tck/java/time/zone/TCKZoneOffsetTransitionRule.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/zone/TCKZoneOffsetTransitionRule.java
+ojluni/src/test/java/time/tck/java/time/zone/TCKZoneRules.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/zone/TCKZoneRules.java
+ojluni/src/test/java/time/tck/java/time/zone/TCKZoneRulesProvider.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/zone/TCKZoneRulesProvider.java
+ojluni/src/test/java/time/tck/java/time/zone/serial/TCKFixedZoneRulesSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/zone/serial/TCKFixedZoneRulesSerialization.java
+ojluni/src/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionRuleSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionRuleSerialization.java
+ojluni/src/test/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/zone/serial/TCKZoneOffsetTransitionSerialization.java
+ojluni/src/test/java/time/tck/java/time/zone/serial/TCKZoneRulesSerialization.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/tck/java/time/zone/serial/TCKZoneRulesSerialization.java
+ojluni/src/test/java/time/test/java/time/AbstractTest.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/AbstractTest.java
+ojluni/src/test/java/time/test/java/time/MockSimplePeriod.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/MockSimplePeriod.java
+ojluni/src/test/java/time/test/java/time/TestClock_Fixed.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/TestClock_Fixed.java
+ojluni/src/test/java/time/test/java/time/TestClock_Offset.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/TestClock_Offset.java
+ojluni/src/test/java/time/test/java/time/TestClock_System.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/TestClock_System.java
+ojluni/src/test/java/time/test/java/time/TestClock_Tick.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/TestClock_Tick.java
+ojluni/src/test/java/time/test/java/time/TestDuration.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/TestDuration.java
+ojluni/src/test/java/time/test/java/time/TestInstant.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/TestInstant.java
+ojluni/src/test/java/time/test/java/time/TestLocalDate.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/TestLocalDate.java
+ojluni/src/test/java/time/test/java/time/TestLocalDateTime.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/TestLocalDateTime.java
+ojluni/src/test/java/time/test/java/time/TestLocalTime.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/TestLocalTime.java
+ojluni/src/test/java/time/test/java/time/TestMonthDay.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/TestMonthDay.java
+ojluni/src/test/java/time/test/java/time/TestOffsetDateTime.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/TestOffsetDateTime.java
+ojluni/src/test/java/time/test/java/time/TestOffsetDateTime_instants.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/TestOffsetDateTime_instants.java
+ojluni/src/test/java/time/test/java/time/TestOffsetTime.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/TestOffsetTime.java
+ojluni/src/test/java/time/test/java/time/TestPeriod.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/TestPeriod.java
+ojluni/src/test/java/time/test/java/time/TestYear.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/TestYear.java
+ojluni/src/test/java/time/test/java/time/TestYearMonth.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/TestYearMonth.java
+ojluni/src/test/java/time/test/java/time/TestZoneId.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/TestZoneId.java
+ojluni/src/test/java/time/test/java/time/TestZoneOffset.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/TestZoneOffset.java
+ojluni/src/test/java/time/test/java/time/TestZonedDateTime.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/TestZonedDateTime.java
+ojluni/src/test/java/time/test/java/time/chrono/TestChronoLocalDate.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/chrono/TestChronoLocalDate.java
+ojluni/src/test/java/time/test/java/time/chrono/TestChronologyPerf.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/chrono/TestChronologyPerf.java
+ojluni/src/test/java/time/test/java/time/chrono/TestEraDisplayName.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/chrono/TestEraDisplayName.java
+ojluni/src/test/java/time/test/java/time/chrono/TestExampleCode.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/chrono/TestExampleCode.java
+ojluni/src/test/java/time/test/java/time/chrono/TestIsoChronoImpl.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/chrono/TestIsoChronoImpl.java
+ojluni/src/test/java/time/test/java/time/chrono/TestJapaneseChronoImpl.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/chrono/TestJapaneseChronoImpl.java
+ojluni/src/test/java/time/test/java/time/chrono/TestJapaneseChronology.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/chrono/TestJapaneseChronology.java
+ojluni/src/test/java/time/test/java/time/chrono/TestServiceLoader.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/chrono/TestServiceLoader.java
+ojluni/src/test/java/time/test/java/time/chrono/TestThaiBuddhistChronoImpl.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/chrono/TestThaiBuddhistChronoImpl.java
+ojluni/src/test/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java
+ojluni/src/test/java/time/test/java/time/format/AbstractTestPrinterParser.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/AbstractTestPrinterParser.java
+ojluni/src/test/java/time/test/java/time/format/MockIOExceptionAppendable.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/MockIOExceptionAppendable.java
+ojluni/src/test/java/time/test/java/time/format/TestCharLiteralParser.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestCharLiteralParser.java
+ojluni/src/test/java/time/test/java/time/format/TestCharLiteralPrinter.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestCharLiteralPrinter.java
+ojluni/src/test/java/time/test/java/time/format/TestDateTimeFormatter.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestDateTimeFormatter.java
+ojluni/src/test/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java
+ojluni/src/test/java/time/test/java/time/format/TestDateTimeFormatterBuilderWithLocale.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestDateTimeFormatterBuilderWithLocale.java
+ojluni/src/test/java/time/test/java/time/format/TestDateTimeParsing.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestDateTimeParsing.java
+ojluni/src/test/java/time/test/java/time/format/TestDateTimeTextProvider.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestDateTimeTextProvider.java
+ojluni/src/test/java/time/test/java/time/format/TestDateTimeTextProviderWithLocale.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestDateTimeTextProviderWithLocale.java
+ojluni/src/test/java/time/test/java/time/format/TestDecimalStyle.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestDecimalStyle.java
+ojluni/src/test/java/time/test/java/time/format/TestFractionPrinterParser.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestFractionPrinterParser.java
+ojluni/src/test/java/time/test/java/time/format/TestNarrowMonthNamesAndDayNames.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestNarrowMonthNamesAndDayNames.java
+ojluni/src/test/java/time/test/java/time/format/TestNonIsoFormatter.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestNonIsoFormatter.java
+ojluni/src/test/java/time/test/java/time/format/TestNumberParser.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestNumberParser.java
+ojluni/src/test/java/time/test/java/time/format/TestNumberPrinter.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestNumberPrinter.java
+ojluni/src/test/java/time/test/java/time/format/TestPadPrinterDecorator.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestPadPrinterDecorator.java
+ojluni/src/test/java/time/test/java/time/format/TestReducedParser.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestReducedParser.java
+ojluni/src/test/java/time/test/java/time/format/TestReducedPrinter.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestReducedPrinter.java
+ojluni/src/test/java/time/test/java/time/format/TestSettingsParser.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestSettingsParser.java
+ojluni/src/test/java/time/test/java/time/format/TestStringLiteralParser.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestStringLiteralParser.java
+ojluni/src/test/java/time/test/java/time/format/TestStringLiteralPrinter.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestStringLiteralPrinter.java
+ojluni/src/test/java/time/test/java/time/format/TestTextParser.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestTextParser.java
+ojluni/src/test/java/time/test/java/time/format/TestTextParserWithLocale.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestTextParserWithLocale.java
+ojluni/src/test/java/time/test/java/time/format/TestTextPrinter.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestTextPrinter.java
+ojluni/src/test/java/time/test/java/time/format/TestTextPrinterWithLocale.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestTextPrinterWithLocale.java
+ojluni/src/test/java/time/test/java/time/format/TestUnicodeExtension.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestUnicodeExtension.java
+ojluni/src/test/java/time/test/java/time/format/TestZoneOffsetParser.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestZoneOffsetParser.java
+ojluni/src/test/java/time/test/java/time/format/TestZoneOffsetPrinter.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestZoneOffsetPrinter.java
+ojluni/src/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/TestZoneTextPrinterParser.java
+ojluni/src/test/java/time/test/java/time/format/ZoneName.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/format/ZoneName.java
+ojluni/src/test/java/time/test/java/time/temporal/MockFieldNoValue.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/temporal/MockFieldNoValue.java
+ojluni/src/test/java/time/test/java/time/temporal/MockFieldValue.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/temporal/MockFieldValue.java
+ojluni/src/test/java/time/test/java/time/temporal/TestChronoField.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/temporal/TestChronoField.java
+ojluni/src/test/java/time/test/java/time/temporal/TestChronoUnit.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/temporal/TestChronoUnit.java
+ojluni/src/test/java/time/test/java/time/temporal/TestDateTimeBuilderCombinations.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/temporal/TestDateTimeBuilderCombinations.java
+ojluni/src/test/java/time/test/java/time/temporal/TestDateTimeValueRange.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/temporal/TestDateTimeValueRange.java
+ojluni/src/test/java/time/test/java/time/temporal/TestIsoWeekFields.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/temporal/TestIsoWeekFields.java
+ojluni/src/test/java/time/test/java/time/temporal/TestJulianFields.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/temporal/TestJulianFields.java
+ojluni/src/test/java/time/test/java/time/zone/TestFixedZoneRules.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/zone/TestFixedZoneRules.java
+ojluni/src/test/java/time/test/java/time/zone/TestZoneRules.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/time/zone/TestZoneRules.java
+ojluni/src/test/java/time/test/java/util/TestFormatter.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/time/test/java/util/TestFormatter.java
+ojluni/src/test/java/util/zip/ZipFile/Zip64SizeTest.java,jdk11u/jdk-11.0.13-ga,test/jdk/java/util/zip/ZipFile/Zip64SizeTest.java
diff --git a/Extras.bp b/Extras.bp
new file mode 100644
index 0000000..776bf00
--- /dev/null
+++ b/Extras.bp
@@ -0,0 +1,25 @@
+// Copyright (C) 2022 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//
+// Definitions to expose small parts of the core library that are
+// independent from the whole Android core library.
+//
+
+// Java host library containing just the xmlpull sources
+java_library_host {
+ name: "core-xml-for-host",
+ srcs: ["xml/src/main/java/org/xmlpull/**/*.java"],
+ visibility: ["//packages/modules/Permission:__subpackages__"],
+}
diff --git a/NativeCode.bp b/NativeCode.bp
index 8b1a2d9..2db7019 100644
--- a/NativeCode.bp
+++ b/NativeCode.bp
@@ -135,15 +135,22 @@
],
target: {
- linux_glibc: {
- cflags: [ // Sigh.
+ musl: {
+ cflags: [
+ // Sigh.
"-D_LARGEFILE64_SOURCE",
"-D_GNU_SOURCE",
"-DLINUX",
],
},
glibc: {
- cflags: ["-D__GLIBC__"],
+ cflags: [
+ "-D__GLIBC__",
+ // Sigh.
+ "-D_LARGEFILE64_SOURCE",
+ "-D_GNU_SOURCE",
+ "-DLINUX",
+ ],
},
android: {
shared_libs: [
diff --git a/dalvik/src/test/java/libcore/org/apache/harmony/dalvik/ddmc/DdmVmInternalTest.java b/dalvik/src/test/java/libcore/org/apache/harmony/dalvik/ddmc/DdmVmInternalTest.java
index cf5b85b..b69b385 100644
--- a/dalvik/src/test/java/libcore/org/apache/harmony/dalvik/ddmc/DdmVmInternalTest.java
+++ b/dalvik/src/test/java/libcore/org/apache/harmony/dalvik/ddmc/DdmVmInternalTest.java
@@ -54,7 +54,6 @@
File before = new File(beforePath);
File after = new File(afterPath);
- assertNotEquals(before.length(), after.length());
before.delete();
after.delete();
}
diff --git a/luni/src/main/java/libcore/icu/ICU.java b/luni/src/main/java/libcore/icu/ICU.java
index 7a07a0b..784a24d 100644
--- a/luni/src/main/java/libcore/icu/ICU.java
+++ b/luni/src/main/java/libcore/icu/ICU.java
@@ -609,4 +609,24 @@
.setKeywordValue("calendar", calendarType);
return ExtendedCalendar.getInstance(uLocale);
}
+
+ /**
+ * Converts CLDR LDML short time zone id to an ID that can be recognized by
+ * {@link java.util.TimeZone#getTimeZone(String)}.
+ * @param cldrShortTzId
+ * @return null if no tz id can be matched to the short id.
+ */
+ public static String convertToTzId(String cldrShortTzId) {
+ if (cldrShortTzId == null) {
+ return null;
+ }
+ String tzid = ULocale.toLegacyType("tz", cldrShortTzId);
+ // ULocale.toLegacyType() returns the lower case of the input ID if it matches the spec, but
+ // it's not a valid tz id.
+ if (tzid == null || tzid.equals(cldrShortTzId.toLowerCase(Locale.ROOT))) {
+ return null;
+ }
+ return tzid;
+ }
+
}
diff --git a/luni/src/main/java/libcore/io/Memory.java b/luni/src/main/java/libcore/io/Memory.java
index efd3ac5..d9df6d5 100644
--- a/luni/src/main/java/libcore/io/Memory.java
+++ b/luni/src/main/java/libcore/io/Memory.java
@@ -287,36 +287,43 @@
* @hide
*/
@UnsupportedAppUsage
+ @FastNative
public static native void peekByteArray(long address, byte[] dst, int dstOffset, int byteCount);
/**
* @hide
*/
+ @FastNative
public static native void peekCharArray(long address, char[] dst, int dstOffset, int charCount, boolean swap);
/**
* @hide
*/
+ @FastNative
public static native void peekDoubleArray(long address, double[] dst, int dstOffset, int doubleCount, boolean swap);
/**
* @hide
*/
+ @FastNative
public static native void peekFloatArray(long address, float[] dst, int dstOffset, int floatCount, boolean swap);
/**
* @hide
*/
+ @FastNative
public static native void peekIntArray(long address, int[] dst, int dstOffset, int intCount, boolean swap);
/**
* @hide
*/
+ @FastNative
public static native void peekLongArray(long address, long[] dst, int dstOffset, int longCount, boolean swap);
/**
* @hide
*/
+ @FastNative
public static native void peekShortArray(long address, short[] dst, int dstOffset, int shortCount, boolean swap);
/**
diff --git a/luni/src/main/native/libcore_io_Memory.cpp b/luni/src/main/native/libcore_io_Memory.cpp
index b8a8845..851cb9f 100644
--- a/luni/src/main/native/libcore_io_Memory.cpp
+++ b/luni/src/main/native/libcore_io_Memory.cpp
@@ -109,55 +109,6 @@
return *cast<const jbyte*>(srcAddress);
}
-static void Memory_peekByteArray(JNIEnv* env, jclass, jlong srcAddress, jbyteArray dst, jint dstOffset, jint byteCount) {
- env->SetByteArrayRegion(dst, dstOffset, byteCount, cast<const jbyte*>(srcAddress));
-}
-
-// Implements the peekXArray methods:
-// - For unswapped access, we just use the JNI SetXArrayRegion functions.
-// - For swapped access, we use GetXArrayElements and our own copy-and-swap routines.
-// GetXArrayElements is disproportionately cheap on Dalvik because it doesn't copy (as opposed
-// to Hotspot, which always copies). The SWAP_FN copies and swaps in one pass, which is cheaper
-// than copying and then swapping in a second pass. Depending on future VM/GC changes, the
-// swapped case might need to be revisited.
-#define PEEKER(SCALAR_TYPE, JNI_NAME, SWAP_TYPE, SWAP_FN) { \
- if (swap) { \
- Scoped ## JNI_NAME ## ArrayRW elements(env, dst); \
- if (elements.get() == NULL) { \
- return; \
- } \
- const SWAP_TYPE* src = cast<const SWAP_TYPE*>(srcAddress); \
- SWAP_FN(reinterpret_cast<SWAP_TYPE*>(elements.get()) + dstOffset, src, count); /*NOLINT*/ \
- } else { \
- const SCALAR_TYPE* src = cast<const SCALAR_TYPE*>(srcAddress); \
- env->Set ## JNI_NAME ## ArrayRegion(dst, dstOffset, count, src); \
- } \
-}
-
-static void Memory_peekCharArray(JNIEnv* env, jclass, jlong srcAddress, jcharArray dst, jint dstOffset, jint count, jboolean swap) {
- PEEKER(jchar, Char, jshort, swapShorts);
-}
-
-static void Memory_peekDoubleArray(JNIEnv* env, jclass, jlong srcAddress, jdoubleArray dst, jint dstOffset, jint count, jboolean swap) {
- PEEKER(jdouble, Double, jlong, swapLongs);
-}
-
-static void Memory_peekFloatArray(JNIEnv* env, jclass, jlong srcAddress, jfloatArray dst, jint dstOffset, jint count, jboolean swap) {
- PEEKER(jfloat, Float, jint, swapInts);
-}
-
-static void Memory_peekIntArray(JNIEnv* env, jclass, jlong srcAddress, jintArray dst, jint dstOffset, jint count, jboolean swap) {
- PEEKER(jint, Int, jint, swapInts);
-}
-
-static void Memory_peekLongArray(JNIEnv* env, jclass, jlong srcAddress, jlongArray dst, jint dstOffset, jint count, jboolean swap) {
- PEEKER(jlong, Long, jlong, swapLongs);
-}
-
-static void Memory_peekShortArray(JNIEnv* env, jclass, jlong srcAddress, jshortArray dst, jint dstOffset, jint count, jboolean swap) {
- PEEKER(jshort, Short, jshort, swapShorts);
-}
-
static void Memory_pokeByte(JNIEnv*, jclass, jlong dstAddress, jbyte value) {
*cast<jbyte*>(dstAddress) = value;
}
@@ -290,19 +241,13 @@
env->ReleasePrimitiveArrayCritical(srcArray, srcBytes, 0);
}
+// The remaining Memory methods are contained in art/runtime/native/libcore_io_Memory.cc
static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Memory, memmove, "(Ljava/lang/Object;ILjava/lang/Object;IJ)V"),
FAST_NATIVE_METHOD(Memory, peekByte, "(J)B"),
- NATIVE_METHOD(Memory, peekByteArray, "(J[BII)V"),
- NATIVE_METHOD(Memory, peekCharArray, "(J[CIIZ)V"),
- NATIVE_METHOD(Memory, peekDoubleArray, "(J[DIIZ)V"),
- NATIVE_METHOD(Memory, peekFloatArray, "(J[FIIZ)V"),
FAST_NATIVE_METHOD(Memory, peekIntNative, "(J)I"),
- NATIVE_METHOD(Memory, peekIntArray, "(J[IIIZ)V"),
FAST_NATIVE_METHOD(Memory, peekLongNative, "(J)J"),
- NATIVE_METHOD(Memory, peekLongArray, "(J[JIIZ)V"),
FAST_NATIVE_METHOD(Memory, peekShortNative, "(J)S"),
- NATIVE_METHOD(Memory, peekShortArray, "(J[SIIZ)V"),
FAST_NATIVE_METHOD(Memory, pokeByte, "(JB)V"),
NATIVE_METHOD(Memory, pokeByteArray, "(J[BII)V"),
NATIVE_METHOD(Memory, pokeCharArray, "(J[CIIZ)V"),
diff --git a/luni/src/test/java/libcore/java/lang/IntegerTest.java b/luni/src/test/java/libcore/java/lang/IntegerTest.java
index 79d1acc..4954f02 100644
--- a/luni/src/test/java/libcore/java/lang/IntegerTest.java
+++ b/luni/src/test/java/libcore/java/lang/IntegerTest.java
@@ -16,163 +16,164 @@
package libcore.java.lang;
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
import java.util.Properties;
-public class IntegerTest extends junit.framework.TestCase {
+@RunWith(JUnit4.class)
+public class IntegerTest {
+ static final int[] INT_VALUES = {0, 1, 23, 456, 0x7fff_ffff, 0x8000_0000, 0xffff_ffff};
- public void testSystemProperties() {
- Properties originalProperties = System.getProperties();
- try {
- Properties testProperties = new Properties();
- testProperties.put("testIncInt", "notInt");
- System.setProperties(testProperties);
- assertNull("returned incorrect default Integer",
- Integer.getInteger("testIncInt"));
- assertEquals(new Integer(4), Integer.getInteger("testIncInt", 4));
- assertEquals(new Integer(4),
- Integer.getInteger("testIncInt", new Integer(4)));
- } finally {
- System.setProperties(originalProperties);
+ static final long[] LONG_VALUES = {
+ 0x1_0000_0000L, (long) Integer.MIN_VALUE - 1L, Long.MIN_VALUE, Long.MAX_VALUE
+ };
+
+ @Test
+ public void testSystemProperties() {
+ Properties originalProperties = System.getProperties();
+ try {
+ Properties testProperties = new Properties();
+ testProperties.put("testIncInt", "notInt");
+ System.setProperties(testProperties);
+ assertNull("returned incorrect default Integer", Integer.getInteger("testIncInt"));
+ assertEquals(new Integer(4), Integer.getInteger("testIncInt", 4));
+ assertEquals(new Integer(4), Integer.getInteger("testIncInt", new Integer(4)));
+ } finally {
+ System.setProperties(originalProperties);
+ }
}
- }
- public void testCompare() throws Exception {
- final int min = Integer.MIN_VALUE;
- final int zero = 0;
- final int max = Integer.MAX_VALUE;
- assertTrue(Integer.compare(max, max) == 0);
- assertTrue(Integer.compare(min, min) == 0);
- assertTrue(Integer.compare(zero, zero) == 0);
- assertTrue(Integer.compare(max, zero) > 0);
- assertTrue(Integer.compare(max, min) > 0);
- assertTrue(Integer.compare(zero, max) < 0);
- assertTrue(Integer.compare(zero, min) > 0);
- assertTrue(Integer.compare(min, zero) < 0);
- assertTrue(Integer.compare(min, max) < 0);
- }
+ @Test
+ public void testCompare() throws Exception {
+ final int min = Integer.MIN_VALUE;
+ final int zero = 0;
+ final int max = Integer.MAX_VALUE;
+ assertTrue(Integer.compare(max, max) == 0);
+ assertTrue(Integer.compare(min, min) == 0);
+ assertTrue(Integer.compare(zero, zero) == 0);
+ assertTrue(Integer.compare(max, zero) > 0);
+ assertTrue(Integer.compare(max, min) > 0);
+ assertTrue(Integer.compare(zero, max) < 0);
+ assertTrue(Integer.compare(zero, min) > 0);
+ assertTrue(Integer.compare(min, zero) < 0);
+ assertTrue(Integer.compare(min, max) < 0);
+ }
- public void testParseInt() throws Exception {
- assertEquals(0, Integer.parseInt("+0", 10));
- assertEquals(473, Integer.parseInt("+473", 10));
- assertEquals(255, Integer.parseInt("+FF", 16));
- assertEquals(102, Integer.parseInt("+1100110", 2));
- assertEquals(2147483647, Integer.parseInt("+2147483647", 10));
- assertEquals(411787, Integer.parseInt("Kona", 27));
- assertEquals(411787, Integer.parseInt("+Kona", 27));
- assertEquals(-145, Integer.parseInt("-145", 10));
+ @Test
+ public void testParseInt() throws Exception {
+ assertEquals(0, Integer.parseInt("+0", 10));
+ assertEquals(473, Integer.parseInt("+473", 10));
+ assertEquals(255, Integer.parseInt("+FF", 16));
+ assertEquals(102, Integer.parseInt("+1100110", 2));
+ assertEquals(2147483647, Integer.parseInt("+2147483647", 10));
+ assertEquals(411787, Integer.parseInt("Kona", 27));
+ assertEquals(411787, Integer.parseInt("+Kona", 27));
+ assertEquals(-145, Integer.parseInt("-145", 10));
- try {
- Integer.parseInt("--1", 10); // multiple sign chars
- fail();
- } catch (NumberFormatException expected) {}
+ // multiple sign chars
+ assertThrows(NumberFormatException.class, () -> Integer.parseInt("--1", 10));
+ assertThrows(NumberFormatException.class, () -> Integer.parseInt("++1", 10));
- try {
- Integer.parseInt("++1", 10); // multiple sign chars
- fail();
- } catch (NumberFormatException expected) {}
+ // base too small
+ assertThrows(NumberFormatException.class, () -> Integer.parseInt("Kona", 10));
+ }
- try {
- Integer.parseInt("Kona", 10); // base too small
- fail();
- } catch (NumberFormatException expected) {}
- }
+ @Test
+ public void testDecodeInt() throws Exception {
+ assertEquals(0, Integer.decode("+0").intValue());
+ assertEquals(473, Integer.decode("+473").intValue());
+ assertEquals(255, Integer.decode("+0xFF").intValue());
+ assertEquals(16, Integer.decode("+020").intValue());
+ assertEquals(2147483647, Integer.decode("+2147483647").intValue());
+ assertEquals(-73, Integer.decode("-73").intValue());
+ assertEquals(-255, Integer.decode("-0xFF").intValue());
+ assertEquals(255, Integer.decode("+#FF").intValue());
+ assertEquals(-255, Integer.decode("-#FF").intValue());
- public void testDecodeInt() throws Exception {
- assertEquals(0, Integer.decode("+0").intValue());
- assertEquals(473, Integer.decode("+473").intValue());
- assertEquals(255, Integer.decode("+0xFF").intValue());
- assertEquals(16, Integer.decode("+020").intValue());
- assertEquals(2147483647, Integer.decode("+2147483647").intValue());
- assertEquals(-73, Integer.decode("-73").intValue());
- assertEquals(-255, Integer.decode("-0xFF").intValue());
- assertEquals(255, Integer.decode("+#FF").intValue());
- assertEquals(-255, Integer.decode("-#FF").intValue());
+ assertThrows(NumberFormatException.class, () -> Integer.decode("--1"));
+ assertThrows(NumberFormatException.class, () -> Integer.decode("++1"));
+ assertThrows(NumberFormatException.class, () -> Integer.decode("-+1"));
+ assertThrows(NumberFormatException.class, () -> Integer.decode("Kona"));
+ }
- try {
- Integer.decode("--1"); // multiple sign chars
- fail();
- } catch (NumberFormatException expected) {}
+ /*
+ public void testParsePositiveInt() throws Exception {
+ assertEquals(0, Integer.parsePositiveInt("0", 10));
+ assertEquals(473, Integer.parsePositiveInt("473", 10));
+ assertEquals(255, Integer.parsePositiveInt("FF", 16));
- try {
- Integer.decode("++1"); // multiple sign chars
- fail();
- } catch (NumberFormatException expected) {}
+ try {
+ Integer.parsePositiveInt("-1", 10);
+ fail();
+ } catch (NumberFormatException e) {}
- try {
- Integer.decode("-+1"); // multiple sign chars
- fail();
- } catch (NumberFormatException expected) {}
+ try {
+ Integer.parsePositiveInt("+1", 10);
+ fail();
+ } catch (NumberFormatException e) {}
- try {
- Integer.decode("Kona"); // invalid number
- fail();
- } catch (NumberFormatException expected) {}
- }
+ try {
+ Integer.parsePositiveInt("+0", 16);
+ fail();
+ } catch (NumberFormatException e) {}
+ }
+ */
- /*
- public void testParsePositiveInt() throws Exception {
- assertEquals(0, Integer.parsePositiveInt("0", 10));
- assertEquals(473, Integer.parsePositiveInt("473", 10));
- assertEquals(255, Integer.parsePositiveInt("FF", 16));
-
- try {
- Integer.parsePositiveInt("-1", 10);
- fail();
- } catch (NumberFormatException e) {}
-
- try {
- Integer.parsePositiveInt("+1", 10);
- fail();
- } catch (NumberFormatException e) {}
-
- try {
- Integer.parsePositiveInt("+0", 16);
- fail();
- } catch (NumberFormatException e) {}
- }
- */
-
+ @Test
public void testStaticHashCode() {
assertEquals(Integer.valueOf(567).hashCode(), Integer.hashCode(567));
}
+ @Test
public void testMax() {
int a = 567;
int b = 578;
assertEquals(Math.max(a, b), Integer.max(a, b));
}
+ @Test
public void testMin() {
int a = 567;
int b = 578;
assertEquals(Math.min(a, b), Integer.min(a, b));
}
+ @Test
public void testSum() {
int a = 567;
int b = 578;
assertEquals(a + b, Integer.sum(a, b));
}
+ @Test
public void testBYTES() {
- assertEquals(4, Integer.BYTES);
+ assertEquals(4, Integer.BYTES);
}
+ @Test
public void testCompareUnsigned() {
- int[] ordVals = {0, 1, 23, 456, 0x7fff_ffff, 0x8000_0000, 0xffff_ffff};
- for(int i = 0; i < ordVals.length; ++i) {
- for(int j = 0; j < ordVals.length; ++j) {
- assertEquals(Integer.compare(i, j),
- Integer.compareUnsigned(ordVals[i], ordVals[j]));
+ for (int i = 0; i < INT_VALUES.length; ++i) {
+ for (int j = 0; j < INT_VALUES.length; ++j) {
+ assertEquals(
+ Integer.compare(i, j),
+ Integer.compareUnsigned(INT_VALUES[i], INT_VALUES[j]));
}
}
}
+ @Test
public void testDivideAndRemainderUnsigned() {
long[] vals = {1L, 23L, 456L, 0x7fff_ffffL, 0x8000_0000L, 0xffff_ffffL};
- for(long dividend : vals) {
- for(long divisor : vals) {
+ for (long dividend : vals) {
+ for (long divisor : vals) {
int uq = Integer.divideUnsigned((int) dividend, (int) divisor);
int ur = Integer.remainderUnsigned((int) dividend, (int) divisor);
assertEquals((int) (dividend / divisor), uq);
@@ -181,83 +182,220 @@
}
}
- for(long dividend : vals) {
- try {
- Integer.divideUnsigned((int) dividend, 0);
- fail();
- } catch (ArithmeticException expected) { }
- try {
- Integer.remainderUnsigned((int) dividend, 0);
- fail();
- } catch (ArithmeticException expected) { }
+ for (long dividend : vals) {
+ assertThrows(
+ ArithmeticException.class, () -> Integer.divideUnsigned((int) dividend, 0));
+ assertThrows(
+ ArithmeticException.class, () -> Integer.remainderUnsigned((int) dividend, 0));
}
}
+ @Test
public void testParseUnsignedInt() {
- int[] vals = {0, 1, 23, 456, 0x7fff_ffff, 0x8000_0000, 0xffff_ffff};
-
- for(int val : vals) {
+ for (int value : INT_VALUES) {
// Special radices
- assertEquals(val, Integer.parseUnsignedInt(Integer.toBinaryString(val), 2));
- assertEquals(val, Integer.parseUnsignedInt(Integer.toOctalString(val), 8));
- assertEquals(val, Integer.parseUnsignedInt(Integer.toUnsignedString(val)));
- assertEquals(val, Integer.parseUnsignedInt(Integer.toHexString(val), 16));
+ assertEquals(value, Integer.parseUnsignedInt(Integer.toBinaryString(value), 2));
+ assertEquals(value, Integer.parseUnsignedInt(Integer.toOctalString(value), 8));
+ assertEquals(value, Integer.parseUnsignedInt(Integer.toUnsignedString(value)));
+ assertEquals(value, Integer.parseUnsignedInt(Integer.toHexString(value), 16));
- for(int radix = Character.MIN_RADIX; radix <= Character.MAX_RADIX; ++radix) {
- assertEquals(val,
- Integer.parseUnsignedInt(Integer.toUnsignedString(val, radix), radix));
+ for (int radix = Character.MIN_RADIX; radix <= Character.MAX_RADIX; ++radix) {
+ assertEquals(
+ value,
+ Integer.parseUnsignedInt(Integer.toUnsignedString(value, radix), radix));
}
}
- try {
- Integer.parseUnsignedInt("-1");
- fail();
- } catch (NumberFormatException expected) { }
- try {
- Integer.parseUnsignedInt("123", 2);
- fail();
- } catch (NumberFormatException expected) { }
- try {
- Integer.parseUnsignedInt(null);
- fail();
- } catch (NumberFormatException expected) { }
- try {
- Integer.parseUnsignedInt("0", Character.MAX_RADIX + 1);
- fail();
- } catch (NumberFormatException expected) { }
- try {
- Integer.parseUnsignedInt("0", Character.MIN_RADIX - 1);
- fail();
- } catch (NumberFormatException expected) { }
+ for (long longValue : LONG_VALUES) {
+ // Special radices
+ assertThrows(
+ NumberFormatException.class,
+ () -> Integer.parseUnsignedInt(Long.toBinaryString(longValue), 2));
+ assertThrows(
+ NumberFormatException.class,
+ () -> Integer.parseUnsignedInt(Long.toOctalString(longValue), 8));
+ assertThrows(
+ NumberFormatException.class,
+ () -> Integer.parseUnsignedInt(Long.toUnsignedString(longValue), 10));
+ assertThrows(
+ NumberFormatException.class,
+ () -> Integer.parseUnsignedInt(Long.toHexString(longValue), 16));
+ for (int radix = Character.MIN_RADIX; radix <= Character.MAX_RADIX; ++radix) {
+ final int r = radix;
+ assertThrows(
+ NumberFormatException.class,
+ () -> Integer.parseUnsignedInt(Long.toUnsignedString(longValue, r), r));
+ }
+ }
+
+ assertThrows(NumberFormatException.class, () -> Integer.parseUnsignedInt("-1"));
+ assertThrows(NumberFormatException.class, () -> Integer.parseUnsignedInt("123", 2));
+ assertThrows(NumberFormatException.class, () -> Integer.parseUnsignedInt(null));
+ assertThrows(
+ NumberFormatException.class,
+ () -> Integer.parseUnsignedInt("0", Character.MAX_RADIX + 1));
+ assertThrows(
+ NumberFormatException.class,
+ () -> Integer.parseUnsignedInt("0", Character.MIN_RADIX - 1));
}
- public void testToUnsignedLong() {
- int[] vals = {0, 1, 23, 456, 0x7fff_ffff, 0x8000_0000, 0xffff_ffff};
+ @Test
+ public void testParseUnsignedIntSubstring() {
+ final String LEFT = "1";
+ final String RIGHT = "0";
- for(int val : vals) {
+ for (int ii = 0; ii < 8; ii = 2 * ii + 1) {
+ for (int jj = 0; jj < 8; jj = 2 * jj + 1) {
+ final int i = ii; // final for use in lambdas
+ final int j = jj; // final for use in lambdas
+ final String leftPad = LEFT.repeat(i);
+ final String rightPad = RIGHT.repeat(j);
+ for (int value : INT_VALUES) {
+ String binary = leftPad + Integer.toBinaryString(value) + rightPad;
+ assertEquals(
+ value, Integer.parseUnsignedInt(binary, i, binary.length() - j, 2));
+
+ String octal = leftPad + Integer.toOctalString(value) + rightPad;
+ assertEquals(value, Integer.parseUnsignedInt(octal, i, octal.length() - j, 8));
+
+ String denary = leftPad + Integer.toUnsignedString(value) + rightPad;
+ assertEquals(
+ value, Integer.parseUnsignedInt(denary, i, denary.length() - j, 10));
+
+ String hex = leftPad + Integer.toHexString(value) + rightPad;
+ assertEquals(value, Integer.parseUnsignedInt(hex, i, hex.length() - j, 16));
+
+ for (int radix = Character.MIN_RADIX; radix <= Character.MAX_RADIX; ++radix) {
+ String arb = leftPad + Integer.toUnsignedString(value, radix) + rightPad;
+ assertEquals(
+ value, Integer.parseUnsignedInt(arb, i, arb.length() - j, radix));
+ }
+ }
+
+ for (long large_value : LONG_VALUES) {
+ {
+ final String input = leftPad + Long.toBinaryString(large_value) + rightPad;
+ assertThrows(
+ NumberFormatException.class,
+ () -> Integer.parseUnsignedInt(input, i, input.length() - j, 2));
+ }
+ {
+ final String input = leftPad + Long.toOctalString(large_value) + rightPad;
+ assertThrows(
+ NumberFormatException.class,
+ () -> Integer.parseUnsignedInt(input, i, input.length() - j, 8));
+ }
+ {
+ final String input =
+ leftPad + Long.toUnsignedString(large_value) + rightPad;
+ assertThrows(
+ NumberFormatException.class,
+ () -> Integer.parseUnsignedInt(input, i, input.length() - j, 10));
+ }
+ {
+ final String input = leftPad + Long.toHexString(large_value) + rightPad;
+ assertThrows(
+ NumberFormatException.class,
+ () -> Integer.parseUnsignedInt(input, i, input.length() - j, 16));
+ }
+ for (int radix = Character.MIN_RADIX; radix <= Character.MAX_RADIX; ++radix) {
+ final int r = radix;
+ String input =
+ leftPad + Long.toUnsignedString(large_value, radix) + rightPad;
+ assertThrows(
+ NumberFormatException.class,
+ () -> Integer.parseUnsignedInt(input, i, input.length() - j, r));
+ }
+ }
+ }
+ }
+
+ assertThrows(
+ IndexOutOfBoundsException.class, () -> Integer.parseUnsignedInt("123", -1, 3, 10));
+ assertThrows(
+ IndexOutOfBoundsException.class, () -> Integer.parseUnsignedInt("123", 4, 5, 10));
+ assertThrows(
+ IndexOutOfBoundsException.class, () -> Integer.parseUnsignedInt("123", 2, 1, 10));
+ assertThrows(
+ IndexOutOfBoundsException.class, () -> Integer.parseUnsignedInt("123", 2, 4, 10));
+ assertThrows(NumberFormatException.class, () -> Integer.parseUnsignedInt("-1", 0, 2, 10));
+ assertThrows(NumberFormatException.class, () -> Integer.parseUnsignedInt("123", 0, 3, 2));
+ assertThrows(
+ NumberFormatException.class,
+ () -> Integer.parseUnsignedInt("0", 0, 1, Character.MAX_RADIX + 1));
+ assertThrows(
+ NumberFormatException.class,
+ () -> Integer.parseUnsignedInt("0", 0, 1, Character.MIN_RADIX - 1));
+ assertThrows(NullPointerException.class, () -> Integer.parseUnsignedInt(null, 0, 1, 10));
+ }
+
+ @Test
+ public void testToUnsignedLong() {
+ for (int val : INT_VALUES) {
long ul = Integer.toUnsignedLong(val);
assertEquals(0, ul >>> Integer.BYTES * 8);
assertEquals(val, (int) ul);
}
}
+ @Test
public void testToUnsignedString() {
- int[] vals = {0, 1, 23, 456, 0x7fff_ffff, 0x8000_0000, 0xffff_ffff};
-
- for(int val : vals) {
+ for (int val : INT_VALUES) {
// Special radices
assertTrue(Integer.toUnsignedString(val, 2).equals(Integer.toBinaryString(val)));
assertTrue(Integer.toUnsignedString(val, 8).equals(Integer.toOctalString(val)));
assertTrue(Integer.toUnsignedString(val, 10).equals(Integer.toUnsignedString(val)));
assertTrue(Integer.toUnsignedString(val, 16).equals(Integer.toHexString(val)));
- for(int radix = Character.MIN_RADIX; radix <= Character.MAX_RADIX; ++radix) {
- assertTrue(Integer.toUnsignedString(val, radix)
- .equals(Long.toString(Integer.toUnsignedLong(val), radix)));
+ for (int radix = Character.MIN_RADIX; radix <= Character.MAX_RADIX; ++radix) {
+ assertTrue(
+ Integer.toUnsignedString(val, radix)
+ .equals(Long.toString(Integer.toUnsignedLong(val), radix)));
}
// Behavior is not defined by Java API specification if the radix falls outside of valid
// range, thus we don't test for such cases.
}
}
+
+ @Test
+ public void testParseUnsignedIntSubstringForBackports() {
+ // Rudimentary test to register coverage on older branches where we may see backports for
+ // OpenJDK 11 methods (b/191859202). NB using Integer_parseUnsignedInt rather than
+ // Integer.parseUnsignedInt.
+ assertEquals(
+ 0xaa55aa55,
+ Integer_parseUnsignedInt("left10101010010101011010101001010101right", 4, 36, 2));
+ assertEquals(8003, Integer_parseUnsignedInt("left17503right", 4, 9, 8));
+ assertEquals(0xffff_ffff, Integer_parseUnsignedInt("left4294967295right", 4, 14, 10));
+ assertEquals(0x1234_5678, Integer_parseUnsignedInt("lefty12345678righty", 5, 13, 16));
+ }
+
+ /**
+ * Parses an unsigned integer using a {@code MethodHandle} to invoke {@code
+ * Integer.parseUnsignedInt}.
+ *
+ * @param val the {@code CharSequence} to be parsed.
+ * @param start the starting index in {@code val}.
+ * @param end the ending ing index in {@code val}, exclusive.
+ * @param radix the radix to parse {@code val} with.
+ * @return the parsed unsigned integer.
+ */
+ private static int Integer_parseUnsignedInt(CharSequence val, int start, int end, int radix) {
+ try {
+ MethodType parseUnsignedIntType =
+ MethodType.methodType(
+ int.class, CharSequence.class, int.class, int.class, int.class);
+ MethodHandle parseUnsignedInt =
+ MethodHandles.lookup()
+ .findStatic(Integer.class, "parseUnsignedInt", parseUnsignedIntType);
+ return (int) parseUnsignedInt.invokeExact(val, start, end, radix);
+ } catch (IndexOutOfBoundsException | NullPointerException | NumberFormatException e) {
+ // Expected exceptions from the target method during the tests here.
+ throw e;
+ } catch (Throwable t) {
+ // Everything else.
+ throw new RuntimeException(t);
+ }
+ }
}
diff --git a/luni/src/test/java/libcore/java/net/PortUnreachableExceptionTest.java b/luni/src/test/java/libcore/java/net/PortUnreachableExceptionTest.java
new file mode 100644
index 0000000..0eab87d
--- /dev/null
+++ b/luni/src/test/java/libcore/java/net/PortUnreachableExceptionTest.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package libcore.java.net;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.PortUnreachableException;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public class PortUnreachableExceptionTest {
+
+ @Test
+ public void testConstructor_withMsg() {
+ String msg = "test message";
+ PortUnreachableException e = new PortUnreachableException(msg);
+ assertEquals(msg, e.getMessage());
+ }
+}
diff --git a/luni/src/test/java/libcore/java/nio/file/LinuxFileSystemTest.java b/luni/src/test/java/libcore/java/nio/file/LinuxFileSystemTest.java
index ce25ed3..54d9b43 100644
--- a/luni/src/test/java/libcore/java/nio/file/LinuxFileSystemTest.java
+++ b/luni/src/test/java/libcore/java/nio/file/LinuxFileSystemTest.java
@@ -104,7 +104,7 @@
FileStore filestore = getFilestore("/");
assertEquals(0, filestore.getBlockSize() % 512);
assertTrue(filestore.getTotalSpace() > 0);
- assertTrue(filestore.getUnallocatedSpace() > 0);
+ assertTrue(filestore.getUnallocatedSpace() >= 0);
assertTrue(filestore.getUsableSpace() >= 0);
}
diff --git a/luni/src/test/java/libcore/java/security/spec/EdECPointTest.java b/luni/src/test/java/libcore/java/security/spec/EdECPointTest.java
new file mode 100644
index 0000000..95b3951
--- /dev/null
+++ b/luni/src/test/java/libcore/java/security/spec/EdECPointTest.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package libcore.java.security.spec;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.math.BigInteger;
+import java.security.spec.EdECPoint;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public class EdECPointTest {
+
+ @Test
+ public void testConstructor() {
+ EdECPoint p = new EdECPoint(false, BigInteger.TEN);
+ assertFalse(p.isXOdd());
+ assertEquals(BigInteger.TEN, p.getY());
+
+ p = new EdECPoint(true, BigInteger.valueOf(Long.MAX_VALUE));
+ assertTrue(p.isXOdd());
+ assertEquals(BigInteger.valueOf(Long.MAX_VALUE), p.getY());
+ }
+}
diff --git a/luni/src/test/java/libcore/java/security/spec/EdECPrivateKeySpecTest.java b/luni/src/test/java/libcore/java/security/spec/EdECPrivateKeySpecTest.java
new file mode 100644
index 0000000..f5e0604
--- /dev/null
+++ b/luni/src/test/java/libcore/java/security/spec/EdECPrivateKeySpecTest.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package libcore.java.security.spec;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+
+import java.security.spec.EdECPrivateKeySpec;
+import java.security.spec.NamedParameterSpec;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public class EdECPrivateKeySpecTest {
+
+ @Test
+ public void testConstructor() {
+ byte[] bytes = new byte[] {9, 8, 7};
+ EdECPrivateKeySpec keySpec = new EdECPrivateKeySpec(NamedParameterSpec.ED448, bytes);
+ assertEquals(NamedParameterSpec.ED448, keySpec.getParams());
+ assertArrayEquals(bytes, keySpec.getBytes());
+
+ bytes = new byte[] {1, 3, 5, 7, 9};
+ keySpec = new EdECPrivateKeySpec(NamedParameterSpec.ED25519, bytes);
+ assertEquals(NamedParameterSpec.ED25519, keySpec.getParams());
+ assertArrayEquals(bytes, keySpec.getBytes());
+ }
+}
diff --git a/luni/src/test/java/libcore/java/security/spec/EdECPublicKeySpecTest.java b/luni/src/test/java/libcore/java/security/spec/EdECPublicKeySpecTest.java
new file mode 100644
index 0000000..cc58871
--- /dev/null
+++ b/luni/src/test/java/libcore/java/security/spec/EdECPublicKeySpecTest.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package libcore.java.security.spec;
+
+import static org.junit.Assert.assertEquals;
+
+import java.math.BigInteger;
+import java.security.spec.EdECPoint;
+import java.security.spec.EdECPublicKeySpec;
+import java.security.spec.NamedParameterSpec;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public class EdECPublicKeySpecTest {
+
+ @Test
+ public void testConstructor() {
+ EdECPoint point = new EdECPoint(true, BigInteger.ONE);
+ EdECPublicKeySpec keySpec = new EdECPublicKeySpec(NamedParameterSpec.ED448, point);
+ assertEquals(NamedParameterSpec.ED448, keySpec.getParams());
+ assertEquals(point.isXOdd(), keySpec.getPoint().isXOdd());
+ assertEquals(point.getY(), keySpec.getPoint().getY());
+
+ point = new EdECPoint(false, BigInteger.TEN);
+ keySpec = new EdECPublicKeySpec(NamedParameterSpec.ED25519, point);
+ assertEquals(NamedParameterSpec.ED25519, keySpec.getParams());
+ assertEquals(point.isXOdd(), keySpec.getPoint().isXOdd());
+ assertEquals(point.getY(), keySpec.getPoint().getY());
+ }
+}
diff --git a/luni/src/test/java/libcore/java/security/spec/XECPrivateKeySpecTest.java b/luni/src/test/java/libcore/java/security/spec/XECPrivateKeySpecTest.java
new file mode 100644
index 0000000..64b84e1
--- /dev/null
+++ b/luni/src/test/java/libcore/java/security/spec/XECPrivateKeySpecTest.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package libcore.java.security.spec;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+
+import java.security.spec.MGF1ParameterSpec;
+import java.security.spec.NamedParameterSpec;
+import java.security.spec.XECPrivateKeySpec;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public class XECPrivateKeySpecTest {
+
+ @Test
+ public void testConstructor() {
+ byte[] scalar = new byte[] {9, 8, 7};
+ XECPrivateKeySpec keySpec = new XECPrivateKeySpec(NamedParameterSpec.X25519, scalar);
+ assertEquals(NamedParameterSpec.X25519, keySpec.getParams());
+ assertArrayEquals(scalar, keySpec.getScalar());
+
+ scalar = new byte[] {1, 3, 5, 7, 9};
+ keySpec = new XECPrivateKeySpec(MGF1ParameterSpec.SHA512, scalar);
+ assertEquals(MGF1ParameterSpec.SHA512, keySpec.getParams());
+ assertArrayEquals(scalar, keySpec.getScalar());
+ }
+}
diff --git a/luni/src/test/java/libcore/java/security/spec/XECPublicKeySpecTest.java b/luni/src/test/java/libcore/java/security/spec/XECPublicKeySpecTest.java
new file mode 100644
index 0000000..5d4f8b1
--- /dev/null
+++ b/luni/src/test/java/libcore/java/security/spec/XECPublicKeySpecTest.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package libcore.java.security.spec;
+
+import static org.junit.Assert.assertEquals;
+
+import java.math.BigInteger;
+import java.security.spec.MGF1ParameterSpec;
+import java.security.spec.NamedParameterSpec;
+import java.security.spec.XECPublicKeySpec;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public class XECPublicKeySpecTest {
+
+ @Test
+ public void testConstructor() {
+ XECPublicKeySpec keySpec = new XECPublicKeySpec(NamedParameterSpec.X25519, BigInteger.TEN);
+ assertEquals(NamedParameterSpec.X25519, keySpec.getParams());
+ assertEquals(BigInteger.TEN, keySpec.getU());
+
+ keySpec = new XECPublicKeySpec(MGF1ParameterSpec.SHA512, BigInteger.ONE);
+ assertEquals(MGF1ParameterSpec.SHA512, keySpec.getParams());
+ assertEquals(BigInteger.ONE, keySpec.getU());
+ }
+}
diff --git a/luni/src/test/java/libcore/javax/xml/namespace/QNameTest.java b/luni/src/test/java/libcore/javax/xml/namespace/QNameTest.java
index 8214c11..b0afcae 100644
--- a/luni/src/test/java/libcore/javax/xml/namespace/QNameTest.java
+++ b/luni/src/test/java/libcore/javax/xml/namespace/QNameTest.java
@@ -27,6 +27,32 @@
assertEquals("hello", qName.getLocalPart());
}
+ public void testEquals() {
+ QName qName = new QName("namespace", "local part", "prefix");
+ assertTrue(qName.equals(qName));
+ assertFalse(qName.equals(null));
+ assertFalse(qName.equals(new Object()));
+
+ QName qNameSame = new QName("namespace", "local part", "prefix");
+ assertTrue(qName.equals(qNameSame));
+ assertTrue(qNameSame.equals(qName));
+
+ // Check the namespace is considered in equality considerations.
+ QName qNameDifferentNamespace = new QName("another namespace", "local part", "prefix");
+ assertFalse(qName.equals(qNameDifferentNamespace));
+ assertFalse(qNameDifferentNamespace.equals(qName));
+
+ // Check the local part is considered in equality considerations.
+ QName qNameDifferentLocalPart = new QName("namespace", "another local part", "prefix");
+ assertFalse(qName.equals(qNameDifferentLocalPart));
+ assertFalse(qNameDifferentLocalPart.equals(qName));
+
+ // Check the prefix is not considered in equality considerations.
+ QName qNameDifferentPrefix = new QName("namespace", "local part", "another prefix");
+ assertTrue(qName.equals(qNameDifferentPrefix));
+ assertTrue(qNameDifferentPrefix.equals(qName));
+ }
+
public void testGetNamespaceURI() {
QName qName = new QName("namespace", "local part", "prefix");
assertEquals("namespace", qName.getNamespaceURI());
diff --git a/luni/src/test/java/libcore/javax/xml/transform/TransformerConfigurationExceptionTest.java b/luni/src/test/java/libcore/javax/xml/transform/TransformerConfigurationExceptionTest.java
index c72af96..254a586 100644
--- a/luni/src/test/java/libcore/javax/xml/transform/TransformerConfigurationExceptionTest.java
+++ b/luni/src/test/java/libcore/javax/xml/transform/TransformerConfigurationExceptionTest.java
@@ -71,4 +71,12 @@
assertEquals("java.lang.Throwable", e.getMessage());
assertEquals(t, e.getCause());
}
+
+ @Test
+ public void constructorWithString() {
+ TransformerConfigurationException e = new TransformerConfigurationException("message");
+ assertEquals("message", e.getMessage());
+ assertNull(e.getCause());
+ assertNull(e.getLocator());
+ }
}
diff --git a/luni/src/test/java/libcore/javax/xml/transform/sax/SAXSourceTest.java b/luni/src/test/java/libcore/javax/xml/transform/sax/SAXSourceTest.java
index 9a35869..a032a36 100644
--- a/luni/src/test/java/libcore/javax/xml/transform/sax/SAXSourceTest.java
+++ b/luni/src/test/java/libcore/javax/xml/transform/sax/SAXSourceTest.java
@@ -17,10 +17,15 @@
package libcore.javax.xml.transform.sax;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import java.io.IOException;
+import java.io.StringReader;
+
+import javax.xml.transform.Source;
import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -81,6 +86,32 @@
assertNull(source.getXMLReader());
}
+ @Test
+ public void sourceToInputSource() {
+ XMLReader reader = new XMLReaderImpl();
+ InputSource is = new InputSource();
+ source = new SAXSource(reader, is);
+ assertEquals(is, SAXSource.sourceToInputSource(source));
+
+ StreamSource ss = new StreamSource(new StringReader("<tag></tag>"));
+ assertNotNull(SAXSource.sourceToInputSource(ss));
+
+ assertNull(SAXSource.sourceToInputSource(new UnknownSource()));
+ assertNull(SAXSource.sourceToInputSource(null));
+ }
+
+ private static final class UnknownSource implements Source {
+ private String systemId;
+
+ public void setSystemId(String systemId) {
+ this.systemId = systemId;
+ }
+
+ public String getSystemId() {
+ return systemId;
+ }
+ }
+
private static final class XMLReaderImpl implements XMLReader {
@Override
diff --git a/luni/src/test/java/libcore/javax/xml/transform/stream/StreamResultTest.java b/luni/src/test/java/libcore/javax/xml/transform/stream/StreamResultTest.java
new file mode 100644
index 0000000..c4d3be4
--- /dev/null
+++ b/luni/src/test/java/libcore/javax/xml/transform/stream/StreamResultTest.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package libcore.javax.xml.transform.stream;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.StringWriter;
+
+import javax.xml.transform.stream.StreamResult;
+
+@RunWith(JUnit4.class)
+public class StreamResultTest {
+
+ @Test
+ public void constructor() {
+ StreamResult sr = new StreamResult();
+ assertNull(sr.getOutputStream());
+ assertNull(sr.getSystemId());
+ assertNull(sr.getWriter());
+ }
+
+ @Test
+ public void constructorWithFile() throws IOException {
+ final String PREFIX = "StreamResultTest52";
+ File file = File.createTempFile(PREFIX, null);
+ StreamResult sr = new StreamResult(file);
+ assertNull(sr.getOutputStream());
+ assertTrue(sr.getSystemId().contains(PREFIX));
+ assertNull(sr.getWriter());
+ if (file.exists()) {
+ file.delete();
+ }
+ }
+
+ @Test
+ public void constructorWithOutputStream() {
+ ByteArrayOutputStream os = new ByteArrayOutputStream(16);
+ StreamResult sr = new StreamResult(os);
+ assertEquals(os, sr.getOutputStream());
+ assertNull(sr.getSystemId());
+ assertNull(sr.getWriter());
+ }
+
+ @Test
+ public void constructorWithSystemId() {
+ final String ID = "System74";
+ StreamResult sr = new StreamResult(ID);
+ assertNull(sr.getOutputStream());
+ assertEquals(ID, sr.getSystemId());
+ assertNull(sr.getWriter());
+ }
+
+ @Test
+ public void constructorWithWriter() {
+ StringWriter sw = new StringWriter();
+ StreamResult sr = new StreamResult(sw);
+ assertNull(sr.getOutputStream());
+ assertNull(sr.getSystemId());
+ assertEquals(sw, sr.getWriter());
+ }
+
+ @Test
+ public void setOutputStream() {
+ StreamResult sr = new StreamResult();
+ ByteArrayOutputStream os = new ByteArrayOutputStream(16);
+ sr.setOutputStream(os);
+ assertEquals(os, sr.getOutputStream());
+ }
+
+ @Test
+ public void setSystemIdWithFile() throws IOException {
+ final String PREFIX = "StreamResultTest100";
+ StreamResult sr = new StreamResult();
+ File file = File.createTempFile(PREFIX, null);
+ sr.setSystemId(file);
+ assertTrue(sr.getSystemId().contains(PREFIX));
+ if (file.exists()) {
+ file.delete();
+ }
+ }
+
+ @Test
+ public void setSystemIdWithString() {
+ final String ID = "System112";
+ StreamResult sr = new StreamResult();
+ sr.setSystemId(ID);
+ assertEquals(ID, sr.getSystemId());
+ }
+
+ @Test
+ public void setWriter() {
+ StreamResult sr = new StreamResult();
+ StringWriter sw = new StringWriter();
+ sr.setWriter(sw);
+ assertEquals(sw, sr.getWriter());
+ }
+}
diff --git a/luni/src/test/java/libcore/javax/xml/transform/stream/StreamSourceTest.java b/luni/src/test/java/libcore/javax/xml/transform/stream/StreamSourceTest.java
new file mode 100644
index 0000000..58d8155
--- /dev/null
+++ b/luni/src/test/java/libcore/javax/xml/transform/stream/StreamSourceTest.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package libcore.javax.xml.transform.stream;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import java.io.File;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import javax.xml.transform.Result;
+import javax.xml.transform.stream.StreamSource;
+
+@RunWith(JUnit4.class)
+public class StreamSourceTest {
+
+ @Test
+ public void constructor() {
+ StreamSource ss = new StreamSource();
+ assertNull(ss.getInputStream());
+ assertNull(ss.getPublicId());
+ assertNull(ss.getReader());
+ assertNull(ss.getSystemId());
+ }
+
+ @Test
+ public void constructorWithFile() throws IOException {
+ final String PREFIX = "StreamSourceTest";
+ File file = File.createTempFile(PREFIX, null);
+ StreamSource ss = new StreamSource(file);
+ assertNull(ss.getInputStream());
+ assertNull(ss.getPublicId());
+ assertNull(ss.getReader());
+ assertTrue("SystemId is " + ss.getSystemId(), ss.getSystemId().contains(PREFIX));
+ if (file.exists()) {
+ file.delete();
+ }
+ }
+
+ @Test
+ public void constructorWithInputStreamAndSystemId() {
+ final String SYSTEM_ID = "System 65";
+ ByteArrayInputStream is = new ByteArrayInputStream(new byte[] { (byte) 0 });
+ StreamSource ss = new StreamSource(is, SYSTEM_ID);
+ assertEquals(is, ss.getInputStream());
+ assertNull(ss.getPublicId());
+ assertNull(ss.getReader());
+ assertEquals(SYSTEM_ID, ss.getSystemId());
+ }
+
+ @Test
+ public void constructorWithSystemId() {
+ final String SYSTEM_ID = "System 76";
+ StreamSource ss = new StreamSource(SYSTEM_ID);
+ assertNull(ss.getInputStream());
+ assertNull(ss.getPublicId());
+ assertNull(ss.getReader());
+ assertEquals(SYSTEM_ID, ss.getSystemId());
+ }
+
+ @Test
+ public void constructorWithReader() {
+ StringReader sr = new StringReader("House");
+ StreamSource ss = new StreamSource(sr);
+ assertNull(ss.getInputStream());
+ assertNull(ss.getPublicId());
+ assertEquals(sr, ss.getReader());
+ assertNull(ss.getSystemId());
+ }
+
+ @Test
+ public void constructorWithReaderAndSystemId() {
+ final String SYSTEM_ID = "System 96";
+ StringReader sr = new StringReader("House");
+ StreamSource ss = new StreamSource(sr, SYSTEM_ID);
+ assertNull(ss.getInputStream());
+ assertNull(ss.getPublicId());
+ assertEquals(sr, ss.getReader());
+ assertEquals(SYSTEM_ID, ss.getSystemId());
+ }
+
+ @Test
+ public void setInputStream() {
+ StreamSource ss = new StreamSource();
+ ByteArrayInputStream is = new ByteArrayInputStream(new byte[] {(byte) 0});
+ ss.setInputStream(is);
+ assertEquals(is, ss.getInputStream());
+ }
+
+ @Test
+ public void setReader() {
+ StreamSource ss = new StreamSource();
+ StringReader sr = new StringReader("Thirteen-twenty-one");
+ ss.setReader(sr);
+ assertEquals(sr, ss.getReader());
+ }
+
+ @Test
+ public void setPublicId() {
+ final String PUBLIC_ID = "Thirteen-twenty-three";
+ StreamSource ss = new StreamSource();
+ ss.setPublicId(PUBLIC_ID);
+ assertEquals(PUBLIC_ID, ss.getPublicId());
+ }
+
+ @Test
+ public void setSystemId() {
+ final String SYSTEM_ID = "Thirteen-twenty-four";
+ StreamSource ss = new StreamSource();
+ ss.setSystemId(SYSTEM_ID);
+ assertEquals(SYSTEM_ID, ss.getSystemId());
+ }
+
+ @Test
+ public void setSystemIdWithFile() throws IOException {
+ final String PREFIX = "StreamSourceTest100";
+ StreamSource ss = new StreamSource();
+ File file = File.createTempFile(PREFIX, null);
+ ss.setSystemId(file);
+ assertTrue(ss.getSystemId().contains(PREFIX));
+ if (file.exists()) {
+ file.delete();
+ }
+ }
+}
diff --git a/ojluni/annotations/mmodule/java/time/Clock.annotated.java b/ojluni/annotations/mmodule/java/time/Clock.annotated.java
new file mode 100644
index 0000000..a7ec571
--- /dev/null
+++ b/ojluni/annotations/mmodule/java/time/Clock.annotated.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2007-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of JSR-310 nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package java.time;
+
+import libcore.api.Hide;
+
+@SuppressWarnings({"unchecked", "deprecation", "all"})
+public abstract class Clock {
+
+protected Clock() { throw new RuntimeException("Stub!"); }
+
+public static java.time.Clock systemUTC() { throw new RuntimeException("Stub!"); }
+
+public static java.time.Clock systemDefaultZone() { throw new RuntimeException("Stub!"); }
+
+public static java.time.Clock system(java.time.ZoneId zone) { throw new RuntimeException("Stub!"); }
+
+@Hide
+public static java.time.Clock tickMillis(java.time.ZoneId zone) { throw new RuntimeException("Stub!"); }
+
+public static java.time.Clock tickSeconds(java.time.ZoneId zone) { throw new RuntimeException("Stub!"); }
+
+public static java.time.Clock tickMinutes(java.time.ZoneId zone) { throw new RuntimeException("Stub!"); }
+
+public static java.time.Clock tick(java.time.Clock baseClock, java.time.Duration tickDuration) { throw new RuntimeException("Stub!"); }
+
+public static java.time.Clock fixed(java.time.Instant fixedInstant, java.time.ZoneId zone) { throw new RuntimeException("Stub!"); }
+
+public static java.time.Clock offset(java.time.Clock baseClock, java.time.Duration offsetDuration) { throw new RuntimeException("Stub!"); }
+
+public abstract java.time.ZoneId getZone();
+
+public abstract java.time.Clock withZone(java.time.ZoneId zone);
+
+public long millis() { throw new RuntimeException("Stub!"); }
+
+public abstract java.time.Instant instant();
+
+public boolean equals(java.lang.Object obj) { throw new RuntimeException("Stub!"); }
+
+public int hashCode() { throw new RuntimeException("Stub!"); }
+}
+
diff --git a/ojluni/annotations/mmodule/java/time/LocalDate.annotated.java b/ojluni/annotations/mmodule/java/time/LocalDate.annotated.java
new file mode 100644
index 0000000..1f74bb9
--- /dev/null
+++ b/ojluni/annotations/mmodule/java/time/LocalDate.annotated.java
@@ -0,0 +1,222 @@
+/*
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2007-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of JSR-310 nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package java.time;
+
+import libcore.api.Hide;
+
+@SuppressWarnings({"unchecked", "deprecation", "all"})
+public final class LocalDate implements java.time.temporal.Temporal, java.time.temporal.TemporalAdjuster, java.time.chrono.ChronoLocalDate, java.io.Serializable {
+
+private LocalDate() { throw new RuntimeException("Stub!"); }
+
+public static java.time.LocalDate now() { throw new RuntimeException("Stub!"); }
+
+public static java.time.LocalDate now(java.time.ZoneId zone) { throw new RuntimeException("Stub!"); }
+
+public static java.time.LocalDate now(java.time.Clock clock) { throw new RuntimeException("Stub!"); }
+
+public static java.time.LocalDate of(int year, java.time.Month month, int dayOfMonth) { throw new RuntimeException("Stub!"); }
+
+public static java.time.LocalDate of(int year, int month, int dayOfMonth) { throw new RuntimeException("Stub!"); }
+
+public static java.time.LocalDate ofYearDay(int year, int dayOfYear) { throw new RuntimeException("Stub!"); }
+
+@Hide
+public static java.time.LocalDate ofInstant(java.time.Instant instant, java.time.ZoneId zone) { throw new RuntimeException("Stub!"); }
+
+public static java.time.LocalDate ofEpochDay(long epochDay) { throw new RuntimeException("Stub!"); }
+
+public static java.time.LocalDate from(java.time.temporal.TemporalAccessor temporal) { throw new RuntimeException("Stub!"); }
+
+public static java.time.LocalDate parse(java.lang.CharSequence text) { throw new RuntimeException("Stub!"); }
+
+public static java.time.LocalDate parse(java.lang.CharSequence text, java.time.format.DateTimeFormatter formatter) { throw new RuntimeException("Stub!"); }
+
+public boolean isSupported(java.time.temporal.TemporalField field) { throw new RuntimeException("Stub!"); }
+
+public boolean isSupported(java.time.temporal.TemporalUnit unit) { throw new RuntimeException("Stub!"); }
+
+public java.time.temporal.ValueRange range(java.time.temporal.TemporalField field) { throw new RuntimeException("Stub!"); }
+
+public int get(java.time.temporal.TemporalField field) { throw new RuntimeException("Stub!"); }
+
+public long getLong(java.time.temporal.TemporalField field) { throw new RuntimeException("Stub!"); }
+
+public java.time.chrono.IsoChronology getChronology() { throw new RuntimeException("Stub!"); }
+
+public java.time.chrono.Era getEra() { throw new RuntimeException("Stub!"); }
+
+public int getYear() { throw new RuntimeException("Stub!"); }
+
+public int getMonthValue() { throw new RuntimeException("Stub!"); }
+
+public java.time.Month getMonth() { throw new RuntimeException("Stub!"); }
+
+public int getDayOfMonth() { throw new RuntimeException("Stub!"); }
+
+public int getDayOfYear() { throw new RuntimeException("Stub!"); }
+
+public java.time.DayOfWeek getDayOfWeek() { throw new RuntimeException("Stub!"); }
+
+public boolean isLeapYear() { throw new RuntimeException("Stub!"); }
+
+public int lengthOfMonth() { throw new RuntimeException("Stub!"); }
+
+public int lengthOfYear() { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate with(java.time.temporal.TemporalAdjuster adjuster) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate with(java.time.temporal.TemporalField field, long newValue) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate withYear(int year) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate withMonth(int month) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate withDayOfMonth(int dayOfMonth) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate withDayOfYear(int dayOfYear) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate plus(java.time.temporal.TemporalAmount amountToAdd) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate plus(long amountToAdd, java.time.temporal.TemporalUnit unit) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate plusYears(long yearsToAdd) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate plusMonths(long monthsToAdd) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate plusWeeks(long weeksToAdd) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate plusDays(long daysToAdd) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate minus(java.time.temporal.TemporalAmount amountToSubtract) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate minus(long amountToSubtract, java.time.temporal.TemporalUnit unit) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate minusYears(long yearsToSubtract) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate minusMonths(long monthsToSubtract) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate minusWeeks(long weeksToSubtract) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate minusDays(long daysToSubtract) { throw new RuntimeException("Stub!"); }
+
+public <R> R query(java.time.temporal.TemporalQuery<R> query) { throw new RuntimeException("Stub!"); }
+
+public java.time.temporal.Temporal adjustInto(java.time.temporal.Temporal temporal) { throw new RuntimeException("Stub!"); }
+
+public long until(java.time.temporal.Temporal endExclusive, java.time.temporal.TemporalUnit unit) { throw new RuntimeException("Stub!"); }
+
+public java.time.Period until(java.time.chrono.ChronoLocalDate endDateExclusive) { throw new RuntimeException("Stub!"); }
+
+@Hide
+public java.util.stream.Stream<java.time.LocalDate> datesUntil(java.time.LocalDate endExclusive) { throw new RuntimeException("Stub!"); }
+
+@Hide
+public java.util.stream.Stream<java.time.LocalDate> datesUntil(java.time.LocalDate endExclusive, java.time.Period step) { throw new RuntimeException("Stub!"); }
+
+public java.lang.String format(java.time.format.DateTimeFormatter formatter) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDateTime atTime(java.time.LocalTime time) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDateTime atTime(int hour, int minute) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDateTime atTime(int hour, int minute, int second) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDateTime atTime(int hour, int minute, int second, int nanoOfSecond) { throw new RuntimeException("Stub!"); }
+
+public java.time.OffsetDateTime atTime(java.time.OffsetTime time) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDateTime atStartOfDay() { throw new RuntimeException("Stub!"); }
+
+public java.time.ZonedDateTime atStartOfDay(java.time.ZoneId zone) { throw new RuntimeException("Stub!"); }
+
+public long toEpochDay() { throw new RuntimeException("Stub!"); }
+
+@Hide
+public long toEpochSecond(java.time.LocalTime time, java.time.ZoneOffset offset) { throw new RuntimeException("Stub!"); }
+
+public int compareTo(java.time.chrono.ChronoLocalDate other) { throw new RuntimeException("Stub!"); }
+
+public boolean isAfter(java.time.chrono.ChronoLocalDate other) { throw new RuntimeException("Stub!"); }
+
+public boolean isBefore(java.time.chrono.ChronoLocalDate other) { throw new RuntimeException("Stub!"); }
+
+public boolean isEqual(java.time.chrono.ChronoLocalDate other) { throw new RuntimeException("Stub!"); }
+
+public boolean equals(java.lang.Object obj) { throw new RuntimeException("Stub!"); }
+
+public int hashCode() { throw new RuntimeException("Stub!"); }
+
+public java.lang.String toString() { throw new RuntimeException("Stub!"); }
+
+@Hide
+public static final java.time.LocalDate EPOCH;
+static { EPOCH = null; }
+
+public static final java.time.LocalDate MAX;
+static { MAX = null; }
+
+public static final java.time.LocalDate MIN;
+static { MIN = null; }
+}
+
diff --git a/ojluni/annotations/mmodule/java/time/OffsetTime.annotated.java b/ojluni/annotations/mmodule/java/time/OffsetTime.annotated.java
new file mode 100644
index 0000000..6707851
--- /dev/null
+++ b/ojluni/annotations/mmodule/java/time/OffsetTime.annotated.java
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2007-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of JSR-310 nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package java.time;
+
+import libcore.api.Hide;
+
+@SuppressWarnings({"unchecked", "deprecation", "all"})
+public final class OffsetTime implements java.time.temporal.Temporal, java.time.temporal.TemporalAdjuster, java.lang.Comparable<java.time.OffsetTime>, java.io.Serializable {
+
+private OffsetTime() { throw new RuntimeException("Stub!"); }
+
+public static java.time.OffsetTime now() { throw new RuntimeException("Stub!"); }
+
+public static java.time.OffsetTime now(java.time.ZoneId zone) { throw new RuntimeException("Stub!"); }
+
+public static java.time.OffsetTime now(java.time.Clock clock) { throw new RuntimeException("Stub!"); }
+
+public static java.time.OffsetTime of(java.time.LocalTime time, java.time.ZoneOffset offset) { throw new RuntimeException("Stub!"); }
+
+public static java.time.OffsetTime of(int hour, int minute, int second, int nanoOfSecond, java.time.ZoneOffset offset) { throw new RuntimeException("Stub!"); }
+
+public static java.time.OffsetTime ofInstant(java.time.Instant instant, java.time.ZoneId zone) { throw new RuntimeException("Stub!"); }
+
+public static java.time.OffsetTime from(java.time.temporal.TemporalAccessor temporal) { throw new RuntimeException("Stub!"); }
+
+public static java.time.OffsetTime parse(java.lang.CharSequence text) { throw new RuntimeException("Stub!"); }
+
+public static java.time.OffsetTime parse(java.lang.CharSequence text, java.time.format.DateTimeFormatter formatter) { throw new RuntimeException("Stub!"); }
+
+public boolean isSupported(java.time.temporal.TemporalField field) { throw new RuntimeException("Stub!"); }
+
+public boolean isSupported(java.time.temporal.TemporalUnit unit) { throw new RuntimeException("Stub!"); }
+
+public java.time.temporal.ValueRange range(java.time.temporal.TemporalField field) { throw new RuntimeException("Stub!"); }
+
+public int get(java.time.temporal.TemporalField field) { throw new RuntimeException("Stub!"); }
+
+public long getLong(java.time.temporal.TemporalField field) { throw new RuntimeException("Stub!"); }
+
+public java.time.ZoneOffset getOffset() { throw new RuntimeException("Stub!"); }
+
+public java.time.OffsetTime withOffsetSameLocal(java.time.ZoneOffset offset) { throw new RuntimeException("Stub!"); }
+
+public java.time.OffsetTime withOffsetSameInstant(java.time.ZoneOffset offset) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalTime toLocalTime() { throw new RuntimeException("Stub!"); }
+
+public int getHour() { throw new RuntimeException("Stub!"); }
+
+public int getMinute() { throw new RuntimeException("Stub!"); }
+
+public int getSecond() { throw new RuntimeException("Stub!"); }
+
+public int getNano() { throw new RuntimeException("Stub!"); }
+
+public java.time.OffsetTime with(java.time.temporal.TemporalAdjuster adjuster) { throw new RuntimeException("Stub!"); }
+
+public java.time.OffsetTime with(java.time.temporal.TemporalField field, long newValue) { throw new RuntimeException("Stub!"); }
+
+public java.time.OffsetTime withHour(int hour) { throw new RuntimeException("Stub!"); }
+
+public java.time.OffsetTime withMinute(int minute) { throw new RuntimeException("Stub!"); }
+
+public java.time.OffsetTime withSecond(int second) { throw new RuntimeException("Stub!"); }
+
+public java.time.OffsetTime withNano(int nanoOfSecond) { throw new RuntimeException("Stub!"); }
+
+public java.time.OffsetTime truncatedTo(java.time.temporal.TemporalUnit unit) { throw new RuntimeException("Stub!"); }
+
+public java.time.OffsetTime plus(java.time.temporal.TemporalAmount amountToAdd) { throw new RuntimeException("Stub!"); }
+
+public java.time.OffsetTime plus(long amountToAdd, java.time.temporal.TemporalUnit unit) { throw new RuntimeException("Stub!"); }
+
+public java.time.OffsetTime plusHours(long hours) { throw new RuntimeException("Stub!"); }
+
+public java.time.OffsetTime plusMinutes(long minutes) { throw new RuntimeException("Stub!"); }
+
+public java.time.OffsetTime plusSeconds(long seconds) { throw new RuntimeException("Stub!"); }
+
+public java.time.OffsetTime plusNanos(long nanos) { throw new RuntimeException("Stub!"); }
+
+public java.time.OffsetTime minus(java.time.temporal.TemporalAmount amountToSubtract) { throw new RuntimeException("Stub!"); }
+
+public java.time.OffsetTime minus(long amountToSubtract, java.time.temporal.TemporalUnit unit) { throw new RuntimeException("Stub!"); }
+
+public java.time.OffsetTime minusHours(long hours) { throw new RuntimeException("Stub!"); }
+
+public java.time.OffsetTime minusMinutes(long minutes) { throw new RuntimeException("Stub!"); }
+
+public java.time.OffsetTime minusSeconds(long seconds) { throw new RuntimeException("Stub!"); }
+
+public java.time.OffsetTime minusNanos(long nanos) { throw new RuntimeException("Stub!"); }
+
+public <R> R query(java.time.temporal.TemporalQuery<R> query) { throw new RuntimeException("Stub!"); }
+
+public java.time.temporal.Temporal adjustInto(java.time.temporal.Temporal temporal) { throw new RuntimeException("Stub!"); }
+
+public long until(java.time.temporal.Temporal endExclusive, java.time.temporal.TemporalUnit unit) { throw new RuntimeException("Stub!"); }
+
+public java.lang.String format(java.time.format.DateTimeFormatter formatter) { throw new RuntimeException("Stub!"); }
+
+public java.time.OffsetDateTime atDate(java.time.LocalDate date) { throw new RuntimeException("Stub!"); }
+
+@Hide
+public long toEpochSecond(java.time.LocalDate date) { throw new RuntimeException("Stub!"); }
+
+public int compareTo(java.time.OffsetTime other) { throw new RuntimeException("Stub!"); }
+
+public boolean isAfter(java.time.OffsetTime other) { throw new RuntimeException("Stub!"); }
+
+public boolean isBefore(java.time.OffsetTime other) { throw new RuntimeException("Stub!"); }
+
+public boolean isEqual(java.time.OffsetTime other) { throw new RuntimeException("Stub!"); }
+
+public boolean equals(java.lang.Object obj) { throw new RuntimeException("Stub!"); }
+
+public int hashCode() { throw new RuntimeException("Stub!"); }
+
+public java.lang.String toString() { throw new RuntimeException("Stub!"); }
+
+public static final java.time.OffsetTime MAX;
+static { MAX = null; }
+
+public static final java.time.OffsetTime MIN;
+static { MIN = null; }
+}
+
diff --git a/ojluni/annotations/mmodule/java/time/chrono/Chronology.annotated.java b/ojluni/annotations/mmodule/java/time/chrono/Chronology.annotated.java
new file mode 100644
index 0000000..1d5e367
--- /dev/null
+++ b/ojluni/annotations/mmodule/java/time/chrono/Chronology.annotated.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of JSR-310 nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package java.time.chrono;
+
+import libcore.api.Hide;
+
+@SuppressWarnings({"unchecked", "deprecation", "all"})
+public interface Chronology extends java.lang.Comparable<java.time.chrono.Chronology> {
+
+public static java.time.chrono.Chronology from(java.time.temporal.TemporalAccessor temporal) { throw new RuntimeException("Stub!"); }
+
+public static java.time.chrono.Chronology ofLocale(java.util.Locale locale) { throw new RuntimeException("Stub!"); }
+
+public static java.time.chrono.Chronology of(java.lang.String id) { throw new RuntimeException("Stub!"); }
+
+public static java.util.Set<java.time.chrono.Chronology> getAvailableChronologies() { throw new RuntimeException("Stub!"); }
+
+public java.lang.String getId();
+
+public java.lang.String getCalendarType();
+
+public default java.time.chrono.ChronoLocalDate date(java.time.chrono.Era era, int yearOfEra, int month, int dayOfMonth) { throw new RuntimeException("Stub!"); }
+
+public java.time.chrono.ChronoLocalDate date(int prolepticYear, int month, int dayOfMonth);
+
+public default java.time.chrono.ChronoLocalDate dateYearDay(java.time.chrono.Era era, int yearOfEra, int dayOfYear) { throw new RuntimeException("Stub!"); }
+
+public java.time.chrono.ChronoLocalDate dateYearDay(int prolepticYear, int dayOfYear);
+
+public java.time.chrono.ChronoLocalDate dateEpochDay(long epochDay);
+
+public default java.time.chrono.ChronoLocalDate dateNow() { throw new RuntimeException("Stub!"); }
+
+public default java.time.chrono.ChronoLocalDate dateNow(java.time.ZoneId zone) { throw new RuntimeException("Stub!"); }
+
+public default java.time.chrono.ChronoLocalDate dateNow(java.time.Clock clock) { throw new RuntimeException("Stub!"); }
+
+public java.time.chrono.ChronoLocalDate date(java.time.temporal.TemporalAccessor temporal);
+
+public default java.time.chrono.ChronoLocalDateTime<? extends java.time.chrono.ChronoLocalDate> localDateTime(java.time.temporal.TemporalAccessor temporal) { throw new RuntimeException("Stub!"); }
+
+public default java.time.chrono.ChronoZonedDateTime<? extends java.time.chrono.ChronoLocalDate> zonedDateTime(java.time.temporal.TemporalAccessor temporal) { throw new RuntimeException("Stub!"); }
+
+public default java.time.chrono.ChronoZonedDateTime<? extends java.time.chrono.ChronoLocalDate> zonedDateTime(java.time.Instant instant, java.time.ZoneId zone) { throw new RuntimeException("Stub!"); }
+
+public boolean isLeapYear(long prolepticYear);
+
+public int prolepticYear(java.time.chrono.Era era, int yearOfEra);
+
+public java.time.chrono.Era eraOf(int eraValue);
+
+public java.util.List<java.time.chrono.Era> eras();
+
+public java.time.temporal.ValueRange range(java.time.temporal.ChronoField field);
+
+public default java.lang.String getDisplayName(java.time.format.TextStyle style, java.util.Locale locale) { throw new RuntimeException("Stub!"); }
+
+public java.time.chrono.ChronoLocalDate resolveDate(java.util.Map<java.time.temporal.TemporalField,java.lang.Long> fieldValues, java.time.format.ResolverStyle resolverStyle);
+
+public default java.time.chrono.ChronoPeriod period(int years, int months, int days) { throw new RuntimeException("Stub!"); }
+
+@Hide
+public default long epochSecond(int prolepticYear, int month, int dayOfMonth, int hour, int minute, int second, java.time.ZoneOffset zoneOffset) { throw new RuntimeException("Stub!"); }
+
+@Hide
+public default long epochSecond(java.time.chrono.Era era, int yearOfEra, int month, int dayOfMonth, int hour, int minute, int second, java.time.ZoneOffset zoneOffset) { throw new RuntimeException("Stub!"); }
+
+public int compareTo(java.time.chrono.Chronology other);
+
+public boolean equals(java.lang.Object obj);
+
+public int hashCode();
+
+public java.lang.String toString();
+}
+
diff --git a/ojluni/annotations/mmodule/java/time/chrono/IsoChronology.annotated.java b/ojluni/annotations/mmodule/java/time/chrono/IsoChronology.annotated.java
new file mode 100644
index 0000000..a5a515e
--- /dev/null
+++ b/ojluni/annotations/mmodule/java/time/chrono/IsoChronology.annotated.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of JSR-310 nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package java.time.chrono;
+
+import libcore.api.Hide;
+
+@SuppressWarnings({"unchecked", "deprecation", "all"})
+public final class IsoChronology extends java.time.chrono.AbstractChronology implements java.io.Serializable {
+
+private IsoChronology() { throw new RuntimeException("Stub!"); }
+
+public java.lang.String getId() { throw new RuntimeException("Stub!"); }
+
+public java.lang.String getCalendarType() { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate date(java.time.chrono.Era era, int yearOfEra, int month, int dayOfMonth) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate date(int prolepticYear, int month, int dayOfMonth) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate dateYearDay(java.time.chrono.Era era, int yearOfEra, int dayOfYear) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate dateYearDay(int prolepticYear, int dayOfYear) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate dateEpochDay(long epochDay) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate date(java.time.temporal.TemporalAccessor temporal) { throw new RuntimeException("Stub!"); }
+
+@Hide
+public long epochSecond(int prolepticYear, int month, int dayOfMonth, int hour, int minute, int second, java.time.ZoneOffset zoneOffset) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDateTime localDateTime(java.time.temporal.TemporalAccessor temporal) { throw new RuntimeException("Stub!"); }
+
+public java.time.ZonedDateTime zonedDateTime(java.time.temporal.TemporalAccessor temporal) { throw new RuntimeException("Stub!"); }
+
+public java.time.ZonedDateTime zonedDateTime(java.time.Instant instant, java.time.ZoneId zone) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate dateNow() { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate dateNow(java.time.ZoneId zone) { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate dateNow(java.time.Clock clock) { throw new RuntimeException("Stub!"); }
+
+public boolean isLeapYear(long prolepticYear) { throw new RuntimeException("Stub!"); }
+
+public int prolepticYear(java.time.chrono.Era era, int yearOfEra) { throw new RuntimeException("Stub!"); }
+
+public java.time.chrono.IsoEra eraOf(int eraValue) { throw new RuntimeException("Stub!"); }
+
+public java.util.List<java.time.chrono.Era> eras() { throw new RuntimeException("Stub!"); }
+
+public java.time.LocalDate resolveDate(java.util.Map<java.time.temporal.TemporalField,java.lang.Long> fieldValues, java.time.format.ResolverStyle resolverStyle) { throw new RuntimeException("Stub!"); }
+
+public java.time.temporal.ValueRange range(java.time.temporal.ChronoField field) { throw new RuntimeException("Stub!"); }
+
+public java.time.Period period(int years, int months, int days) { throw new RuntimeException("Stub!"); }
+
+public static final java.time.chrono.IsoChronology INSTANCE;
+static { INSTANCE = null; }
+}
+
diff --git a/ojluni/annotations/mmodule/java/time/format/DateTimeFormatter.annotated.java b/ojluni/annotations/mmodule/java/time/format/DateTimeFormatter.annotated.java
new file mode 100644
index 0000000..2334429
--- /dev/null
+++ b/ojluni/annotations/mmodule/java/time/format/DateTimeFormatter.annotated.java
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of JSR-310 nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package java.time.format;
+
+import libcore.api.Hide;
+
+@SuppressWarnings({"unchecked", "deprecation", "all"})
+public final class DateTimeFormatter {
+
+DateTimeFormatter() { throw new RuntimeException("Stub!"); }
+
+public static java.time.format.DateTimeFormatter ofPattern(java.lang.String pattern) { throw new RuntimeException("Stub!"); }
+
+public static java.time.format.DateTimeFormatter ofPattern(java.lang.String pattern, java.util.Locale locale) { throw new RuntimeException("Stub!"); }
+
+public static java.time.format.DateTimeFormatter ofLocalizedDate(java.time.format.FormatStyle dateStyle) { throw new RuntimeException("Stub!"); }
+
+public static java.time.format.DateTimeFormatter ofLocalizedTime(java.time.format.FormatStyle timeStyle) { throw new RuntimeException("Stub!"); }
+
+public static java.time.format.DateTimeFormatter ofLocalizedDateTime(java.time.format.FormatStyle dateTimeStyle) { throw new RuntimeException("Stub!"); }
+
+public static java.time.format.DateTimeFormatter ofLocalizedDateTime(java.time.format.FormatStyle dateStyle, java.time.format.FormatStyle timeStyle) { throw new RuntimeException("Stub!"); }
+
+public static java.time.temporal.TemporalQuery<java.time.Period> parsedExcessDays() { throw new RuntimeException("Stub!"); }
+
+public static java.time.temporal.TemporalQuery<java.lang.Boolean> parsedLeapSecond() { throw new RuntimeException("Stub!"); }
+
+public java.util.Locale getLocale() { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatter withLocale(java.util.Locale locale) { throw new RuntimeException("Stub!"); }
+
+@Hide
+public java.time.format.DateTimeFormatter localizedBy(java.util.Locale locale) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DecimalStyle getDecimalStyle() { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatter withDecimalStyle(java.time.format.DecimalStyle decimalStyle) { throw new RuntimeException("Stub!"); }
+
+public java.time.chrono.Chronology getChronology() { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatter withChronology(java.time.chrono.Chronology chrono) { throw new RuntimeException("Stub!"); }
+
+public java.time.ZoneId getZone() { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatter withZone(java.time.ZoneId zone) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.ResolverStyle getResolverStyle() { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatter withResolverStyle(java.time.format.ResolverStyle resolverStyle) { throw new RuntimeException("Stub!"); }
+
+public java.util.Set<java.time.temporal.TemporalField> getResolverFields() { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatter withResolverFields(java.time.temporal.TemporalField... resolverFields) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatter withResolverFields(java.util.Set<java.time.temporal.TemporalField> resolverFields) { throw new RuntimeException("Stub!"); }
+
+public java.lang.String format(java.time.temporal.TemporalAccessor temporal) { throw new RuntimeException("Stub!"); }
+
+public void formatTo(java.time.temporal.TemporalAccessor temporal, java.lang.Appendable appendable) { throw new RuntimeException("Stub!"); }
+
+public java.time.temporal.TemporalAccessor parse(java.lang.CharSequence text) { throw new RuntimeException("Stub!"); }
+
+public java.time.temporal.TemporalAccessor parse(java.lang.CharSequence text, java.text.ParsePosition position) { throw new RuntimeException("Stub!"); }
+
+public <T> T parse(java.lang.CharSequence text, java.time.temporal.TemporalQuery<T> query) { throw new RuntimeException("Stub!"); }
+
+public java.time.temporal.TemporalAccessor parseBest(java.lang.CharSequence text, java.time.temporal.TemporalQuery<?>... queries) { throw new RuntimeException("Stub!"); }
+
+public java.time.temporal.TemporalAccessor parseUnresolved(java.lang.CharSequence text, java.text.ParsePosition position) { throw new RuntimeException("Stub!"); }
+
+public java.text.Format toFormat() { throw new RuntimeException("Stub!"); }
+
+public java.text.Format toFormat(java.time.temporal.TemporalQuery<?> parseQuery) { throw new RuntimeException("Stub!"); }
+
+public java.lang.String toString() { throw new RuntimeException("Stub!"); }
+
+public static final java.time.format.DateTimeFormatter BASIC_ISO_DATE;
+static { BASIC_ISO_DATE = null; }
+
+public static final java.time.format.DateTimeFormatter ISO_DATE;
+static { ISO_DATE = null; }
+
+public static final java.time.format.DateTimeFormatter ISO_DATE_TIME;
+static { ISO_DATE_TIME = null; }
+
+public static final java.time.format.DateTimeFormatter ISO_INSTANT;
+static { ISO_INSTANT = null; }
+
+public static final java.time.format.DateTimeFormatter ISO_LOCAL_DATE;
+static { ISO_LOCAL_DATE = null; }
+
+public static final java.time.format.DateTimeFormatter ISO_LOCAL_DATE_TIME;
+static { ISO_LOCAL_DATE_TIME = null; }
+
+public static final java.time.format.DateTimeFormatter ISO_LOCAL_TIME;
+static { ISO_LOCAL_TIME = null; }
+
+public static final java.time.format.DateTimeFormatter ISO_OFFSET_DATE;
+static { ISO_OFFSET_DATE = null; }
+
+public static final java.time.format.DateTimeFormatter ISO_OFFSET_DATE_TIME;
+static { ISO_OFFSET_DATE_TIME = null; }
+
+public static final java.time.format.DateTimeFormatter ISO_OFFSET_TIME;
+static { ISO_OFFSET_TIME = null; }
+
+public static final java.time.format.DateTimeFormatter ISO_ORDINAL_DATE;
+static { ISO_ORDINAL_DATE = null; }
+
+public static final java.time.format.DateTimeFormatter ISO_TIME;
+static { ISO_TIME = null; }
+
+public static final java.time.format.DateTimeFormatter ISO_WEEK_DATE;
+static { ISO_WEEK_DATE = null; }
+
+public static final java.time.format.DateTimeFormatter ISO_ZONED_DATE_TIME;
+static { ISO_ZONED_DATE_TIME = null; }
+
+public static final java.time.format.DateTimeFormatter RFC_1123_DATE_TIME;
+static { RFC_1123_DATE_TIME = null; }
+}
+
diff --git a/ojluni/annotations/mmodule/java/time/format/DateTimeFormatterBuilder.annotated.java b/ojluni/annotations/mmodule/java/time/format/DateTimeFormatterBuilder.annotated.java
new file mode 100644
index 0000000..6b6873c
--- /dev/null
+++ b/ojluni/annotations/mmodule/java/time/format/DateTimeFormatterBuilder.annotated.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of JSR-310 nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package java.time.format;
+
+import libcore.api.Hide;
+
+@SuppressWarnings({"unchecked", "deprecation", "all"})
+public final class DateTimeFormatterBuilder {
+
+public DateTimeFormatterBuilder() { throw new RuntimeException("Stub!"); }
+
+public static java.lang.String getLocalizedDateTimePattern(java.time.format.FormatStyle dateStyle, java.time.format.FormatStyle timeStyle, java.time.chrono.Chronology chrono, java.util.Locale locale) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder parseCaseSensitive() { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder parseCaseInsensitive() { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder parseStrict() { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder parseLenient() { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder parseDefaulting(java.time.temporal.TemporalField field, long value) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendValue(java.time.temporal.TemporalField field) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendValue(java.time.temporal.TemporalField field, int width) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendValue(java.time.temporal.TemporalField field, int minWidth, int maxWidth, java.time.format.SignStyle signStyle) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendValueReduced(java.time.temporal.TemporalField field, int width, int maxWidth, int baseValue) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendValueReduced(java.time.temporal.TemporalField field, int width, int maxWidth, java.time.chrono.ChronoLocalDate baseDate) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendFraction(java.time.temporal.TemporalField field, int minWidth, int maxWidth, boolean decimalPoint) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendText(java.time.temporal.TemporalField field) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendText(java.time.temporal.TemporalField field, java.time.format.TextStyle textStyle) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendText(java.time.temporal.TemporalField field, java.util.Map<java.lang.Long,java.lang.String> textLookup) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendInstant() { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendInstant(int fractionalDigits) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendOffsetId() { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendOffset(java.lang.String pattern, java.lang.String noOffsetText) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendLocalizedOffset(java.time.format.TextStyle style) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendZoneId() { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendZoneRegionId() { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendZoneOrOffsetId() { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendZoneText(java.time.format.TextStyle textStyle) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendZoneText(java.time.format.TextStyle textStyle, java.util.Set<java.time.ZoneId> preferredZones) { throw new RuntimeException("Stub!"); }
+
+@Hide
+public java.time.format.DateTimeFormatterBuilder appendGenericZoneText(java.time.format.TextStyle textStyle) { throw new RuntimeException("Stub!"); }
+
+@Hide
+public java.time.format.DateTimeFormatterBuilder appendGenericZoneText(java.time.format.TextStyle textStyle, java.util.Set<java.time.ZoneId> preferredZones) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendChronologyId() { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendChronologyText(java.time.format.TextStyle textStyle) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendLocalized(java.time.format.FormatStyle dateStyle, java.time.format.FormatStyle timeStyle) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendLiteral(char literal) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendLiteral(java.lang.String literal) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder append(java.time.format.DateTimeFormatter formatter) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendOptional(java.time.format.DateTimeFormatter formatter) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder appendPattern(java.lang.String pattern) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder padNext(int padWidth) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder padNext(int padWidth, char padChar) { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder optionalStart() { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatterBuilder optionalEnd() { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatter toFormatter() { throw new RuntimeException("Stub!"); }
+
+public java.time.format.DateTimeFormatter toFormatter(java.util.Locale locale) { throw new RuntimeException("Stub!"); }
+}
+
diff --git a/ojluni/src/main/java/java/io/BufferedReader.java b/ojluni/src/main/java/java/io/BufferedReader.java
index 20a240a..384b286 100644
--- a/ojluni/src/main/java/java/io/BufferedReader.java
+++ b/ojluni/src/main/java/java/io/BufferedReader.java
@@ -323,7 +323,7 @@
* @exception IOException If an I/O error occurs
*/
String readLine(boolean ignoreLF) throws IOException {
- StringBuffer s = null;
+ StringBuilder s = null;
int startChar;
synchronized (lock) {
@@ -379,7 +379,7 @@
}
if (s == null)
- s = new StringBuffer(defaultExpectedLineLength);
+ s = new StringBuilder(defaultExpectedLineLength);
s.append(cb, startChar, i - startChar);
}
}
diff --git a/ojluni/src/main/java/java/io/InputStreamReader.java b/ojluni/src/main/java/java/io/InputStreamReader.java
index 564537e..bb76cdc 100644
--- a/ojluni/src/main/java/java/io/InputStreamReader.java
+++ b/ojluni/src/main/java/java/io/InputStreamReader.java
@@ -70,12 +70,8 @@
*/
public InputStreamReader(InputStream in) {
super(in);
- try {
- sd = StreamDecoder.forInputStreamReader(in, this, (String)null); // ## check lock object
- } catch (UnsupportedEncodingException e) {
- // The default encoding should always be available
- throw new Error(e);
- }
+ sd = StreamDecoder.forInputStreamReader(in, this,
+ Charset.defaultCharset()); // ## check lock object
}
/**
diff --git a/ojluni/src/main/java/java/io/LineNumberReader.java b/ojluni/src/main/java/java/io/LineNumberReader.java
index c9ecbe0..bffda6e 100644
--- a/ojluni/src/main/java/java/io/LineNumberReader.java
+++ b/ojluni/src/main/java/java/io/LineNumberReader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -261,6 +261,11 @@
*/
public void mark(int readAheadLimit) throws IOException {
synchronized (lock) {
+ // If the most recently read character is '\r', then increment the
+ // read ahead limit as in this case if the next character is '\n',
+ // two characters would actually be read by the next read().
+ if (skipLF)
+ readAheadLimit++;
super.mark(readAheadLimit);
markedLineNumber = lineNumber;
markedSkipLF = skipLF;
diff --git a/ojluni/src/main/java/java/lang/Integer.java b/ojluni/src/main/java/java/lang/Integer.java
index 3df8c28..5d47b9a 100644
--- a/ojluni/src/main/java/java/lang/Integer.java
+++ b/ojluni/src/main/java/java/lang/Integer.java
@@ -1092,7 +1092,8 @@
private static class IntegerCache {
static final int low = -128;
static final int high;
- static final Integer cache[];
+ static final Integer[] cache;
+ static Integer[] archivedCache;
static {
// high value may be configured by property
@@ -1111,11 +1112,20 @@
}
high = h;
- cache = new Integer[(high - low) + 1];
- int j = low;
- for(int k = 0; k < cache.length; k++)
- cache[k] = new Integer(j++);
+ // Load IntegerCache.archivedCache from archive, if possible
+ // Android-removed: VM.initializeFromArchive isn't supported yet.
+ // VM.initializeFromArchive(IntegerCache.class);
+ int size = (high - low) + 1;
+ // Use the archived cache if it exists and is large enough
+ if (archivedCache == null || size > archivedCache.length) {
+ Integer[] c = new Integer[size];
+ int j = low;
+ for(int k = 0; k < c.length; k++)
+ c[k] = new Integer(j++);
+ archivedCache = c;
+ }
+ cache = archivedCache;
// range [-128, 127] must be interned (JLS7 5.1.7)
assert IntegerCache.high >= 127;
}
@@ -1483,7 +1493,7 @@
boolean negative = false;
Integer result;
- if (nm.length() == 0)
+ if (nm.isEmpty())
throw new NumberFormatException("Zero length string");
char firstChar = nm.charAt(0);
// Handle sign, if present
diff --git a/ojluni/src/main/java/java/lang/Long.java b/ojluni/src/main/java/java/lang/Long.java
index c5f5edd..74c10a0 100644
--- a/ojluni/src/main/java/java/lang/Long.java
+++ b/ojluni/src/main/java/java/lang/Long.java
@@ -1273,7 +1273,7 @@
boolean negative = false;
Long result;
- if (nm.length() == 0)
+ if (nm.isEmpty())
throw new NumberFormatException("Zero length string");
char firstChar = nm.charAt(0);
// Handle sign, if present
diff --git a/ojluni/src/main/java/java/lang/Math.java b/ojluni/src/main/java/java/lang/Math.java
index e446371..ee695db 100644
--- a/ojluni/src/main/java/java/lang/Math.java
+++ b/ojluni/src/main/java/java/lang/Math.java
@@ -524,6 +524,7 @@
*/
// BEGIN Android-changed: Reimplement in native
/*
+ @HotSpotIntrinsicCandidate
public static double ceil(double a) {
return StrictMath.ceil(a); // default impl. delegates to StrictMath
}
@@ -549,6 +550,7 @@
*/
// BEGIN Android-changed: Reimplement in native
/*
+ @HotSpotIntrinsicCandidate
public static double floor(double a) {
return StrictMath.floor(a); // default impl. delegates to StrictMath
}
@@ -574,6 +576,7 @@
*/
// BEGIN Android-changed: Reimplement in native
/*
+ @HotSpotIntrinsicCandidate
public static double rint(double a) {
return StrictMath.rint(a); // default impl. delegates to StrictMath
}
@@ -1490,6 +1493,7 @@
* @param a the argument whose absolute value is to be determined
* @return the absolute value of the argument.
*/
+ @HotSpotIntrinsicCandidate
public static int abs(int a) {
return (a < 0) ? -a : a;
}
@@ -1507,6 +1511,7 @@
* @param a the argument whose absolute value is to be determined
* @return the absolute value of the argument.
*/
+ @HotSpotIntrinsicCandidate
public static long abs(long a) {
return (a < 0) ? -a : a;
}
@@ -1531,6 +1536,7 @@
* @param a the argument whose absolute value is to be determined
* @return the absolute value of the argument.
*/
+ @HotSpotIntrinsicCandidate
public static float abs(float a) {
// Android-changed: Implementation modified to exactly match ART intrinsics behavior.
// Note, as a "quality of implementation", rather than pure "spec compliance",
@@ -1619,6 +1625,7 @@
* @param b another argument.
* @return the larger of {@code a} and {@code b}.
*/
+ @HotSpotIntrinsicCandidate
public static float max(float a, float b) {
if (a != a)
return a; // a is NaN
@@ -1645,6 +1652,7 @@
* @param b another argument.
* @return the larger of {@code a} and {@code b}.
*/
+ @HotSpotIntrinsicCandidate
public static double max(double a, double b) {
if (a != a)
return a; // a is NaN
@@ -1700,6 +1708,7 @@
* @param b another argument.
* @return the smaller of {@code a} and {@code b}.
*/
+ @HotSpotIntrinsicCandidate
public static float min(float a, float b) {
if (a != a)
return a; // a is NaN
@@ -1726,6 +1735,7 @@
* @param b another argument.
* @return the smaller of {@code a} and {@code b}.
*/
+ @HotSpotIntrinsicCandidate
public static double min(double a, double b) {
if (a != a)
return a; // a is NaN
@@ -1907,32 +1917,21 @@
*/
@HotSpotIntrinsicCandidate
public static float fma(float a, float b, float c) {
- /*
- * Since the double format has more than twice the precision
- * of the float format, the multiply of a * b is exact in
- * double. The add of c to the product then incurs one
- * rounding error. Since the double format moreover has more
- * than (2p + 2) precision bits compared to the p bits of the
- * float format, the two roundings of (a * b + c), first to
- * the double format and then secondarily to the float format,
- * are equivalent to rounding the intermediate result directly
- * to the float format.
- *
- * In terms of strictfp vs default-fp concerns related to
- * overflow and underflow, since
- *
- * (Float.MAX_VALUE * Float.MAX_VALUE) << Double.MAX_VALUE
- * (Float.MIN_VALUE * Float.MIN_VALUE) >> Double.MIN_VALUE
- *
- * neither the multiply nor add will overflow or underflow in
- * double. Therefore, it is not necessary for this method to
- * be declared strictfp to have reproducible
- * behavior. However, it is necessary to explicitly store down
- * to a float variable to avoid returning a value in the float
- * extended value set.
- */
- float result = (float)(((double) a * (double) b ) + (double) c);
- return result;
+ if (Float.isFinite(a) && Float.isFinite(b) && Float.isFinite(c)) {
+ if (a == 0.0 || b == 0.0) {
+ return a * b + c; // Handled signed zero cases
+ } else {
+ return (new BigDecimal((double)a * (double)b) // Exact multiply
+ .add(new BigDecimal((double)c))) // Exact sum
+ .floatValue(); // One rounding
+ // to a float value
+ }
+ } else {
+ // At least one of a,b, and c is non-finite. The result
+ // will be non-finite as well and will be the same
+ // non-finite value under double as float arithmetic.
+ return (float)fma((double)a, (double)b, (double)c);
+ }
}
/**
@@ -2053,6 +2052,7 @@
* @author Joseph D. Darcy
* @since 1.5
*/
+ @HotSpotIntrinsicCandidate
public static double signum(double d) {
return (d == 0.0 || Double.isNaN(d))?d:copySign(1.0, d);
}
@@ -2074,6 +2074,7 @@
* @author Joseph D. Darcy
* @since 1.5
*/
+ @HotSpotIntrinsicCandidate
public static float signum(float f) {
return (f == 0.0f || Float.isNaN(f))?f:copySign(1.0f, f);
}
@@ -2330,6 +2331,7 @@
* and the sign of {@code sign}.
* @since 1.6
*/
+ @HotSpotIntrinsicCandidate
public static double copySign(double magnitude, double sign) {
return Double.longBitsToDouble((Double.doubleToRawLongBits(sign) &
(DoubleConsts.SIGN_BIT_MASK)) |
@@ -2353,6 +2355,7 @@
* and the sign of {@code sign}.
* @since 1.6
*/
+ @HotSpotIntrinsicCandidate
public static float copySign(float magnitude, float sign) {
return Float.intBitsToFloat((Float.floatToRawIntBits(sign) &
(FloatConsts.SIGN_BIT_MASK)) |
diff --git a/ojluni/src/main/java/java/lang/StrictMath.java b/ojluni/src/main/java/java/lang/StrictMath.java
index 2c9f497..2f1898b 100644
--- a/ojluni/src/main/java/java/lang/StrictMath.java
+++ b/ojluni/src/main/java/java/lang/StrictMath.java
@@ -1169,6 +1169,7 @@
* @param b another argument.
* @return the larger of {@code a} and {@code b}.
*/
+ @HotSpotIntrinsicCandidate
public static float max(float a, float b) {
return Math.max(a, b);
}
@@ -1187,6 +1188,7 @@
* @param b another argument.
* @return the larger of {@code a} and {@code b}.
*/
+ @HotSpotIntrinsicCandidate
public static double max(double a, double b) {
return Math.max(a, b);
}
@@ -1234,6 +1236,7 @@
* @param b another argument.
* @return the smaller of {@code a} and {@code b.}
*/
+ @HotSpotIntrinsicCandidate
public static float min(float a, float b) {
return Math.min(a, b);
}
@@ -1252,6 +1255,7 @@
* @param b another argument.
* @return the smaller of {@code a} and {@code b}.
*/
+ @HotSpotIntrinsicCandidate
public static double min(double a, double b) {
return Math.min(a, b);
}
diff --git a/ojluni/src/main/java/java/lang/Thread.java b/ojluni/src/main/java/java/lang/Thread.java
index 3263383..3321b2e 100644
--- a/ojluni/src/main/java/java/lang/Thread.java
+++ b/ojluni/src/main/java/java/lang/Thread.java
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1994, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1539,6 +1539,7 @@
/**
* Waits at most {@code millis} milliseconds plus
* {@code nanos} nanoseconds for this thread to die.
+ * If both arguments are {@code 0}, it means to wait forever.
*
* <p> This implementation uses a loop of {@code this.wait} calls
* conditioned on {@code this.isAlive}. As a thread terminates the
diff --git a/ojluni/src/main/java/java/lang/Throwable.java b/ojluni/src/main/java/java/lang/Throwable.java
index 7444934..009a117 100644
--- a/ojluni/src/main/java/java/lang/Throwable.java
+++ b/ojluni/src/main/java/java/lang/Throwable.java
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,9 @@
*/
package java.lang;
+
import dalvik.annotation.optimization.FastNative;
+
import java.io.*;
import java.util.*;
@@ -699,7 +701,7 @@
// (Using assert adds a static field that determines whether assertions are enabled.)
// assert Thread.holdsLock(s.lock());
if (dejaVu.contains(this)) {
- s.println("\t[CIRCULAR REFERENCE:" + this + "]");
+ s.println(prefix + caption + "[CIRCULAR REFERENCE: " + this + "]");
} else {
dejaVu.add(this);
// Compute number of frames in common between this and enclosing trace
@@ -945,27 +947,41 @@
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException {
s.defaultReadObject(); // read in all fields
- if (suppressedExceptions != null) {
- List<Throwable> suppressed = null;
- if (suppressedExceptions.isEmpty()) {
- // Use the sentinel for a zero-length list
- // Android-changed: Use empty collection in place of SUPPRESSED_SENTINEL.
- // suppressed = SUPPRESSED_SENTINEL;
- suppressed = Collections.emptyList();
- } else { // Copy Throwables to new list
- suppressed = new ArrayList<>(1);
- for (Throwable t : suppressedExceptions) {
+
+ // Set suppressed exceptions and stack trace elements fields
+ // to marker values until the contents from the serial stream
+ // are validated.
+ List<Throwable> candidateSuppressedExceptions = suppressedExceptions;
+ // Android-changed: Use empty collection in place of SUPPRESSED_SENTINEL.
+ // suppressedExceptions = SUPPRESSED_SENTINEL;
+ suppressedExceptions = Collections.emptyList();
+
+ StackTraceElement[] candidateStackTrace = stackTrace;
+ // Android-changed: Directly create empty array instead of cloning UNASSIGNED_STACK.
+ // stackTrace = UNASSIGNED_STACK.clone();
+ stackTrace = new StackTraceElement[0];
+
+ if (candidateSuppressedExceptions != null) {
+ int suppressedSize = validateSuppressedExceptionsList(candidateSuppressedExceptions);
+ if (suppressedSize > 0) { // Copy valid Throwables to new list
+ var suppList = new ArrayList<Throwable>(Math.min(100, suppressedSize));
+
+ for (Throwable t : candidateSuppressedExceptions) {
// Enforce constraints on suppressed exceptions in
// case of corrupt or malicious stream.
if (t == null)
throw new NullPointerException(NULL_CAUSE_MESSAGE);
if (t == this)
throw new IllegalArgumentException(SELF_SUPPRESSION_MESSAGE);
- suppressed.add(t);
+ suppList.add(t);
}
+ // If there are any invalid suppressed exceptions,
+ // implicitly use the sentinel value assigned earlier.
+ suppressedExceptions = suppList;
}
- suppressedExceptions = suppressed;
- } // else a null suppressedExceptions field remains null
+ } else {
+ suppressedExceptions = null;
+ }
/*
* For zero-length stack traces, use a clone of
@@ -976,28 +992,47 @@
* the stackTrace needs to be constructed from the information
* in backtrace.
*/
- if (stackTrace != null) {
- if (stackTrace.length == 0) {
- // Android-removed: clone() call unneeded because of libcore.util.EmptyArray usage.
- // stackTrace = UNASSIGNED_STACK.clone();
- } else if (stackTrace.length == 1 &&
+ if (candidateStackTrace != null) {
+ // Work from a clone of the candidateStackTrace to ensure
+ // consistency of checks.
+ candidateStackTrace = candidateStackTrace.clone();
+ if (candidateStackTrace.length >= 1) {
+ if (candidateStackTrace.length == 1 &&
// Check for the marker of an immutable stack trace
- SentinelHolder.STACK_TRACE_ELEMENT_SENTINEL.equals(stackTrace[0])) {
- stackTrace = null;
- } else { // Verify stack trace elements are non-null.
- for(StackTraceElement ste : stackTrace) {
- if (ste == null)
- throw new NullPointerException("null StackTraceElement in serial stream. ");
+ SentinelHolder.STACK_TRACE_ELEMENT_SENTINEL.equals(candidateStackTrace[0])) {
+ stackTrace = null;
+ } else { // Verify stack trace elements are non-null.
+ for (StackTraceElement ste : candidateStackTrace) {
+ if (ste == null)
+ throw new NullPointerException("null StackTraceElement in serial stream.");
+ }
+ stackTrace = candidateStackTrace;
}
}
+ }
+ // A null stackTrace field in the serial form can result from
+ // an exception serialized without that field in older JDK
+ // releases; treat such exceptions as having empty stack
+ // traces by leaving stackTrace assigned to a clone of
+ // UNASSIGNED_STACK.
+ }
+
+ private int validateSuppressedExceptionsList(List<Throwable> deserSuppressedExceptions)
+ throws IOException {
+ // BEGIN Android-changed: Object class hasn't implemented the module system and getModule().
+ /*
+ if (!Object.class.getModule().
+ equals(deserSuppressedExceptions.getClass().getModule())) {
+ throw new StreamCorruptedException("List implementation not in base module.");
} else {
- // A null stackTrace field in the serial form can result
- // from an exception serialized without that field in
- // older JDK releases; treat such exceptions as having
- // empty stack traces.
- // Android-changed: Directly create empty array instead of cloning UNASSIGNED_STACK.
- // stackTrace = UNASSIGNED_STACK.clone();
- stackTrace = new StackTraceElement[0];
+ */
+ {
+ // END Android-changed: Object class hasn't implemented the module system and getModule().
+ int size = deserSuppressedExceptions.size();
+ if (size < 0) {
+ throw new StreamCorruptedException("Negative list size reported.");
+ }
+ return size;
}
}
diff --git a/ojluni/src/main/java/java/lang/invoke/VarHandle.java b/ojluni/src/main/java/java/lang/invoke/VarHandle.java
index 0febea9..d163d40 100644
--- a/ojluni/src/main/java/java/lang/invoke/VarHandle.java
+++ b/ojluni/src/main/java/java/lang/invoke/VarHandle.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,7 @@
* non-static fields, array elements, or components of an off-heap data
* structure. Access to such variables is supported under various
* <em>access modes</em>, including plain read/write access, volatile
- * read/write access, and compare-and-swap.
+ * read/write access, and compare-and-set.
*
* <p>VarHandles are immutable and have no visible state. VarHandles cannot be
* subclassed by the user.
@@ -96,7 +96,7 @@
* is {@code String}. The access mode type for {@code compareAndSet} on this
* VarHandle instance would be
* {@code (String[] c1, int c2, String expectedValue, String newValue)boolean}.
- * Such a VarHandle instance may produced by the
+ * Such a VarHandle instance may be produced by the
* {@link MethodHandles#arrayElementVarHandle(Class) array factory method} and
* access array elements as follows:
* <pre> {@code
@@ -200,7 +200,7 @@
* and {@code double} on 32-bit platforms.
*
* <p>Access modes will override any memory ordering effects specified at
- * the declaration site of a variable. For example, a VarHandle accessing a
+ * the declaration site of a variable. For example, a VarHandle accessing
* a field using the {@code get} access mode will access the field as
* specified <em>by its access mode</em> even if that field is declared
* {@code volatile}. When mixed access is performed extreme care should be
@@ -418,7 +418,7 @@
* {@link java.lang.invoke.MethodHandles#varHandleInvoker}.
*
* <h1>Interoperation between VarHandles and Java generics</h1>
- * A VarHandle can be obtained for a variable, such as a a field, which is
+ * A VarHandle can be obtained for a variable, such as a field, which is
* declared with Java generic types. As with the Core Reflection API, the
* VarHandle's variable type will be constructed from the erasure of the
* source-level type. When a VarHandle access mode method is invoked, the
@@ -1543,7 +1543,7 @@
enum AccessType {
GET,
SET,
- COMPARE_AND_SWAP,
+ COMPARE_AND_SET,
COMPARE_AND_EXCHANGE,
GET_AND_UPDATE,
// Android-added: Finer grained access types.
@@ -1565,7 +1565,7 @@
i = fillParameters(ps, receiver, intermediate);
ps[i] = value;
return MethodType.methodType(void.class, ps);
- case COMPARE_AND_SWAP:
+ case COMPARE_AND_SET:
ps = allocateParameters(2, receiver, intermediate);
i = fillParameters(ps, receiver, intermediate);
ps[i++] = value;
@@ -1664,7 +1664,7 @@
* method
* {@link VarHandle#compareAndSet VarHandle.compareAndSet}
*/
- COMPARE_AND_SET("compareAndSet", AccessType.COMPARE_AND_SWAP),
+ COMPARE_AND_SET("compareAndSet", AccessType.COMPARE_AND_SET),
/**
* The access mode whose access is specified by the corresponding
* method
@@ -1688,25 +1688,25 @@
* method
* {@link VarHandle#weakCompareAndSetPlain VarHandle.weakCompareAndSetPlain}
*/
- WEAK_COMPARE_AND_SET_PLAIN("weakCompareAndSetPlain", AccessType.COMPARE_AND_SWAP),
+ WEAK_COMPARE_AND_SET_PLAIN("weakCompareAndSetPlain", AccessType.COMPARE_AND_SET),
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#weakCompareAndSet VarHandle.weakCompareAndSet}
*/
- WEAK_COMPARE_AND_SET("weakCompareAndSet", AccessType.COMPARE_AND_SWAP),
+ WEAK_COMPARE_AND_SET("weakCompareAndSet", AccessType.COMPARE_AND_SET),
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#weakCompareAndSetAcquire VarHandle.weakCompareAndSetAcquire}
*/
- WEAK_COMPARE_AND_SET_ACQUIRE("weakCompareAndSetAcquire", AccessType.COMPARE_AND_SWAP),
+ WEAK_COMPARE_AND_SET_ACQUIRE("weakCompareAndSetAcquire", AccessType.COMPARE_AND_SET),
/**
* The access mode whose access is specified by the corresponding
* method
* {@link VarHandle#weakCompareAndSetRelease VarHandle.weakCompareAndSetRelease}
*/
- WEAK_COMPARE_AND_SET_RELEASE("weakCompareAndSetRelease", AccessType.COMPARE_AND_SWAP),
+ WEAK_COMPARE_AND_SET_RELEASE("weakCompareAndSetRelease", AccessType.COMPARE_AND_SET),
/**
* The access mode whose access is specified by the corresponding
* method
@@ -1801,10 +1801,12 @@
static final Map<String, AccessMode> methodNameToAccessMode;
static {
- // Initial capacity of # values is sufficient to avoid resizes
- // for the smallest table size (32)
- methodNameToAccessMode = new HashMap<>(AccessMode.values().length);
- for (AccessMode am : AccessMode.values()) {
+ AccessMode[] values = AccessMode.values();
+ // Initial capacity of # values divided by the load factor is sufficient
+ // to avoid resizes for the smallest table size (64)
+ int initialCapacity = (int)(values.length / 0.75f) + 1;
+ methodNameToAccessMode = new HashMap<>(initialCapacity);
+ for (AccessMode am : values) {
methodNameToAccessMode.put(am.methodName, am);
}
}
@@ -1838,7 +1840,7 @@
* value associated with method name (indicating the method
* name does not correspond to a {@code VarHandle}
* signature-polymorphic method name).
- * @see #methodName
+ * @see #methodName()
*/
public static AccessMode valueFromMethodName(String methodName) {
AccessMode am = methodNameToAccessMode.get(methodName);
@@ -2079,12 +2081,7 @@
private static final long VFORM_OFFSET;
static {
- try {
- VFORM_OFFSET = UNSAFE.objectFieldOffset(VarHandle.class.getDeclaredField("vform"));
- }
- catch (ReflectiveOperationException e) {
- throw newInternalError(e);
- }
+ VFORM_OFFSET = UNSAFE.objectFieldOffset(VarHandle.class, "vform");
// The VarHandleGuards must be initialized to ensure correct
// compilation of the guard methods
@@ -2267,7 +2264,7 @@
ATOMIC_UPDATE_ACCESS_MODES_BIT_MASK =
accessTypesToBitMask(EnumSet.of(AccessType.COMPARE_AND_EXCHANGE,
- AccessType.COMPARE_AND_SWAP,
+ AccessType.COMPARE_AND_SET,
AccessType.GET_AND_UPDATE));
NUMERIC_ATOMIC_UPDATE_ACCESS_MODES_BIT_MASK =
diff --git a/ojluni/src/main/java/java/math/BigDecimal.java b/ojluni/src/main/java/java/math/BigDecimal.java
index 25d8f2b..9a1fdf0 100644
--- a/ojluni/src/main/java/java/math/BigDecimal.java
+++ b/ojluni/src/main/java/java/math/BigDecimal.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
import static java.math.BigInteger.LONG_MASK;
import java.util.Arrays;
+import java.util.Objects;
/**
* Immutable, arbitrary-precision signed decimal numbers. A
@@ -424,9 +425,14 @@
* @since 1.5
*/
public BigDecimal(char[] in, int offset, int len, MathContext mc) {
- // protect against huge length.
- if (offset + len > in.length || offset < 0)
- throw new NumberFormatException("Bad offset or len arguments for char[] input.");
+ // protect against huge length, negative values, and integer overflow
+ try {
+ Objects.checkFromIndexSize(offset, len, in.length);
+ } catch (IndexOutOfBoundsException e) {
+ throw new NumberFormatException
+ ("Bad offset or len arguments for char[] input.");
+ }
+
// This is the primary string to BigDecimal constructor; all
// incoming strings end up here; it uses explicit (inline)
// parsing for speed and generates at most one intermediate
@@ -2112,7 +2118,7 @@
// approximately a 15 digit approximation to the square
// root, it is helpful to instead normalize this so that
// the significand portion is to right of the decimal
- // point by roughly (scale() - precision() +1).
+ // point by roughly (scale() - precision() + 1).
// Now the precision / scale adjustment
int scaleAdjust = 0;
@@ -2140,7 +2146,7 @@
// than 15 digits were needed, it might be faster to do
// the loop entirely in BigDecimal arithmetic.
//
- // (A double value might have as much many as 17 decimal
+ // (A double value might have as many as 17 decimal
// digits of precision; it depends on the relative density
// of binary and decimal numbers at different regions of
// the number line.)
@@ -2164,7 +2170,25 @@
if (originalPrecision == 0) {
targetPrecision = stripped.precision()/2 + 1;
} else {
- targetPrecision = originalPrecision;
+ /*
+ * To avoid the need for post-Newton fix-up logic, in
+ * the case of half-way rounding modes, double the
+ * target precision so that the "2p + 2" property can
+ * be relied on to accomplish the final rounding.
+ */
+ switch (mc.getRoundingMode()) {
+ case HALF_UP:
+ case HALF_DOWN:
+ case HALF_EVEN:
+ targetPrecision = 2 * originalPrecision;
+ if (targetPrecision < 0) // Overflow
+ targetPrecision = Integer.MAX_VALUE - 2;
+ break;
+
+ default:
+ targetPrecision = originalPrecision;
+ break;
+ }
}
// When setting the precision to use inside the Newton
@@ -2192,33 +2216,81 @@
// If result*result != this numerically, the square
// root isn't exact
- if (this.subtract(result.multiply(result)).compareTo(ZERO) != 0) {
+ if (this.subtract(result.square()).compareTo(ZERO) != 0) {
throw new ArithmeticException("Computed square root not exact.");
}
} else {
result = approx.scaleByPowerOfTen(-scaleAdjust/2).round(mc);
+
+ switch (targetRm) {
+ case DOWN:
+ case FLOOR:
+ // Check if too big
+ if (result.square().compareTo(this) > 0) {
+ BigDecimal ulp = result.ulp();
+ // Adjust increment down in case of 1.0 = 10^0
+ // since the next smaller number is only 1/10
+ // as far way as the next larger at exponent
+ // boundaries. Test approx and *not* result to
+ // avoid having to detect an arbitrary power
+ // of ten.
+ if (approx.compareTo(ONE) == 0) {
+ ulp = ulp.multiply(ONE_TENTH);
+ }
+ result = result.subtract(ulp);
+ }
+ break;
+
+ case UP:
+ case CEILING:
+ // Check if too small
+ if (result.square().compareTo(this) < 0) {
+ result = result.add(result.ulp());
+ }
+ break;
+
+ default:
+ // No additional work, rely on "2p + 2" property
+ // for correct rounding. Alternatively, could
+ // instead run the Newton iteration to around p
+ // digits and then do tests and fix-ups on the
+ // rounded value. One possible set of tests and
+ // fix-ups is given in the Hull and Abrham paper;
+ // however, additional half-way cases can occur
+ // for BigDecimal given the more varied
+ // combinations of input and output precisions
+ // supported.
+ break;
+ }
+
}
+ // Test numerical properties at full precision before any
+ // scale adjustments.
+ assert squareRootResultAssertions(result, mc);
if (result.scale() != preferredScale) {
// The preferred scale of an add is
// max(addend.scale(), augend.scale()). Therefore, if
// the scale of the result is first minimized using
// stripTrailingZeros(), adding a zero of the
- // preferred scale rounding the correct precision will
- // perform the proper scale vs precision tradeoffs.
+ // preferred scale rounding to the correct precision
+ // will perform the proper scale vs precision
+ // tradeoffs.
result = result.stripTrailingZeros().
add(zeroWithFinalPreferredScale,
new MathContext(originalPrecision, RoundingMode.UNNECESSARY));
}
- assert squareRootResultAssertions(result, mc);
return result;
} else {
+ BigDecimal result = null;
switch (signum) {
case -1:
throw new ArithmeticException("Attempted square root " +
"of negative BigDecimal");
case 0:
- return valueOf(0L, scale()/2);
+ result = valueOf(0L, scale()/2);
+ assert squareRootResultAssertions(result, mc);
+ return result;
default:
throw new AssertionError("Bad value from signum");
@@ -2226,6 +2298,10 @@
}
}
+ private BigDecimal square() {
+ return this.multiply(this);
+ }
+
private boolean isPowerOfTen() {
return BigInteger.ONE.equals(this.unscaledValue());
}
@@ -2234,10 +2310,16 @@
* For nonzero values, check numerical correctness properties of
* the computed result for the chosen rounding mode.
*
- * For the directed roundings, for DOWN and FLOOR, result^2 must
- * be {@code <=} the input and (result+ulp)^2 must be {@code >} the
- * input. Conversely, for UP and CEIL, result^2 must be {@code >=} the
- * input and (result-ulp)^2 must be {@code <} the input.
+ * For the directed rounding modes:
+ *
+ * <ul>
+ *
+ * <li> For DOWN and FLOOR, result^2 must be {@code <=} the input
+ * and (result+ulp)^2 must be {@code >} the input.
+ *
+ * <li>Conversely, for UP and CEIL, result^2 must be {@code >=}
+ * the input and (result-ulp)^2 must be {@code <} the input.
+ * </ul>
*/
private boolean squareRootResultAssertions(BigDecimal result, MathContext mc) {
if (result.signum() == 0) {
@@ -2247,52 +2329,68 @@
BigDecimal ulp = result.ulp();
BigDecimal neighborUp = result.add(ulp);
// Make neighbor down accurate even for powers of ten
- if (this.isPowerOfTen()) {
+ if (result.isPowerOfTen()) {
ulp = ulp.divide(TEN);
}
BigDecimal neighborDown = result.subtract(ulp);
// Both the starting value and result should be nonzero and positive.
- if (result.signum() != 1 ||
- this.signum() != 1) {
- return false;
- }
+ assert (result.signum() == 1 &&
+ this.signum() == 1) :
+ "Bad signum of this and/or its sqrt.";
switch (rm) {
case DOWN:
case FLOOR:
- return
- result.multiply(result).compareTo(this) <= 0 &&
- neighborUp.multiply(neighborUp).compareTo(this) > 0;
+ assert
+ result.square().compareTo(this) <= 0 &&
+ neighborUp.square().compareTo(this) > 0:
+ "Square of result out for bounds rounding " + rm;
+ return true;
case UP:
case CEILING:
- return
- result.multiply(result).compareTo(this) >= 0 &&
- neighborDown.multiply(neighborDown).compareTo(this) < 0;
+ assert
+ result.square().compareTo(this) >= 0 &&
+ neighborDown.square().compareTo(this) < 0:
+ "Square of result out for bounds rounding " + rm;
+ return true;
+
case HALF_DOWN:
case HALF_EVEN:
case HALF_UP:
- BigDecimal err = result.multiply(result).subtract(this).abs();
- BigDecimal errUp = neighborUp.multiply(neighborUp).subtract(this);
- BigDecimal errDown = this.subtract(neighborDown.multiply(neighborDown));
+ BigDecimal err = result.square().subtract(this).abs();
+ BigDecimal errUp = neighborUp.square().subtract(this);
+ BigDecimal errDown = this.subtract(neighborDown.square());
// All error values should be positive so don't need to
// compare absolute values.
int err_comp_errUp = err.compareTo(errUp);
int err_comp_errDown = err.compareTo(errDown);
- return
+ assert
errUp.signum() == 1 &&
- errDown.signum() == 1 &&
+ errDown.signum() == 1 :
+ "Errors of neighbors squared don't have correct signs";
- err_comp_errUp <= 0 &&
- err_comp_errDown <= 0 &&
+ // For breaking a half-way tie, the return value may
+ // have a larger error than one of the neighbors. For
+ // example, the square root of 2.25 to a precision of
+ // 1 digit is either 1 or 2 depending on how the exact
+ // value of 1.5 is rounded. If 2 is returned, it will
+ // have a larger rounding error than its neighbor 1.
+ assert
+ err_comp_errUp <= 0 ||
+ err_comp_errDown <= 0 :
+ "Computed square root has larger error than neighbors for " + rm;
+ assert
((err_comp_errUp == 0 ) ? err_comp_errDown < 0 : true) &&
- ((err_comp_errDown == 0 ) ? err_comp_errUp < 0 : true);
+ ((err_comp_errDown == 0 ) ? err_comp_errUp < 0 : true) :
+ "Incorrect error relationships";
// && could check for digit conditions for ties too
+ return true;
default: // Definition of UNNECESSARY already verified.
return true;
@@ -3404,9 +3502,32 @@
*/
@Override
public long longValue(){
- return (intCompact != INFLATED && scale == 0) ?
- intCompact:
- toBigInteger().longValue();
+ if (intCompact != INFLATED && scale == 0) {
+ return intCompact;
+ } else {
+ // Fastpath zero and small values
+ if (this.signum() == 0 || fractionOnly() ||
+ // Fastpath very large-scale values that will result
+ // in a truncated value of zero. If the scale is -64
+ // or less, there are at least 64 powers of 10 in the
+ // value of the numerical result. Since 10 = 2*5, in
+ // that case there would also be 64 powers of 2 in the
+ // result, meaning all 64 bits of a long will be zero.
+ scale <= -64) {
+ return 0;
+ } else {
+ return toBigInteger().longValue();
+ }
+ }
+ }
+
+ /**
+ * Return true if a nonzero BigDecimal has an absolute value less
+ * than one; i.e. only has fraction digits.
+ */
+ private boolean fractionOnly() {
+ assert this.signum() != 0;
+ return (this.precision() - this.scale) <= 0;
}
/**
@@ -3424,15 +3545,20 @@
public long longValueExact() {
if (intCompact != INFLATED && scale == 0)
return intCompact;
+
+ // Fastpath zero
+ if (this.signum() == 0)
+ return 0;
+
+ // Fastpath numbers less than 1.0 (the latter can be very slow
+ // to round if very small)
+ if (fractionOnly())
+ throw new ArithmeticException("Rounding necessary");
+
// If more than 19 digits in integer part it cannot possibly fit
if ((precision() - scale) > 19) // [OK for negative scale too]
throw new java.lang.ArithmeticException("Overflow");
- // Fastpath zero and < 1.0 numbers (the latter can be very slow
- // to round if very small)
- if (this.signum() == 0)
- return 0;
- if ((this.precision() - this.scale) <= 0)
- throw new ArithmeticException("Rounding necessary");
+
// round to an integer, with Exception if decimal part non-0
BigDecimal num = this.setScale(0, ROUND_UNNECESSARY);
if (num.precision() >= 19) // need to check carefully
@@ -3476,7 +3602,7 @@
public int intValue() {
return (intCompact != INFLATED && scale == 0) ?
(int)intCompact :
- toBigInteger().intValue();
+ (int)longValue();
}
/**
diff --git a/ojluni/src/main/java/java/math/BigInteger.java b/ojluni/src/main/java/java/math/BigInteger.java
index 6b7ec05..dc70f11 100644
--- a/ojluni/src/main/java/java/math/BigInteger.java
+++ b/ojluni/src/main/java/java/math/BigInteger.java
@@ -307,10 +307,8 @@
public BigInteger(byte[] val, int off, int len) {
if (val.length == 0) {
throw new NumberFormatException("Zero length BigInteger");
- } else if ((off < 0) || (off >= val.length) || (len < 0) ||
- (len > val.length - off)) { // 0 <= off < val.length
- throw new IndexOutOfBoundsException();
}
+ Objects.checkFromIndexSize(off, len, val.length);
if (val[off] < 0) {
mag = makePositive(val, off, len);
@@ -395,12 +393,8 @@
public BigInteger(int signum, byte[] magnitude, int off, int len) {
if (signum < -1 || signum > 1) {
throw(new NumberFormatException("Invalid signum value"));
- } else if ((off < 0) || (len < 0) ||
- (len > 0 &&
- ((off >= magnitude.length) ||
- (len > magnitude.length - off)))) { // 0 <= off < magnitude.length
- throw new IndexOutOfBoundsException();
}
+ Objects.checkFromIndexSize(off, len, magnitude.length);
// stripLeadingZeroBytes() returns a zero length array if len == 0
this.mag = stripLeadingZeroBytes(magnitude, off, len);
@@ -1237,6 +1231,14 @@
private static final double LOG_TWO = Math.log(2.0);
static {
+ assert 0 < KARATSUBA_THRESHOLD
+ && KARATSUBA_THRESHOLD < TOOM_COOK_THRESHOLD
+ && TOOM_COOK_THRESHOLD < Integer.MAX_VALUE
+ && 0 < KARATSUBA_SQUARE_THRESHOLD
+ && KARATSUBA_SQUARE_THRESHOLD < TOOM_COOK_SQUARE_THRESHOLD
+ && TOOM_COOK_SQUARE_THRESHOLD < Integer.MAX_VALUE :
+ "Algorithm thresholds are inconsistent";
+
for (int i = 1; i <= MAX_CONSTANT; i++) {
int[] magnitude = new int[1];
magnitude[0] = i;
@@ -1560,6 +1562,18 @@
* @return {@code this * val}
*/
public BigInteger multiply(BigInteger val) {
+ return multiply(val, false);
+ }
+
+ /**
+ * Returns a BigInteger whose value is {@code (this * val)}. If
+ * the invocation is recursive certain overflow checks are skipped.
+ *
+ * @param val value to be multiplied by this BigInteger.
+ * @param isRecursion whether this is a recursive invocation
+ * @return {@code this * val}
+ */
+ private BigInteger multiply(BigInteger val, boolean isRecursion) {
if (val.signum == 0 || signum == 0)
return ZERO;
@@ -1779,7 +1793,7 @@
int ystart = ylen - 1;
if (z == null || z.length < (xlen+ ylen))
- z = new int[xlen+ylen];
+ z = new int[xlen+ylen];
long carry = 0;
for (int j=ystart, k=ystart+1+xstart; j >= 0; j--, k--) {
@@ -1913,16 +1927,16 @@
BigInteger v0, v1, v2, vm1, vinf, t1, t2, tm1, da1, db1;
- v0 = a0.multiply(b0);
+ v0 = a0.multiply(b0, true);
da1 = a2.add(a0);
db1 = b2.add(b0);
- vm1 = da1.subtract(a1).multiply(db1.subtract(b1));
+ vm1 = da1.subtract(a1).multiply(db1.subtract(b1), true);
da1 = da1.add(a1);
db1 = db1.add(b1);
- v1 = da1.multiply(db1);
+ v1 = da1.multiply(db1, true);
v2 = da1.add(a2).shiftLeft(1).subtract(a0).multiply(
- db1.add(b2).shiftLeft(1).subtract(b0));
- vinf = a2.multiply(b2);
+ db1.add(b2).shiftLeft(1).subtract(b0), true);
+ vinf = a2.multiply(b2, true);
// The algorithm requires two divisions by 2 and one by 3.
// All divisions are known to be exact, that is, they do not produce
@@ -2088,6 +2102,17 @@
* @return {@code this<sup>2</sup>}
*/
private BigInteger square() {
+ return square(false);
+ }
+
+ /**
+ * Returns a BigInteger whose value is {@code (this<sup>2</sup>)}. If
+ * the invocation is recursive certain overflow checks are skipped.
+ *
+ * @param isRecursion whether this is a recursive invocation
+ * @return {@code this<sup>2</sup>}
+ */
+ private BigInteger square(boolean isRecursion) {
if (signum == 0) {
return ZERO;
}
@@ -2100,6 +2125,15 @@
if (len < TOOM_COOK_SQUARE_THRESHOLD) {
return squareKaratsuba();
} else {
+ //
+ // For a discussion of overflow detection see multiply()
+ //
+ if (!isRecursion) {
+ if (bitLength(mag, mag.length) > 16L*MAX_MAG_LENGTH) {
+ reportOverflow();
+ }
+ }
+
return squareToomCook3();
}
}
@@ -2251,13 +2285,13 @@
a0 = getToomSlice(k, r, 2, len);
BigInteger v0, v1, v2, vm1, vinf, t1, t2, tm1, da1;
- v0 = a0.square();
+ v0 = a0.square(true);
da1 = a2.add(a0);
- vm1 = da1.subtract(a1).square();
+ vm1 = da1.subtract(a1).square(true);
da1 = da1.add(a1);
- v1 = da1.square();
- vinf = a2.square();
- v2 = da1.add(a2).shiftLeft(1).subtract(a0).square();
+ v1 = da1.square(true);
+ vinf = a2.square(true);
+ v2 = da1.add(a2).shiftLeft(1).subtract(a0).square(true);
// The algorithm requires two divisions by 2 and one by 3.
// All divisions are known to be exact, that is, they do not produce
@@ -2473,10 +2507,11 @@
// The remaining part can then be exponentiated faster. The
// powers of two will be multiplied back at the end.
int powersOfTwo = partToSquare.getLowestSetBit();
- long bitsToShift = (long)powersOfTwo * exponent;
- if (bitsToShift > Integer.MAX_VALUE) {
+ long bitsToShiftLong = (long)powersOfTwo * exponent;
+ if (bitsToShiftLong > Integer.MAX_VALUE) {
reportOverflow();
}
+ int bitsToShift = (int)bitsToShiftLong;
int remainingBits;
@@ -2486,9 +2521,9 @@
remainingBits = partToSquare.bitLength();
if (remainingBits == 1) { // Nothing left but +/- 1?
if (signum < 0 && (exponent&1) == 1) {
- return NEGATIVE_ONE.shiftLeft(powersOfTwo*exponent);
+ return NEGATIVE_ONE.shiftLeft(bitsToShift);
} else {
- return ONE.shiftLeft(powersOfTwo*exponent);
+ return ONE.shiftLeft(bitsToShift);
}
}
} else {
@@ -2533,13 +2568,16 @@
if (bitsToShift + scaleFactor <= 62) { // Fits in long?
return valueOf((result << bitsToShift) * newSign);
} else {
- return valueOf(result*newSign).shiftLeft((int) bitsToShift);
+ return valueOf(result*newSign).shiftLeft(bitsToShift);
}
- }
- else {
+ } else {
return valueOf(result*newSign);
}
} else {
+ if ((long)bitLength() * exponent / Integer.SIZE > MAX_MAG_LENGTH) {
+ reportOverflow();
+ }
+
// Large number algorithm. This is basically identical to
// the algorithm above, but calls multiply() and square()
// which may use more efficient algorithms for large numbers.
@@ -2559,7 +2597,7 @@
// Multiply back the (exponentiated) powers of two (quickly,
// by shifting left)
if (powersOfTwo > 0) {
- answer = answer.shiftLeft(powersOfTwo*exponent);
+ answer = answer.shiftLeft(bitsToShift);
}
if (signum < 0 && (exponent&1) == 1) {
@@ -3785,7 +3823,7 @@
for (int i=1; i< len && pow2; i++)
pow2 = (mag[i] == 0);
- n = (pow2 ? magBitLength -1 : magBitLength);
+ n = (pow2 ? magBitLength - 1 : magBitLength);
} else {
n = magBitLength;
}
diff --git a/ojluni/src/main/java/java/math/MutableBigInteger.java b/ojluni/src/main/java/java/math/MutableBigInteger.java
index 2d7abab..f95ea9c 100644
--- a/ojluni/src/main/java/java/math/MutableBigInteger.java
+++ b/ojluni/src/main/java/java/math/MutableBigInteger.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -2178,8 +2178,8 @@
}
/**
- * Calculate the multiplicative inverse of this mod mod, where mod is odd.
- * This and mod are not changed by the calculation.
+ * Calculate the multiplicative inverse of this modulo mod, where the mod
+ * argument is odd. This and mod are not changed by the calculation.
*
* This method implements an algorithm due to Richard Schroeppel, that uses
* the same intermediate representation as Montgomery Reduction
@@ -2233,8 +2233,18 @@
k += trailingZeros;
}
- while (c.sign < 0)
- c.signedAdd(p);
+ if (c.compare(p) >= 0) { // c has a larger magnitude than p
+ MutableBigInteger remainder = c.divide(p,
+ new MutableBigInteger());
+ // The previous line ignores the sign so we copy the data back
+ // into c which will restore the sign as needed (and converts
+ // it back to a SignedMutableBigInteger)
+ c.copyValue(remainder);
+ }
+
+ if (c.sign < 0) {
+ c.signedAdd(p);
+ }
return fixup(c, p, k);
}
@@ -2272,8 +2282,8 @@
}
// In theory, c may be greater than p at this point (Very rare!)
- while (c.compare(p) >= 0)
- c.subtract(p);
+ if (c.compare(p) >= 0)
+ c = c.divide(p, new MutableBigInteger());
return c;
}
diff --git a/ojluni/src/main/java/java/nio/ByteBufferAs-X-Buffer.java.template b/ojluni/src/main/java/java/nio/ByteBufferAs-X-Buffer.java.template
new file mode 100644
index 0000000..dfa442e
--- /dev/null
+++ b/ojluni/src/main/java/java/nio/ByteBufferAs-X-Buffer.java.template
@@ -0,0 +1,251 @@
+/*
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#warn This file is preprocessed before being compiled
+
+package java.nio;
+
+import jdk.internal.misc.Unsafe;
+
+
+class ByteBufferAs$Type$Buffer$RW$$BO$ // package-private
+ extends {#if[ro]?ByteBufferAs}$Type$Buffer{#if[ro]?$BO$}
+{
+
+#if[rw]
+
+ protected final ByteBuffer bb;
+
+#end[rw]
+
+ ByteBufferAs$Type$Buffer$RW$$BO$(ByteBuffer bb) { // package-private
+#if[rw]
+ super(-1, 0,
+ bb.remaining() >> $LG_BYTES_PER_VALUE$,
+ bb.remaining() >> $LG_BYTES_PER_VALUE$);
+ this.bb = bb;
+ // enforce limit == capacity
+ int cap = this.capacity();
+ this.limit(cap);
+ int pos = this.position();
+ assert (pos <= cap);
+ address = bb.address;
+#else[rw]
+ super(bb);
+#end[rw]
+ }
+
+ ByteBufferAs$Type$Buffer$RW$$BO$(ByteBuffer bb,
+ int mark, int pos, int lim, int cap,
+ long addr)
+ {
+#if[rw]
+ super(mark, pos, lim, cap);
+ this.bb = bb;
+ address = addr;
+ assert address >= bb.address;
+#else[rw]
+ super(bb, mark, pos, lim, cap, addr);
+#end[rw]
+ }
+
+ @Override
+ Object base() {
+ return bb.hb;
+ }
+
+ public $Type$Buffer slice() {
+ int pos = this.position();
+ int lim = this.limit();
+ assert (pos <= lim);
+ int rem = (pos <= lim ? lim - pos : 0);
+ long addr = byteOffset(pos);
+ return new ByteBufferAs$Type$Buffer$RW$$BO$(bb, -1, 0, rem, rem, addr);
+ }
+
+ public $Type$Buffer duplicate() {
+ return new ByteBufferAs$Type$Buffer$RW$$BO$(bb,
+ this.markValue(),
+ this.position(),
+ this.limit(),
+ this.capacity(),
+ address);
+ }
+
+ public $Type$Buffer asReadOnlyBuffer() {
+#if[rw]
+ return new ByteBufferAs$Type$BufferR$BO$(bb,
+ this.markValue(),
+ this.position(),
+ this.limit(),
+ this.capacity(),
+ address);
+#else[rw]
+ return duplicate();
+#end[rw]
+ }
+
+#if[rw]
+
+ private int ix(int i) {
+ int off = (int) (address - bb.address);
+ return (i << $LG_BYTES_PER_VALUE$) + off;
+ }
+
+ protected long byteOffset(long i) {
+ return (i << $LG_BYTES_PER_VALUE$) + address;
+ }
+
+ public $type$ get() {
+ $memtype$ x = UNSAFE.get$Memtype$Unaligned(bb.hb, byteOffset(nextGetIndex()),
+ {#if[boB]?true:false});
+ return $fromBits$(x);
+ }
+
+ public $type$ get(int i) {
+ $memtype$ x = UNSAFE.get$Memtype$Unaligned(bb.hb, byteOffset(checkIndex(i)),
+ {#if[boB]?true:false});
+ return $fromBits$(x);
+ }
+
+#if[streamableType]
+ $type$ getUnchecked(int i) {
+ $memtype$ x = UNSAFE.get$Memtype$Unaligned(bb.hb, byteOffset(i),
+ {#if[boB]?true:false});
+ return $fromBits$(x);
+ }
+#end[streamableType]
+
+#end[rw]
+
+ public $Type$Buffer put($type$ x) {
+#if[rw]
+ $memtype$ y = $toBits$(x);
+ UNSAFE.put$Memtype$Unaligned(bb.hb, byteOffset(nextPutIndex()), y,
+ {#if[boB]?true:false});
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public $Type$Buffer put(int i, $type$ x) {
+#if[rw]
+ $memtype$ y = $toBits$(x);
+ UNSAFE.put$Memtype$Unaligned(bb.hb, byteOffset(checkIndex(i)), y,
+ {#if[boB]?true:false});
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public $Type$Buffer compact() {
+#if[rw]
+ int pos = position();
+ int lim = limit();
+ assert (pos <= lim);
+ int rem = (pos <= lim ? lim - pos : 0);
+
+ ByteBuffer db = bb.duplicate();
+ db.limit(ix(lim));
+ db.position(ix(0));
+ ByteBuffer sb = db.slice();
+ sb.position(pos << $LG_BYTES_PER_VALUE$);
+ sb.compact();
+ position(rem);
+ limit(capacity());
+ discardMark();
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public boolean isDirect() {
+ return bb.isDirect();
+ }
+
+ public boolean isReadOnly() {
+ return {#if[rw]?false:true};
+ }
+
+#if[char]
+
+ public String toString(int start, int end) {
+ if ((end > limit()) || (start > end))
+ throw new IndexOutOfBoundsException();
+ try {
+ int len = end - start;
+ char[] ca = new char[len];
+ CharBuffer cb = CharBuffer.wrap(ca);
+ CharBuffer db = this.duplicate();
+ db.position(start);
+ db.limit(end);
+ cb.put(db);
+ return new String(ca);
+ } catch (StringIndexOutOfBoundsException x) {
+ throw new IndexOutOfBoundsException();
+ }
+ }
+
+
+ // --- Methods to support CharSequence ---
+
+ public CharBuffer subSequence(int start, int end) {
+ int pos = position();
+ int lim = limit();
+ assert (pos <= lim);
+ pos = (pos <= lim ? pos : lim);
+ int len = lim - pos;
+
+ if ((start < 0) || (end > len) || (start > end))
+ throw new IndexOutOfBoundsException();
+ return new ByteBufferAsCharBuffer$RW$$BO$(bb,
+ -1,
+ pos + start,
+ pos + end,
+ capacity(),
+ address);
+ }
+
+#end[char]
+
+
+ public ByteOrder order() {
+#if[boB]
+ return ByteOrder.BIG_ENDIAN;
+#end[boB]
+#if[boL]
+ return ByteOrder.LITTLE_ENDIAN;
+#end[boL]
+ }
+
+#if[char]
+ ByteOrder charRegionOrder() {
+ return order();
+ }
+#end[char]
+}
\ No newline at end of file
diff --git a/ojluni/src/main/java/java/nio/Direct-X-Buffer-bin.java.template b/ojluni/src/main/java/java/nio/Direct-X-Buffer-bin.java.template
new file mode 100644
index 0000000..8c75116
--- /dev/null
+++ b/ojluni/src/main/java/java/nio/Direct-X-Buffer-bin.java.template
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#warn This file is preprocessed before being compiled
+
+class XXX {
+
+#begin
+
+#if[rw]
+
+ private $type$ get$Type$(long a) {
+ try {
+ $memtype$ x = UNSAFE.get$Memtype$Unaligned(null, a, bigEndian);
+ return $fromBits$(x);
+ } finally {
+ Reference.reachabilityFence(this);
+ }
+ }
+
+ public $type$ get$Type$() {
+ try {
+ return get$Type$(ix(nextGetIndex($BYTES_PER_VALUE$)));
+ } finally {
+ Reference.reachabilityFence(this);
+ }
+ }
+
+ public $type$ get$Type$(int i) {
+ try {
+ return get$Type$(ix(checkIndex(i, $BYTES_PER_VALUE$)));
+ } finally {
+ Reference.reachabilityFence(this);
+ }
+ }
+
+#end[rw]
+
+ private ByteBuffer put$Type$(long a, $type$ x) {
+#if[rw]
+ try {
+ $memtype$ y = $toBits$(x);
+ UNSAFE.put$Memtype$Unaligned(null, a, y, bigEndian);
+ } finally {
+ Reference.reachabilityFence(this);
+ }
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public ByteBuffer put$Type$($type$ x) {
+#if[rw]
+ put$Type$(ix(nextPutIndex($BYTES_PER_VALUE$)), x);
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public ByteBuffer put$Type$(int i, $type$ x) {
+#if[rw]
+ put$Type$(ix(checkIndex(i, $BYTES_PER_VALUE$)), x);
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public $Type$Buffer as$Type$Buffer() {
+ int off = this.position();
+ int lim = this.limit();
+ assert (off <= lim);
+ int rem = (off <= lim ? lim - off : 0);
+
+ int size = rem >> $LG_BYTES_PER_VALUE$;
+ if (!UNALIGNED && ((address + off) % $BYTES_PER_VALUE$ != 0)) {
+ return (bigEndian
+ ? ($Type$Buffer)(new ByteBufferAs$Type$Buffer$RW$B(this,
+ -1,
+ 0,
+ size,
+ size,
+ address + off))
+ : ($Type$Buffer)(new ByteBufferAs$Type$Buffer$RW$L(this,
+ -1,
+ 0,
+ size,
+ size,
+ address + off)));
+ } else {
+ return (nativeByteOrder
+ ? ($Type$Buffer)(new Direct$Type$Buffer$RW$U(this,
+ -1,
+ 0,
+ size,
+ size,
+ off))
+ : ($Type$Buffer)(new Direct$Type$Buffer$RW$S(this,
+ -1,
+ 0,
+ size,
+ size,
+ off)));
+ }
+ }
+
+#end
+
+}
\ No newline at end of file
diff --git a/ojluni/src/main/java/java/nio/Direct-X-Buffer.java.template b/ojluni/src/main/java/java/nio/Direct-X-Buffer.java.template
new file mode 100644
index 0000000..7f7e0f1
--- /dev/null
+++ b/ojluni/src/main/java/java/nio/Direct-X-Buffer.java.template
@@ -0,0 +1,544 @@
+/*
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#warn This file is preprocessed before being compiled
+
+package java.nio;
+
+import java.io.FileDescriptor;
+import java.lang.ref.Reference;
+import jdk.internal.misc.VM;
+import jdk.internal.ref.Cleaner;
+import sun.nio.ch.DirectBuffer;
+
+
+class Direct$Type$Buffer$RW$$BO$
+#if[rw]
+ extends {#if[byte]?Mapped$Type$Buffer:$Type$Buffer}
+#else[rw]
+ extends Direct$Type$Buffer$BO$
+#end[rw]
+ implements DirectBuffer
+{
+
+#if[rw]
+
+ // Cached array base offset
+ private static final long ARRAY_BASE_OFFSET = UNSAFE.arrayBaseOffset($type$[].class);
+
+ // Cached unaligned-access capability
+ protected static final boolean UNALIGNED = Bits.unaligned();
+
+ // Base address, used in all indexing calculations
+ // NOTE: moved up to Buffer.java for speed in JNI GetDirectBufferAddress
+ // protected long address;
+
+ // An object attached to this buffer. If this buffer is a view of another
+ // buffer then we use this field to keep a reference to that buffer to
+ // ensure that its memory isn't freed before we are done with it.
+ private final Object att;
+
+ public Object attachment() {
+ return att;
+ }
+
+#if[byte]
+
+ private static class Deallocator
+ implements Runnable
+ {
+
+ private long address;
+ private long size;
+ private int capacity;
+
+ private Deallocator(long address, long size, int capacity) {
+ assert (address != 0);
+ this.address = address;
+ this.size = size;
+ this.capacity = capacity;
+ }
+
+ public void run() {
+ if (address == 0) {
+ // Paranoia
+ return;
+ }
+ UNSAFE.freeMemory(address);
+ address = 0;
+ Bits.unreserveMemory(size, capacity);
+ }
+
+ }
+
+ private final Cleaner cleaner;
+
+ public Cleaner cleaner() { return cleaner; }
+
+#else[byte]
+
+ public Cleaner cleaner() { return null; }
+
+#end[byte]
+
+#end[rw]
+
+#if[byte]
+
+ // Primary constructor
+ //
+ Direct$Type$Buffer$RW$(int cap) { // package-private
+#if[rw]
+ super(-1, 0, cap, cap);
+ boolean pa = VM.isDirectMemoryPageAligned();
+ int ps = Bits.pageSize();
+ long size = Math.max(1L, (long)cap + (pa ? ps : 0));
+ Bits.reserveMemory(size, cap);
+
+ long base = 0;
+ try {
+ base = UNSAFE.allocateMemory(size);
+ } catch (OutOfMemoryError x) {
+ Bits.unreserveMemory(size, cap);
+ throw x;
+ }
+ UNSAFE.setMemory(base, size, (byte) 0);
+ if (pa && (base % ps != 0)) {
+ // Round up to page boundary
+ address = base + ps - (base & (ps - 1));
+ } else {
+ address = base;
+ }
+ cleaner = Cleaner.create(this, new Deallocator(base, size, cap));
+ att = null;
+#else[rw]
+ super(cap);
+ this.isReadOnly = true;
+#end[rw]
+ }
+
+#if[rw]
+
+ // Invoked to construct a direct ByteBuffer referring to the block of
+ // memory. A given arbitrary object may also be attached to the buffer.
+ //
+ Direct$Type$Buffer(long addr, int cap, Object ob) {
+ super(-1, 0, cap, cap);
+ address = addr;
+ cleaner = null;
+ att = ob;
+ }
+
+
+ // Invoked only by JNI: NewDirectByteBuffer(void*, long)
+ //
+ private Direct$Type$Buffer(long addr, int cap) {
+ super(-1, 0, cap, cap);
+ address = addr;
+ cleaner = null;
+ att = null;
+ }
+
+#end[rw]
+
+ // For memory-mapped buffers -- invoked by FileChannelImpl via reflection
+ //
+ protected Direct$Type$Buffer$RW$(int cap, long addr,
+ FileDescriptor fd,
+ Runnable unmapper)
+ {
+#if[rw]
+ super(-1, 0, cap, cap, fd);
+ address = addr;
+ cleaner = Cleaner.create(this, unmapper);
+ att = null;
+#else[rw]
+ super(cap, addr, fd, unmapper);
+ this.isReadOnly = true;
+#end[rw]
+ }
+
+#end[byte]
+
+ // For duplicates and slices
+ //
+ Direct$Type$Buffer$RW$$BO$(DirectBuffer db, // package-private
+ int mark, int pos, int lim, int cap,
+ int off)
+ {
+#if[rw]
+ super(mark, pos, lim, cap);
+ address = db.address() + off;
+#if[byte]
+ cleaner = null;
+#end[byte]
+ att = db;
+#else[rw]
+ super(db, mark, pos, lim, cap, off);
+ this.isReadOnly = true;
+#end[rw]
+ }
+
+ @Override
+ Object base() {
+ return null;
+ }
+
+ public $Type$Buffer slice() {
+ int pos = this.position();
+ int lim = this.limit();
+ assert (pos <= lim);
+ int rem = (pos <= lim ? lim - pos : 0);
+ int off = (pos << $LG_BYTES_PER_VALUE$);
+ assert (off >= 0);
+ return new Direct$Type$Buffer$RW$$BO$(this, -1, 0, rem, rem, off);
+ }
+
+#if[byte]
+ public $Type$Buffer slice(int pos, int lim) {
+ assert (pos >= 0);
+ assert (pos <= lim);
+ int rem = lim - pos;
+ return new Direct$Type$Buffer$RW$$BO$(this, -1, 0, rem, rem, pos);
+ }
+#end[byte]
+
+ public $Type$Buffer duplicate() {
+ return new Direct$Type$Buffer$RW$$BO$(this,
+ this.markValue(),
+ this.position(),
+ this.limit(),
+ this.capacity(),
+ 0);
+ }
+
+ public $Type$Buffer asReadOnlyBuffer() {
+#if[rw]
+ return new Direct$Type$BufferR$BO$(this,
+ this.markValue(),
+ this.position(),
+ this.limit(),
+ this.capacity(),
+ 0);
+#else[rw]
+ return duplicate();
+#end[rw]
+ }
+
+#if[rw]
+
+ public long address() {
+ return address;
+ }
+
+ private long ix(int i) {
+ return address + ((long)i << $LG_BYTES_PER_VALUE$);
+ }
+
+ public $type$ get() {
+ try {
+ return $fromBits$($swap$(UNSAFE.get$Swaptype$(ix(nextGetIndex()))));
+ } finally {
+ Reference.reachabilityFence(this);
+ }
+ }
+
+ public $type$ get(int i) {
+ try {
+ return $fromBits$($swap$(UNSAFE.get$Swaptype$(ix(checkIndex(i)))));
+ } finally {
+ Reference.reachabilityFence(this);
+ }
+ }
+
+#if[streamableType]
+ $type$ getUnchecked(int i) {
+ try {
+ return $fromBits$($swap$(UNSAFE.get$Swaptype$(ix(i))));
+ } finally {
+ Reference.reachabilityFence(this);
+ }
+ }
+#end[streamableType]
+
+ public $Type$Buffer get($type$[] dst, int offset, int length) {
+#if[rw]
+ if (((long)length << $LG_BYTES_PER_VALUE$) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) {
+ checkBounds(offset, length, dst.length);
+ int pos = position();
+ int lim = limit();
+ assert (pos <= lim);
+ int rem = (pos <= lim ? lim - pos : 0);
+ if (length > rem)
+ throw new BufferUnderflowException();
+
+ long dstOffset = ARRAY_BASE_OFFSET + ((long)offset << $LG_BYTES_PER_VALUE$);
+ try {
+#if[!byte]
+ if (order() != ByteOrder.nativeOrder())
+ UNSAFE.copySwapMemory(null,
+ ix(pos),
+ dst,
+ dstOffset,
+ (long)length << $LG_BYTES_PER_VALUE$,
+ (long)1 << $LG_BYTES_PER_VALUE$);
+ else
+#end[!byte]
+ UNSAFE.copyMemory(null,
+ ix(pos),
+ dst,
+ dstOffset,
+ (long)length << $LG_BYTES_PER_VALUE$);
+ } finally {
+ Reference.reachabilityFence(this);
+ }
+ position(pos + length);
+ } else {
+ super.get(dst, offset, length);
+ }
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+#end[rw]
+
+ public $Type$Buffer put($type$ x) {
+#if[rw]
+ try {
+ UNSAFE.put$Swaptype$(ix(nextPutIndex()), $swap$($toBits$(x)));
+ } finally {
+ Reference.reachabilityFence(this);
+ }
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public $Type$Buffer put(int i, $type$ x) {
+#if[rw]
+ try {
+ UNSAFE.put$Swaptype$(ix(checkIndex(i)), $swap$($toBits$(x)));
+ } finally {
+ Reference.reachabilityFence(this);
+ }
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public $Type$Buffer put($Type$Buffer src) {
+#if[rw]
+ if (src instanceof Direct$Type$Buffer$BO$) {
+ if (src == this)
+ throw createSameBufferException();
+ Direct$Type$Buffer$RW$$BO$ sb = (Direct$Type$Buffer$RW$$BO$)src;
+
+ int spos = sb.position();
+ int slim = sb.limit();
+ assert (spos <= slim);
+ int srem = (spos <= slim ? slim - spos : 0);
+
+ int pos = position();
+ int lim = limit();
+ assert (pos <= lim);
+ int rem = (pos <= lim ? lim - pos : 0);
+
+ if (srem > rem)
+ throw new BufferOverflowException();
+ try {
+ UNSAFE.copyMemory(sb.ix(spos), ix(pos), (long)srem << $LG_BYTES_PER_VALUE$);
+ } finally {
+ Reference.reachabilityFence(sb);
+ Reference.reachabilityFence(this);
+ }
+ sb.position(spos + srem);
+ position(pos + srem);
+ } else if (src.hb != null) {
+
+ int spos = src.position();
+ int slim = src.limit();
+ assert (spos <= slim);
+ int srem = (spos <= slim ? slim - spos : 0);
+
+ put(src.hb, src.offset + spos, srem);
+ src.position(spos + srem);
+
+ } else {
+ super.put(src);
+ }
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public $Type$Buffer put($type$[] src, int offset, int length) {
+#if[rw]
+ if (((long)length << $LG_BYTES_PER_VALUE$) > Bits.JNI_COPY_FROM_ARRAY_THRESHOLD) {
+ checkBounds(offset, length, src.length);
+ int pos = position();
+ int lim = limit();
+ assert (pos <= lim);
+ int rem = (pos <= lim ? lim - pos : 0);
+ if (length > rem)
+ throw new BufferOverflowException();
+
+ long srcOffset = ARRAY_BASE_OFFSET + ((long)offset << $LG_BYTES_PER_VALUE$);
+ try {
+#if[!byte]
+ if (order() != ByteOrder.nativeOrder())
+ UNSAFE.copySwapMemory(src,
+ srcOffset,
+ null,
+ ix(pos),
+ (long)length << $LG_BYTES_PER_VALUE$,
+ (long)1 << $LG_BYTES_PER_VALUE$);
+ else
+#end[!byte]
+ UNSAFE.copyMemory(src,
+ srcOffset,
+ null,
+ ix(pos),
+ (long)length << $LG_BYTES_PER_VALUE$);
+ } finally {
+ Reference.reachabilityFence(this);
+ }
+ position(pos + length);
+ } else {
+ super.put(src, offset, length);
+ }
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public $Type$Buffer compact() {
+#if[rw]
+ int pos = position();
+ int lim = limit();
+ assert (pos <= lim);
+ int rem = (pos <= lim ? lim - pos : 0);
+ try {
+ UNSAFE.copyMemory(ix(pos), ix(0), (long)rem << $LG_BYTES_PER_VALUE$);
+ } finally {
+ Reference.reachabilityFence(this);
+ }
+ position(rem);
+ limit(capacity());
+ discardMark();
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public boolean isDirect() {
+ return true;
+ }
+
+ public boolean isReadOnly() {
+ return {#if[rw]?false:true};
+ }
+
+
+#if[char]
+
+ public String toString(int start, int end) {
+ if ((end > limit()) || (start > end))
+ throw new IndexOutOfBoundsException();
+ try {
+ int len = end - start;
+ char[] ca = new char[len];
+ CharBuffer cb = CharBuffer.wrap(ca);
+ CharBuffer db = this.duplicate();
+ db.position(start);
+ db.limit(end);
+ cb.put(db);
+ return new String(ca);
+ } catch (StringIndexOutOfBoundsException x) {
+ throw new IndexOutOfBoundsException();
+ }
+ }
+
+
+ // --- Methods to support CharSequence ---
+
+ public CharBuffer subSequence(int start, int end) {
+ int pos = position();
+ int lim = limit();
+ assert (pos <= lim);
+ pos = (pos <= lim ? pos : lim);
+ int len = lim - pos;
+
+ if ((start < 0) || (end > len) || (start > end))
+ throw new IndexOutOfBoundsException();
+ return new DirectCharBuffer$RW$$BO$(this,
+ -1,
+ pos + start,
+ pos + end,
+ capacity(),
+ offset);
+ }
+
+#end[char]
+
+
+
+#if[!byte]
+
+ public ByteOrder order() {
+#if[boS]
+ return ((ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN)
+ ? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN);
+#end[boS]
+#if[boU]
+ return ((ByteOrder.nativeOrder() != ByteOrder.BIG_ENDIAN)
+ ? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN);
+#end[boU]
+ }
+
+#end[!byte]
+
+#if[char]
+ ByteOrder charRegionOrder() {
+ return order();
+ }
+#end[char]
+
+
+#if[byte]
+ // #BIN
+ //
+ // Binary-data access methods for short, char, int, long, float,
+ // and double will be inserted here
+
+#end[byte]
+
+}
\ No newline at end of file
diff --git a/ojluni/src/main/java/java/nio/Heap-X-Buffer.java.template b/ojluni/src/main/java/java/nio/Heap-X-Buffer.java.template
new file mode 100644
index 0000000..6304292
--- /dev/null
+++ b/ojluni/src/main/java/java/nio/Heap-X-Buffer.java.template
@@ -0,0 +1,640 @@
+/*
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#warn This file is preprocessed before being compiled
+
+package java.nio;
+
+/**
+#if[rw]
+ * A read/write Heap$Type$Buffer.
+#else[rw]
+ * A read-only Heap$Type$Buffer. This class extends the corresponding
+ * read/write class, overriding the mutation methods to throw a {@link
+ * ReadOnlyBufferException} and overriding the view-buffer methods to return an
+ * instance of this class rather than of the superclass.
+#end[rw]
+ */
+
+class Heap$Type$Buffer$RW$
+ extends {#if[ro]?Heap}$Type$Buffer
+{
+ // Cached array base offset
+ private static final long ARRAY_BASE_OFFSET = UNSAFE.arrayBaseOffset($type$[].class);
+
+ // Cached array base offset
+ private static final long ARRAY_INDEX_SCALE = UNSAFE.arrayIndexScale($type$[].class);
+
+ // For speed these fields are actually declared in X-Buffer;
+ // these declarations are here as documentation
+ /*
+#if[rw]
+ protected final $type$[] hb;
+ protected final int offset;
+#end[rw]
+ */
+
+ Heap$Type$Buffer$RW$(int cap, int lim) { // package-private
+#if[rw]
+ super(-1, 0, lim, cap, new $type$[cap], 0);
+ /*
+ hb = new $type$[cap];
+ offset = 0;
+ */
+ this.address = ARRAY_BASE_OFFSET;
+#else[rw]
+ super(cap, lim);
+ this.isReadOnly = true;
+#end[rw]
+ }
+
+ Heap$Type$Buffer$RW$($type$[] buf, int off, int len) { // package-private
+#if[rw]
+ super(-1, off, off + len, buf.length, buf, 0);
+ /*
+ hb = buf;
+ offset = 0;
+ */
+ this.address = ARRAY_BASE_OFFSET;
+#else[rw]
+ super(buf, off, len);
+ this.isReadOnly = true;
+#end[rw]
+ }
+
+ protected Heap$Type$Buffer$RW$($type$[] buf,
+ int mark, int pos, int lim, int cap,
+ int off)
+ {
+#if[rw]
+ super(mark, pos, lim, cap, buf, off);
+ /*
+ hb = buf;
+ offset = off;
+ */
+ this.address = ARRAY_BASE_OFFSET + off * ARRAY_INDEX_SCALE;
+#else[rw]
+ super(buf, mark, pos, lim, cap, off);
+ this.isReadOnly = true;
+#end[rw]
+ }
+
+ public $Type$Buffer slice() {
+ return new Heap$Type$Buffer$RW$(hb,
+ -1,
+ 0,
+ this.remaining(),
+ this.remaining(),
+ this.position() + offset);
+ }
+
+#if[byte]
+ $Type$Buffer slice(int pos, int lim) {
+ assert (pos >= 0);
+ assert (pos <= lim);
+ int rem = lim - pos;
+ return new Heap$Type$Buffer$RW$(hb,
+ -1,
+ 0,
+ rem,
+ rem,
+ pos + offset);
+ }
+#end[byte]
+
+ public $Type$Buffer duplicate() {
+ return new Heap$Type$Buffer$RW$(hb,
+ this.markValue(),
+ this.position(),
+ this.limit(),
+ this.capacity(),
+ offset);
+ }
+
+ public $Type$Buffer asReadOnlyBuffer() {
+#if[rw]
+ return new Heap$Type$BufferR(hb,
+ this.markValue(),
+ this.position(),
+ this.limit(),
+ this.capacity(),
+ offset);
+#else[rw]
+ return duplicate();
+#end[rw]
+ }
+
+#if[rw]
+
+ protected int ix(int i) {
+ return i + offset;
+ }
+
+#if[byte]
+ private long byteOffset(long i) {
+ return address + i;
+ }
+#end[byte]
+
+ public $type$ get() {
+ return hb[ix(nextGetIndex())];
+ }
+
+ public $type$ get(int i) {
+ return hb[ix(checkIndex(i))];
+ }
+
+#if[streamableType]
+ $type$ getUnchecked(int i) {
+ return hb[ix(i)];
+ }
+#end[streamableType]
+
+ public $Type$Buffer get($type$[] dst, int offset, int length) {
+ checkBounds(offset, length, dst.length);
+ if (length > remaining())
+ throw new BufferUnderflowException();
+ System.arraycopy(hb, ix(position()), dst, offset, length);
+ position(position() + length);
+ return this;
+ }
+
+ public boolean isDirect() {
+ return false;
+ }
+
+#end[rw]
+
+ public boolean isReadOnly() {
+ return {#if[rw]?false:true};
+ }
+
+ public $Type$Buffer put($type$ x) {
+#if[rw]
+ hb[ix(nextPutIndex())] = x;
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public $Type$Buffer put(int i, $type$ x) {
+#if[rw]
+ hb[ix(checkIndex(i))] = x;
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public $Type$Buffer put($type$[] src, int offset, int length) {
+#if[rw]
+ checkBounds(offset, length, src.length);
+ if (length > remaining())
+ throw new BufferOverflowException();
+ System.arraycopy(src, offset, hb, ix(position()), length);
+ position(position() + length);
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public $Type$Buffer put($Type$Buffer src) {
+#if[rw]
+ if (src instanceof Heap$Type$Buffer) {
+ if (src == this)
+ throw createSameBufferException();
+ Heap$Type$Buffer sb = (Heap$Type$Buffer)src;
+ int n = sb.remaining();
+ if (n > remaining())
+ throw new BufferOverflowException();
+ System.arraycopy(sb.hb, sb.ix(sb.position()),
+ hb, ix(position()), n);
+ sb.position(sb.position() + n);
+ position(position() + n);
+ } else if (src.isDirect()) {
+ int n = src.remaining();
+ if (n > remaining())
+ throw new BufferOverflowException();
+ src.get(hb, ix(position()), n);
+ position(position() + n);
+ } else {
+ super.put(src);
+ }
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public $Type$Buffer compact() {
+#if[rw]
+ System.arraycopy(hb, ix(position()), hb, ix(0), remaining());
+ position(remaining());
+ limit(capacity());
+ discardMark();
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+
+
+#if[byte]
+
+ byte _get(int i) { // package-private
+ return hb[i];
+ }
+
+ void _put(int i, byte b) { // package-private
+#if[rw]
+ hb[i] = b;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ // char
+
+#if[rw]
+
+ public char getChar() {
+ return UNSAFE.getCharUnaligned(hb, byteOffset(nextGetIndex(2)), bigEndian);
+ }
+
+ public char getChar(int i) {
+ return UNSAFE.getCharUnaligned(hb, byteOffset(checkIndex(i, 2)), bigEndian);
+ }
+
+#end[rw]
+
+ public $Type$Buffer putChar(char x) {
+#if[rw]
+ UNSAFE.putCharUnaligned(hb, byteOffset(nextPutIndex(2)), x, bigEndian);
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public $Type$Buffer putChar(int i, char x) {
+#if[rw]
+ UNSAFE.putCharUnaligned(hb, byteOffset(checkIndex(i, 2)), x, bigEndian);
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public CharBuffer asCharBuffer() {
+ int size = this.remaining() >> 1;
+ long addr = address + position();
+ return (bigEndian
+ ? (CharBuffer)(new ByteBufferAsCharBuffer$RW$B(this,
+ -1,
+ 0,
+ size,
+ size,
+ addr))
+ : (CharBuffer)(new ByteBufferAsCharBuffer$RW$L(this,
+ -1,
+ 0,
+ size,
+ size,
+ addr)));
+ }
+
+
+ // short
+
+#if[rw]
+
+ public short getShort() {
+ return UNSAFE.getShortUnaligned(hb, byteOffset(nextGetIndex(2)), bigEndian);
+ }
+
+ public short getShort(int i) {
+ return UNSAFE.getShortUnaligned(hb, byteOffset(checkIndex(i, 2)), bigEndian);
+ }
+
+#end[rw]
+
+ public $Type$Buffer putShort(short x) {
+#if[rw]
+ UNSAFE.putShortUnaligned(hb, byteOffset(nextPutIndex(2)), x, bigEndian);
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public $Type$Buffer putShort(int i, short x) {
+#if[rw]
+ UNSAFE.putShortUnaligned(hb, byteOffset(checkIndex(i, 2)), x, bigEndian);
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public ShortBuffer asShortBuffer() {
+ int size = this.remaining() >> 1;
+ long addr = address + position();
+ return (bigEndian
+ ? (ShortBuffer)(new ByteBufferAsShortBuffer$RW$B(this,
+ -1,
+ 0,
+ size,
+ size,
+ addr))
+ : (ShortBuffer)(new ByteBufferAsShortBuffer$RW$L(this,
+ -1,
+ 0,
+ size,
+ size,
+ addr)));
+ }
+
+
+ // int
+
+#if[rw]
+
+ public int getInt() {
+ return UNSAFE.getIntUnaligned(hb, byteOffset(nextGetIndex(4)), bigEndian);
+ }
+
+ public int getInt(int i) {
+ return UNSAFE.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian);
+ }
+
+#end[rw]
+
+ public $Type$Buffer putInt(int x) {
+#if[rw]
+ UNSAFE.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), x, bigEndian);
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public $Type$Buffer putInt(int i, int x) {
+#if[rw]
+ UNSAFE.putIntUnaligned(hb, byteOffset(checkIndex(i, 4)), x, bigEndian);
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public IntBuffer asIntBuffer() {
+ int size = this.remaining() >> 2;
+ long addr = address + position();
+ return (bigEndian
+ ? (IntBuffer)(new ByteBufferAsIntBuffer$RW$B(this,
+ -1,
+ 0,
+ size,
+ size,
+ addr))
+ : (IntBuffer)(new ByteBufferAsIntBuffer$RW$L(this,
+ -1,
+ 0,
+ size,
+ size,
+ addr)));
+ }
+
+
+ // long
+
+#if[rw]
+
+ public long getLong() {
+ return UNSAFE.getLongUnaligned(hb, byteOffset(nextGetIndex(8)), bigEndian);
+ }
+
+ public long getLong(int i) {
+ return UNSAFE.getLongUnaligned(hb, byteOffset(checkIndex(i, 8)), bigEndian);
+ }
+
+#end[rw]
+
+ public $Type$Buffer putLong(long x) {
+#if[rw]
+ UNSAFE.putLongUnaligned(hb, byteOffset(nextPutIndex(8)), x, bigEndian);
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public $Type$Buffer putLong(int i, long x) {
+#if[rw]
+ UNSAFE.putLongUnaligned(hb, byteOffset(checkIndex(i, 8)), x, bigEndian);
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public LongBuffer asLongBuffer() {
+ int size = this.remaining() >> 3;
+ long addr = address + position();
+ return (bigEndian
+ ? (LongBuffer)(new ByteBufferAsLongBuffer$RW$B(this,
+ -1,
+ 0,
+ size,
+ size,
+ addr))
+ : (LongBuffer)(new ByteBufferAsLongBuffer$RW$L(this,
+ -1,
+ 0,
+ size,
+ size,
+ addr)));
+ }
+
+
+ // float
+
+#if[rw]
+
+ public float getFloat() {
+ int x = UNSAFE.getIntUnaligned(hb, byteOffset(nextGetIndex(4)), bigEndian);
+ return Float.intBitsToFloat(x);
+ }
+
+ public float getFloat(int i) {
+ int x = UNSAFE.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian);
+ return Float.intBitsToFloat(x);
+ }
+
+#end[rw]
+
+ public $Type$Buffer putFloat(float x) {
+#if[rw]
+ int y = Float.floatToRawIntBits(x);
+ UNSAFE.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), y, bigEndian);
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public $Type$Buffer putFloat(int i, float x) {
+#if[rw]
+ int y = Float.floatToRawIntBits(x);
+ UNSAFE.putIntUnaligned(hb, byteOffset(checkIndex(i, 4)), y, bigEndian);
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public FloatBuffer asFloatBuffer() {
+ int size = this.remaining() >> 2;
+ long addr = address + position();
+ return (bigEndian
+ ? (FloatBuffer)(new ByteBufferAsFloatBuffer$RW$B(this,
+ -1,
+ 0,
+ size,
+ size,
+ addr))
+ : (FloatBuffer)(new ByteBufferAsFloatBuffer$RW$L(this,
+ -1,
+ 0,
+ size,
+ size,
+ addr)));
+ }
+
+
+ // double
+
+#if[rw]
+
+ public double getDouble() {
+ long x = UNSAFE.getLongUnaligned(hb, byteOffset(nextGetIndex(8)), bigEndian);
+ return Double.longBitsToDouble(x);
+ }
+
+ public double getDouble(int i) {
+ long x = UNSAFE.getLongUnaligned(hb, byteOffset(checkIndex(i, 8)), bigEndian);
+ return Double.longBitsToDouble(x);
+ }
+
+#end[rw]
+
+ public $Type$Buffer putDouble(double x) {
+#if[rw]
+ long y = Double.doubleToRawLongBits(x);
+ UNSAFE.putLongUnaligned(hb, byteOffset(nextPutIndex(8)), y, bigEndian);
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public $Type$Buffer putDouble(int i, double x) {
+#if[rw]
+ long y = Double.doubleToRawLongBits(x);
+ UNSAFE.putLongUnaligned(hb, byteOffset(checkIndex(i, 8)), y, bigEndian);
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
+ public DoubleBuffer asDoubleBuffer() {
+ int size = this.remaining() >> 3;
+ long addr = address + position();
+ return (bigEndian
+ ? (DoubleBuffer)(new ByteBufferAsDoubleBuffer$RW$B(this,
+ -1,
+ 0,
+ size,
+ size,
+ addr))
+ : (DoubleBuffer)(new ByteBufferAsDoubleBuffer$RW$L(this,
+ -1,
+ 0,
+ size,
+ size,
+ addr)));
+ }
+
+
+#end[byte]
+
+
+#if[char]
+
+ String toString(int start, int end) { // package-private
+ try {
+ return new String(hb, start + offset, end - start);
+ } catch (StringIndexOutOfBoundsException x) {
+ throw new IndexOutOfBoundsException();
+ }
+ }
+
+
+ // --- Methods to support CharSequence ---
+
+ public CharBuffer subSequence(int start, int end) {
+ if ((start < 0)
+ || (end > length())
+ || (start > end))
+ throw new IndexOutOfBoundsException();
+ int pos = position();
+ return new HeapCharBuffer$RW$(hb,
+ -1,
+ pos + start,
+ pos + end,
+ capacity(),
+ offset);
+ }
+
+#end[char]
+
+
+#if[!byte]
+
+ public ByteOrder order() {
+ return ByteOrder.nativeOrder();
+ }
+#end[!byte]
+#if[char]
+
+ ByteOrder charRegionOrder() {
+ return order();
+ }
+#end[char]
+}
\ No newline at end of file
diff --git a/ojluni/src/main/java/java/nio/X-Buffer-bin.java.template b/ojluni/src/main/java/java/nio/X-Buffer-bin.java.template
new file mode 100644
index 0000000..490f165
--- /dev/null
+++ b/ojluni/src/main/java/java/nio/X-Buffer-bin.java.template
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#warn This file is preprocessed before being compiled
+
+class XXX {
+
+#begin
+
+ /**
+ * Relative <i>get</i> method for reading $a$ $type$ value.
+ *
+ * <p> Reads the next $nbytes$ bytes at this buffer's current position,
+ * composing them into $a$ $type$ value according to the current byte order,
+ * and then increments the position by $nbytes$. </p>
+ *
+ * @return The $type$ value at the buffer's current position
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than $nbytes$ bytes
+ * remaining in this buffer
+ */
+ public abstract $type$ get$Type$();
+
+ /**
+ * Relative <i>put</i> method for writing $a$ $type$
+ * value <i>(optional operation)</i>.
+ *
+ * <p> Writes $nbytes$ bytes containing the given $type$ value, in the
+ * current byte order, into this buffer at the current position, and then
+ * increments the position by $nbytes$. </p>
+ *
+ * @param value
+ * The $type$ value to be written
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there are fewer than $nbytes$ bytes
+ * remaining in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public abstract ByteBuffer put$Type$($type$ value);
+
+ /**
+ * Absolute <i>get</i> method for reading $a$ $type$ value.
+ *
+ * <p> Reads $nbytes$ bytes at the given index, composing them into a
+ * $type$ value according to the current byte order. </p>
+ *
+ * @param index
+ * The index from which the bytes will be read
+ *
+ * @return The $type$ value at the given index
+ *
+ * @throws IndexOutOfBoundsException
+ * If {@code index} is negative
+ * or not smaller than the buffer's limit,
+ * minus $nbytesButOne$
+ */
+ public abstract $type$ get$Type$(int index);
+
+ /**
+ * Absolute <i>put</i> method for writing $a$ $type$
+ * value <i>(optional operation)</i>.
+ *
+ * <p> Writes $nbytes$ bytes containing the given $type$ value, in the
+ * current byte order, into this buffer at the given index. </p>
+ *
+ * @param index
+ * The index at which the bytes will be written
+ *
+ * @param value
+ * The $type$ value to be written
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If {@code index} is negative
+ * or not smaller than the buffer's limit,
+ * minus $nbytesButOne$
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public abstract ByteBuffer put$Type$(int index, $type$ value);
+
+ /**
+ * Creates a view of this byte buffer as $a$ $type$ buffer.
+ *
+ * <p> The content of the new buffer will start at this buffer's current
+ * position. Changes to this buffer's content will be visible in the new
+ * buffer, and vice versa; the two buffers' position, limit, and mark
+ * values will be independent.
+ *
+ * <p> The new buffer's position will be zero, its capacity and its limit
+ * will be the number of bytes remaining in this buffer divided by
+ * $nbytes$, its mark will be undefined, and its byte order will be that
+ * of the byte buffer at the moment the view is created. The new buffer
+ * will be direct if, and only if, this buffer is direct, and it will be
+ * read-only if, and only if, this buffer is read-only. </p>
+ *
+ * @return A new $type$ buffer
+ */
+ public abstract $Type$Buffer as$Type$Buffer();
+
+#end
+
+}
\ No newline at end of file
diff --git a/ojluni/src/main/java/java/nio/X-Buffer.java.template b/ojluni/src/main/java/java/nio/X-Buffer.java.template
new file mode 100644
index 0000000..888e5fa
--- /dev/null
+++ b/ojluni/src/main/java/java/nio/X-Buffer.java.template
@@ -0,0 +1,1803 @@
+/*
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#warn This file is preprocessed before being compiled
+
+package java.nio;
+
+#if[char]
+import java.io.IOException;
+#end[char]
+#if[streamableType]
+import java.util.Spliterator;
+import java.util.stream.StreamSupport;
+import java.util.stream.$Streamtype$Stream;
+#end[streamableType]
+
+import jdk.internal.util.ArraysSupport;
+
+/**
+ * $A$ $type$ buffer.
+ *
+ * <p> This class defines {#if[byte]?six:four} categories of operations upon
+ * $type$ buffers:
+ *
+ * <ul>
+ *
+ * <li><p> Absolute and relative {@link #get() <i>get</i>} and
+ * {@link #put($type$) <i>put</i>} methods that read and write
+ * single $type$s; </p></li>
+ *
+ * <li><p> Relative {@link #get($type$[]) <i>bulk get</i>}
+ * methods that transfer contiguous sequences of $type$s from this buffer
+ * into an array; {#if[!byte]?and}</p></li>
+ *
+ * <li><p> Relative {@link #put($type$[]) <i>bulk put</i>}
+ * methods that transfer contiguous sequences of $type$s from $a$
+ * $type$ array{#if[char]?, a string,} or some other $type$
+ * buffer into this buffer;{#if[!byte]? and} </p></li>
+ *
+#if[byte]
+ *
+ * <li><p> Absolute and relative {@link #getChar() <i>get</i>}
+ * and {@link #putChar(char) <i>put</i>} methods that read and
+ * write values of other primitive types, translating them to and from
+ * sequences of bytes in a particular byte order; </p></li>
+ *
+ * <li><p> Methods for creating <i><a href="#views">view buffers</a></i>,
+ * which allow a byte buffer to be viewed as a buffer containing values of
+ * some other primitive type; and </p></li>
+ *
+#end[byte]
+ *
+ * <li><p> A method for {@link #compact compacting}
+ * $a$ $type$ buffer. </p></li>
+ *
+ * </ul>
+ *
+ * <p> $Type$ buffers can be created either by {@link #allocate
+ * <i>allocation</i>}, which allocates space for the buffer's
+ *
+#if[byte]
+ *
+ * content, or by {@link #wrap($type$[]) <i>wrapping</i>} an
+ * existing $type$ array {#if[char]?or string} into a buffer.
+ *
+#else[byte]
+ *
+ * content, by {@link #wrap($type$[]) <i>wrapping</i>} an existing
+ * $type$ array {#if[char]?or string} into a buffer, or by creating a
+ * <a href="ByteBuffer.html#views"><i>view</i></a> of an existing byte buffer.
+ *
+#end[byte]
+ *
+#if[byte]
+ *
+ * <a id="direct"></a>
+ * <h2> Direct <i>vs.</i> non-direct buffers </h2>
+ *
+ * <p> A byte buffer is either <i>direct</i> or <i>non-direct</i>. Given a
+ * direct byte buffer, the Java virtual machine will make a best effort to
+ * perform native I/O operations directly upon it. That is, it will attempt to
+ * avoid copying the buffer's content to (or from) an intermediate buffer
+ * before (or after) each invocation of one of the underlying operating
+ * system's native I/O operations.
+ *
+ * <p> A direct byte buffer may be created by invoking the {@link
+ * #allocateDirect(int) allocateDirect} factory method of this class. The
+ * buffers returned by this method typically have somewhat higher allocation
+ * and deallocation costs than non-direct buffers. The contents of direct
+ * buffers may reside outside of the normal garbage-collected heap, and so
+ * their impact upon the memory footprint of an application might not be
+ * obvious. It is therefore recommended that direct buffers be allocated
+ * primarily for large, long-lived buffers that are subject to the underlying
+ * system's native I/O operations. In general it is best to allocate direct
+ * buffers only when they yield a measureable gain in program performance.
+ *
+ * <p> A direct byte buffer may also be created by {@link
+ * java.nio.channels.FileChannel#map mapping} a region of a file
+ * directly into memory. An implementation of the Java platform may optionally
+ * support the creation of direct byte buffers from native code via JNI. If an
+ * instance of one of these kinds of buffers refers to an inaccessible region
+ * of memory then an attempt to access that region will not change the buffer's
+ * content and will cause an unspecified exception to be thrown either at the
+ * time of the access or at some later time.
+ *
+ * <p> Whether a byte buffer is direct or non-direct may be determined by
+ * invoking its {@link #isDirect isDirect} method. This method is provided so
+ * that explicit buffer management can be done in performance-critical code.
+ *
+ *
+ * <a id="bin"></a>
+ * <h2> Access to binary data </h2>
+ *
+ * <p> This class defines methods for reading and writing values of all other
+ * primitive types, except {@code boolean}. Primitive values are translated
+ * to (or from) sequences of bytes according to the buffer's current byte
+ * order, which may be retrieved and modified via the {@link #order order}
+ * methods. Specific byte orders are represented by instances of the {@link
+ * ByteOrder} class. The initial order of a byte buffer is always {@link
+ * ByteOrder#BIG_ENDIAN BIG_ENDIAN}.
+ *
+ * <p> For access to heterogeneous binary data, that is, sequences of values of
+ * different types, this class defines a family of absolute and relative
+ * <i>get</i> and <i>put</i> methods for each type. For 32-bit floating-point
+ * values, for example, this class defines:
+ *
+ * <blockquote><pre>
+ * float {@link #getFloat()}
+ * float {@link #getFloat(int) getFloat(int index)}
+ * void {@link #putFloat(float) putFloat(float f)}
+ * void {@link #putFloat(int,float) putFloat(int index, float f)}</pre></blockquote>
+ *
+ * <p> Corresponding methods are defined for the types {@code char,
+ * short, int, long}, and {@code double}. The index
+ * parameters of the absolute <i>get</i> and <i>put</i> methods are in terms of
+ * bytes rather than of the type being read or written.
+ *
+ * <a id="views"></a>
+ *
+ * <p> For access to homogeneous binary data, that is, sequences of values of
+ * the same type, this class defines methods that can create <i>views</i> of a
+ * given byte buffer. A <i>view buffer</i> is simply another buffer whose
+ * content is backed by the byte buffer. Changes to the byte buffer's content
+ * will be visible in the view buffer, and vice versa; the two buffers'
+ * position, limit, and mark values are independent. The {@link
+ * #asFloatBuffer() asFloatBuffer} method, for example, creates an instance of
+ * the {@link FloatBuffer} class that is backed by the byte buffer upon which
+ * the method is invoked. Corresponding view-creation methods are defined for
+ * the types {@code char, short, int, long}, and {@code double}.
+ *
+ * <p> View buffers have three important advantages over the families of
+ * type-specific <i>get</i> and <i>put</i> methods described above:
+ *
+ * <ul>
+ *
+ * <li><p> A view buffer is indexed not in terms of bytes but rather in terms
+ * of the type-specific size of its values; </p></li>
+ *
+ * <li><p> A view buffer provides relative bulk <i>get</i> and <i>put</i>
+ * methods that can transfer contiguous sequences of values between a buffer
+ * and an array or some other buffer of the same type; and </p></li>
+ *
+ * <li><p> A view buffer is potentially much more efficient because it will
+ * be direct if, and only if, its backing byte buffer is direct. </p></li>
+ *
+ * </ul>
+ *
+ * <p> The byte order of a view buffer is fixed to be that of its byte buffer
+ * at the time that the view is created. </p>
+ *
+#end[byte]
+*
+#if[!byte]
+ *
+ * <p> Like a byte buffer, $a$ $type$ buffer is either <a
+ * href="ByteBuffer.html#direct"><i>direct</i> or <i>non-direct</i></a>. A
+ * $type$ buffer created via the {@code wrap} methods of this class will
+ * be non-direct. $A$ $type$ buffer created as a view of a byte buffer will
+ * be direct if, and only if, the byte buffer itself is direct. Whether or not
+ * $a$ $type$ buffer is direct may be determined by invoking the {@link
+ * #isDirect isDirect} method. </p>
+ *
+#end[!byte]
+*
+#if[char]
+ *
+ * <p> This class implements the {@link CharSequence} interface so that
+ * character buffers may be used wherever character sequences are accepted, for
+ * example in the regular-expression package {@link java.util.regex}.
+ * </p>
+ *
+#end[char]
+ *
+#if[byte]
+ * <h2> Invocation chaining </h2>
+#end[byte]
+ *
+ * <p> Methods in this class that do not otherwise have a value to return are
+ * specified to return the buffer upon which they are invoked. This allows
+ * method invocations to be chained.
+ *
+#if[byte]
+ *
+ * The sequence of statements
+ *
+ * <blockquote><pre>
+ * bb.putInt(0xCAFEBABE);
+ * bb.putShort(3);
+ * bb.putShort(45);</pre></blockquote>
+ *
+ * can, for example, be replaced by the single statement
+ *
+ * <blockquote><pre>
+ * bb.putInt(0xCAFEBABE).putShort(3).putShort(45);</pre></blockquote>
+ *
+#end[byte]
+#if[char]
+ *
+ * The sequence of statements
+ *
+ * <blockquote><pre>
+ * cb.put("text/");
+ * cb.put(subtype);
+ * cb.put("; charset=");
+ * cb.put(enc);</pre></blockquote>
+ *
+ * can, for example, be replaced by the single statement
+ *
+ * <blockquote><pre>
+ * cb.put("text/").put(subtype).put("; charset=").put(enc);</pre></blockquote>
+ *
+#end[char]
+ *
+ *
+ * @author Mark Reinhold
+ * @author JSR-51 Expert Group
+ * @since 1.4
+ */
+
+public abstract class $Type$Buffer
+ extends Buffer
+ implements Comparable<$Type$Buffer>{#if[char]?, Appendable, CharSequence, Readable}
+{
+
+ // These fields are declared here rather than in Heap-X-Buffer in order to
+ // reduce the number of virtual method invocations needed to access these
+ // values, which is especially costly when coding small buffers.
+ //
+ final $type$[] hb; // Non-null only for heap buffers
+ final int offset;
+ boolean isReadOnly;
+
+ // Creates a new buffer with the given mark, position, limit, capacity,
+ // backing array, and array offset
+ //
+ $Type$Buffer(int mark, int pos, int lim, int cap, // package-private
+ $type$[] hb, int offset)
+ {
+ super(mark, pos, lim, cap);
+ this.hb = hb;
+ this.offset = offset;
+ }
+
+ // Creates a new buffer with the given mark, position, limit, and capacity
+ //
+ $Type$Buffer(int mark, int pos, int lim, int cap) { // package-private
+ this(mark, pos, lim, cap, null, 0);
+ }
+
+ @Override
+ Object base() {
+ return hb;
+ }
+
+#if[byte]
+
+ /**
+ * Allocates a new direct $type$ buffer.
+ *
+ * <p> The new buffer's position will be zero, its limit will be its
+ * capacity, its mark will be undefined, each of its elements will be
+ * initialized to zero, and its byte order will be
+ * {@link ByteOrder#BIG_ENDIAN BIG_ENDIAN}. Whether or not it has a
+ * {@link #hasArray backing array} is unspecified.
+ *
+ * @param capacity
+ * The new buffer's capacity, in $type$s
+ *
+ * @return The new $type$ buffer
+ *
+ * @throws IllegalArgumentException
+ * If the {@code capacity} is a negative integer
+ */
+ public static $Type$Buffer allocateDirect(int capacity) {
+ return new Direct$Type$Buffer(capacity);
+ }
+
+#end[byte]
+
+ /**
+ * Allocates a new $type$ buffer.
+ *
+ * <p> The new buffer's position will be zero, its limit will be its
+ * capacity, its mark will be undefined, each of its elements will be
+ * initialized to zero, and its byte order will be
+#if[byte]
+ * {@link ByteOrder#BIG_ENDIAN BIG_ENDIAN}.
+#else[byte]
+ * the {@link ByteOrder#nativeOrder native order} of the underlying
+ * hardware.
+#end[byte]
+ * It will have a {@link #array backing array}, and its
+ * {@link #arrayOffset array offset} will be zero.
+ *
+ * @param capacity
+ * The new buffer's capacity, in $type$s
+ *
+ * @return The new $type$ buffer
+ *
+ * @throws IllegalArgumentException
+ * If the {@code capacity} is a negative integer
+ */
+ public static $Type$Buffer allocate(int capacity) {
+ if (capacity < 0)
+ throw createCapacityException(capacity);
+ return new Heap$Type$Buffer(capacity, capacity);
+ }
+
+ /**
+ * Wraps $a$ $type$ array into a buffer.
+ *
+ * <p> The new buffer will be backed by the given $type$ array;
+ * that is, modifications to the buffer will cause the array to be modified
+ * and vice versa. The new buffer's capacity will be
+ * {@code array.length}, its position will be {@code offset}, its limit
+ * will be {@code offset + length}, its mark will be undefined, and its
+ * byte order will be
+#if[byte]
+ * {@link ByteOrder#BIG_ENDIAN BIG_ENDIAN}.
+#else[byte]
+ * the {@link ByteOrder#nativeOrder native order} of the underlying
+ * hardware.
+#end[byte]
+ * Its {@link #array backing array} will be the given array, and
+ * its {@link #arrayOffset array offset} will be zero. </p>
+ *
+ * @param array
+ * The array that will back the new buffer
+ *
+ * @param offset
+ * The offset of the subarray to be used; must be non-negative and
+ * no larger than {@code array.length}. The new buffer's position
+ * will be set to this value.
+ *
+ * @param length
+ * The length of the subarray to be used;
+ * must be non-negative and no larger than
+ * {@code array.length - offset}.
+ * The new buffer's limit will be set to {@code offset + length}.
+ *
+ * @return The new $type$ buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the {@code offset} and {@code length}
+ * parameters do not hold
+ */
+ public static $Type$Buffer wrap($type$[] array,
+ int offset, int length)
+ {
+ try {
+ return new Heap$Type$Buffer(array, offset, length);
+ } catch (IllegalArgumentException x) {
+ throw new IndexOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Wraps $a$ $type$ array into a buffer.
+ *
+ * <p> The new buffer will be backed by the given $type$ array;
+ * that is, modifications to the buffer will cause the array to be modified
+ * and vice versa. The new buffer's capacity and limit will be
+ * {@code array.length}, its position will be zero, its mark will be
+ * undefined, and its byte order will be
+#if[byte]
+ * {@link ByteOrder#BIG_ENDIAN BIG_ENDIAN}.
+#else[byte]
+ * the {@link ByteOrder#nativeOrder native order} of the underlying
+ * hardware.
+#end[byte]
+ * Its {@link #array backing array} will be the given array, and its
+ * {@link #arrayOffset array offset} will be zero. </p>
+ *
+ * @param array
+ * The array that will back this buffer
+ *
+ * @return The new $type$ buffer
+ */
+ public static $Type$Buffer wrap($type$[] array) {
+ return wrap(array, 0, array.length);
+ }
+
+#if[char]
+
+ /**
+ * Attempts to read characters into the specified character buffer.
+ * The buffer is used as a repository of characters as-is: the only
+ * changes made are the results of a put operation. No flipping or
+ * rewinding of the buffer is performed.
+ *
+ * @param target the buffer to read characters into
+ * @return The number of characters added to the buffer, or
+ * -1 if this source of characters is at its end
+ * @throws IOException if an I/O error occurs
+ * @throws NullPointerException if target is null
+ * @throws ReadOnlyBufferException if target is a read only buffer
+ * @since 1.5
+ */
+ public int read(CharBuffer target) throws IOException {
+ // Determine the number of bytes n that can be transferred
+ int targetRemaining = target.remaining();
+ int remaining = remaining();
+ if (remaining == 0)
+ return -1;
+ int n = Math.min(remaining, targetRemaining);
+ int limit = limit();
+ // Set source limit to prevent target overflow
+ if (targetRemaining < remaining)
+ limit(position() + n);
+ try {
+ if (n > 0)
+ target.put(this);
+ } finally {
+ limit(limit); // restore real limit
+ }
+ return n;
+ }
+
+ /**
+ * Wraps a character sequence into a buffer.
+ *
+ * <p> The content of the new, read-only buffer will be the content of the
+ * given character sequence. The buffer's capacity will be
+ * {@code csq.length()}, its position will be {@code start}, its limit
+ * will be {@code end}, and its mark will be undefined. </p>
+ *
+ * @param csq
+ * The character sequence from which the new character buffer is to
+ * be created
+ *
+ * @param start
+ * The index of the first character to be used;
+ * must be non-negative and no larger than {@code csq.length()}.
+ * The new buffer's position will be set to this value.
+ *
+ * @param end
+ * The index of the character following the last character to be
+ * used; must be no smaller than {@code start} and no larger
+ * than {@code csq.length()}.
+ * The new buffer's limit will be set to this value.
+ *
+ * @return The new character buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the {@code start} and {@code end}
+ * parameters do not hold
+ */
+ public static CharBuffer wrap(CharSequence csq, int start, int end) {
+ try {
+ return new StringCharBuffer(csq, start, end);
+ } catch (IllegalArgumentException x) {
+ throw new IndexOutOfBoundsException();
+ }
+ }
+
+ /**
+ * Wraps a character sequence into a buffer.
+ *
+ * <p> The content of the new, read-only buffer will be the content of the
+ * given character sequence. The new buffer's capacity and limit will be
+ * {@code csq.length()}, its position will be zero, and its mark will be
+ * undefined. </p>
+ *
+ * @param csq
+ * The character sequence from which the new character buffer is to
+ * be created
+ *
+ * @return The new character buffer
+ */
+ public static CharBuffer wrap(CharSequence csq) {
+ return wrap(csq, 0, csq.length());
+ }
+
+#end[char]
+
+ /**
+ * Creates a new $type$ buffer whose content is a shared subsequence of
+ * this buffer's content.
+ *
+ * <p> The content of the new buffer will start at this buffer's current
+ * position. Changes to this buffer's content will be visible in the new
+ * buffer, and vice versa; the two buffers' position, limit, and mark
+ * values will be independent.
+ *
+ * <p> The new buffer's position will be zero, its capacity and its limit
+ * will be the number of $type$s remaining in this buffer, its mark will be
+ * undefined, and its byte order will be
+#if[byte]
+ * {@link ByteOrder#BIG_ENDIAN BIG_ENDIAN}.
+#else[byte]
+ * identical to that of this buffer.
+#end[byte]
+ * The new buffer will be direct if, and only if, this buffer is direct, and
+ * it will be read-only if, and only if, this buffer is read-only. </p>
+ *
+ * @return The new $type$ buffer
+#if[byte]
+ *
+ * @see #alignedSlice(int)
+#end[byte]
+ */
+ @Override
+ public abstract $Type$Buffer slice();
+
+ /**
+ * Creates a new $type$ buffer that shares this buffer's content.
+ *
+ * <p> The content of the new buffer will be that of this buffer. Changes
+ * to this buffer's content will be visible in the new buffer, and vice
+ * versa; the two buffers' position, limit, and mark values will be
+ * independent.
+ *
+ * <p> The new buffer's capacity, limit, position,
+#if[byte]
+ * and mark values will be identical to those of this buffer, and its byte
+ * order will be {@link ByteOrder#BIG_ENDIAN BIG_ENDIAN}.
+#else[byte]
+ * mark values, and byte order will be identical to those of this buffer.
+#end[byte]
+ * The new buffer will be direct if, and only if, this buffer is direct, and
+ * it will be read-only if, and only if, this buffer is read-only. </p>
+ *
+ * @return The new $type$ buffer
+ */
+ @Override
+ public abstract $Type$Buffer duplicate();
+
+ /**
+ * Creates a new, read-only $type$ buffer that shares this buffer's
+ * content.
+ *
+ * <p> The content of the new buffer will be that of this buffer. Changes
+ * to this buffer's content will be visible in the new buffer; the new
+ * buffer itself, however, will be read-only and will not allow the shared
+ * content to be modified. The two buffers' position, limit, and mark
+ * values will be independent.
+ *
+ * <p> The new buffer's capacity, limit, position,
+#if[byte]
+ * and mark values will be identical to those of this buffer, and its byte
+ * order will be {@link ByteOrder#BIG_ENDIAN BIG_ENDIAN}.
+#else[byte]
+ * mark values, and byte order will be identical to those of this buffer.
+#end[byte]
+ *
+ * <p> If this buffer is itself read-only then this method behaves in
+ * exactly the same way as the {@link #duplicate duplicate} method. </p>
+ *
+ * @return The new, read-only $type$ buffer
+ */
+ public abstract $Type$Buffer asReadOnlyBuffer();
+
+
+ // -- Singleton get/put methods --
+
+ /**
+ * Relative <i>get</i> method. Reads the $type$ at this buffer's
+ * current position, and then increments the position.
+ *
+ * @return The $type$ at the buffer's current position
+ *
+ * @throws BufferUnderflowException
+ * If the buffer's current position is not smaller than its limit
+ */
+ public abstract $type$ get();
+
+ /**
+ * Relative <i>put</i> method <i>(optional operation)</i>.
+ *
+ * <p> Writes the given $type$ into this buffer at the current
+ * position, and then increments the position. </p>
+ *
+ * @param $x$
+ * The $type$ to be written
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If this buffer's current position is not smaller than its limit
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public abstract $Type$Buffer put($type$ $x$);
+
+ /**
+ * Absolute <i>get</i> method. Reads the $type$ at the given
+ * index.
+ *
+ * @param index
+ * The index from which the $type$ will be read
+ *
+ * @return The $type$ at the given index
+ *
+ * @throws IndexOutOfBoundsException
+ * If {@code index} is negative
+ * or not smaller than the buffer's limit
+ */
+ public abstract $type$ get(int index);
+
+#if[streamableType]
+ /**
+ * Absolute <i>get</i> method. Reads the $type$ at the given
+ * index without any validation of the index.
+ *
+ * @param index
+ * The index from which the $type$ will be read
+ *
+ * @return The $type$ at the given index
+ */
+ abstract $type$ getUnchecked(int index); // package-private
+#end[streamableType]
+
+ /**
+ * Absolute <i>put</i> method <i>(optional operation)</i>.
+ *
+ * <p> Writes the given $type$ into this buffer at the given
+ * index. </p>
+ *
+ * @param index
+ * The index at which the $type$ will be written
+ *
+ * @param $x$
+ * The $type$ value to be written
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If {@code index} is negative
+ * or not smaller than the buffer's limit
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public abstract $Type$Buffer put(int index, $type$ $x$);
+
+
+ // -- Bulk get operations --
+
+ /**
+ * Relative bulk <i>get</i> method.
+ *
+ * <p> This method transfers $type$s from this buffer into the given
+ * destination array. If there are fewer $type$s remaining in the
+ * buffer than are required to satisfy the request, that is, if
+ * {@code length} {@code >} {@code remaining()}, then no
+ * $type$s are transferred and a {@link BufferUnderflowException} is
+ * thrown.
+ *
+ * <p> Otherwise, this method copies {@code length} $type$s from this
+ * buffer into the given array, starting at the current position of this
+ * buffer and at the given offset in the array. The position of this
+ * buffer is then incremented by {@code length}.
+ *
+ * <p> In other words, an invocation of this method of the form
+ * <code>src.get(dst, off, len)</code> has exactly the same effect as
+ * the loop
+ *
+ * <pre>{@code
+ * for (int i = off; i < off + len; i++)
+ * dst[i] = src.get();
+ * }</pre>
+ *
+ * except that it first checks that there are sufficient $type$s in
+ * this buffer and it is potentially much more efficient.
+ *
+ * @param dst
+ * The array into which $type$s are to be written
+ *
+ * @param offset
+ * The offset within the array of the first $type$ to be
+ * written; must be non-negative and no larger than
+ * {@code dst.length}
+ *
+ * @param length
+ * The maximum number of $type$s to be written to the given
+ * array; must be non-negative and no larger than
+ * {@code dst.length - offset}
+ *
+ * @return This buffer
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than {@code length} $type$s
+ * remaining in this buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the {@code offset} and {@code length}
+ * parameters do not hold
+ */
+ public $Type$Buffer get($type$[] dst, int offset, int length) {
+ checkBounds(offset, length, dst.length);
+ if (length > remaining())
+ throw new BufferUnderflowException();
+ int end = offset + length;
+ for (int i = offset; i < end; i++)
+ dst[i] = get();
+ return this;
+ }
+
+ /**
+ * Relative bulk <i>get</i> method.
+ *
+ * <p> This method transfers $type$s from this buffer into the given
+ * destination array. An invocation of this method of the form
+ * {@code src.get(a)} behaves in exactly the same way as the invocation
+ *
+ * <pre>
+ * src.get(a, 0, a.length) </pre>
+ *
+ * @param dst
+ * The destination array
+ *
+ * @return This buffer
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than {@code length} $type$s
+ * remaining in this buffer
+ */
+ public $Type$Buffer get($type$[] dst) {
+ return get(dst, 0, dst.length);
+ }
+
+
+ // -- Bulk put operations --
+
+ /**
+ * Relative bulk <i>put</i> method <i>(optional operation)</i>.
+ *
+ * <p> This method transfers the $type$s remaining in the given source
+ * buffer into this buffer. If there are more $type$s remaining in the
+ * source buffer than in this buffer, that is, if
+ * {@code src.remaining()} {@code >} {@code remaining()},
+ * then no $type$s are transferred and a {@link
+ * BufferOverflowException} is thrown.
+ *
+ * <p> Otherwise, this method copies
+ * <i>n</i> = {@code src.remaining()} $type$s from the given
+ * buffer into this buffer, starting at each buffer's current position.
+ * The positions of both buffers are then incremented by <i>n</i>.
+ *
+ * <p> In other words, an invocation of this method of the form
+ * {@code dst.put(src)} has exactly the same effect as the loop
+ *
+ * <pre>
+ * while (src.hasRemaining())
+ * dst.put(src.get()); </pre>
+ *
+ * except that it first checks that there is sufficient space in this
+ * buffer and it is potentially much more efficient.
+ *
+ * @param src
+ * The source buffer from which $type$s are to be read;
+ * must not be this buffer
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ * for the remaining $type$s in the source buffer
+ *
+ * @throws IllegalArgumentException
+ * If the source buffer is this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public $Type$Buffer put($Type$Buffer src) {
+ if (src == this)
+ throw createSameBufferException();
+ if (isReadOnly())
+ throw new ReadOnlyBufferException();
+ int n = src.remaining();
+ if (n > remaining())
+ throw new BufferOverflowException();
+ for (int i = 0; i < n; i++)
+ put(src.get());
+ return this;
+ }
+
+ /**
+ * Relative bulk <i>put</i> method <i>(optional operation)</i>.
+ *
+ * <p> This method transfers $type$s into this buffer from the given
+ * source array. If there are more $type$s to be copied from the array
+ * than remain in this buffer, that is, if
+ * {@code length} {@code >} {@code remaining()}, then no
+ * $type$s are transferred and a {@link BufferOverflowException} is
+ * thrown.
+ *
+ * <p> Otherwise, this method copies {@code length} $type$s from the
+ * given array into this buffer, starting at the given offset in the array
+ * and at the current position of this buffer. The position of this buffer
+ * is then incremented by {@code length}.
+ *
+ * <p> In other words, an invocation of this method of the form
+ * <code>dst.put(src, off, len)</code> has exactly the same effect as
+ * the loop
+ *
+ * <pre>{@code
+ * for (int i = off; i < off + len; i++)
+ * dst.put(a[i]);
+ * }</pre>
+ *
+ * except that it first checks that there is sufficient space in this
+ * buffer and it is potentially much more efficient.
+ *
+ * @param src
+ * The array from which $type$s are to be read
+ *
+ * @param offset
+ * The offset within the array of the first $type$ to be read;
+ * must be non-negative and no larger than {@code array.length}
+ *
+ * @param length
+ * The number of $type$s to be read from the given array;
+ * must be non-negative and no larger than
+ * {@code array.length - offset}
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the {@code offset} and {@code length}
+ * parameters do not hold
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public $Type$Buffer put($type$[] src, int offset, int length) {
+ checkBounds(offset, length, src.length);
+ if (length > remaining())
+ throw new BufferOverflowException();
+ int end = offset + length;
+ for (int i = offset; i < end; i++)
+ this.put(src[i]);
+ return this;
+ }
+
+ /**
+ * Relative bulk <i>put</i> method <i>(optional operation)</i>.
+ *
+ * <p> This method transfers the entire content of the given source
+ * $type$ array into this buffer. An invocation of this method of the
+ * form {@code dst.put(a)} behaves in exactly the same way as the
+ * invocation
+ *
+ * <pre>
+ * dst.put(a, 0, a.length) </pre>
+ *
+ * @param src
+ * The source array
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public final $Type$Buffer put($type$[] src) {
+ return put(src, 0, src.length);
+ }
+
+#if[char]
+
+ /**
+ * Relative bulk <i>put</i> method <i>(optional operation)</i>.
+ *
+ * <p> This method transfers $type$s from the given string into this
+ * buffer. If there are more $type$s to be copied from the string than
+ * remain in this buffer, that is, if
+ * <code>end - start</code> {@code >} {@code remaining()},
+ * then no $type$s are transferred and a {@link
+ * BufferOverflowException} is thrown.
+ *
+ * <p> Otherwise, this method copies
+ * <i>n</i> = {@code end} - {@code start} $type$s
+ * from the given string into this buffer, starting at the given
+ * {@code start} index and at the current position of this buffer. The
+ * position of this buffer is then incremented by <i>n</i>.
+ *
+ * <p> In other words, an invocation of this method of the form
+ * <code>dst.put(src, start, end)</code> has exactly the same effect
+ * as the loop
+ *
+ * <pre>{@code
+ * for (int i = start; i < end; i++)
+ * dst.put(src.charAt(i));
+ * }</pre>
+ *
+ * except that it first checks that there is sufficient space in this
+ * buffer and it is potentially much more efficient.
+ *
+ * @param src
+ * The string from which $type$s are to be read
+ *
+ * @param start
+ * The offset within the string of the first $type$ to be read;
+ * must be non-negative and no larger than
+ * {@code string.length()}
+ *
+ * @param end
+ * The offset within the string of the last $type$ to be read,
+ * plus one; must be non-negative and no larger than
+ * {@code string.length()}
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the {@code start} and {@code end}
+ * parameters do not hold
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public $Type$Buffer put(String src, int start, int end) {
+ checkBounds(start, end - start, src.length());
+ if (isReadOnly())
+ throw new ReadOnlyBufferException();
+ if (end - start > remaining())
+ throw new BufferOverflowException();
+ for (int i = start; i < end; i++)
+ this.put(src.charAt(i));
+ return this;
+ }
+
+ /**
+ * Relative bulk <i>put</i> method <i>(optional operation)</i>.
+ *
+ * <p> This method transfers the entire content of the given source string
+ * into this buffer. An invocation of this method of the form
+ * {@code dst.put(s)} behaves in exactly the same way as the invocation
+ *
+ * <pre>
+ * dst.put(s, 0, s.length()) </pre>
+ *
+ * @param src
+ * The source string
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public final $Type$Buffer put(String src) {
+ return put(src, 0, src.length());
+ }
+
+#end[char]
+
+
+ // -- Other stuff --
+
+ /**
+ * Tells whether or not this buffer is backed by an accessible $type$
+ * array.
+ *
+ * <p> If this method returns {@code true} then the {@link #array() array}
+ * and {@link #arrayOffset() arrayOffset} methods may safely be invoked.
+ * </p>
+ *
+ * @return {@code true} if, and only if, this buffer
+ * is backed by an array and is not read-only
+ */
+ public final boolean hasArray() {
+ return (hb != null) && !isReadOnly;
+ }
+
+ /**
+ * Returns the $type$ array that backs this
+ * buffer <i>(optional operation)</i>.
+ *
+ * <p> Modifications to this buffer's content will cause the returned
+ * array's content to be modified, and vice versa.
+ *
+ * <p> Invoke the {@link #hasArray hasArray} method before invoking this
+ * method in order to ensure that this buffer has an accessible backing
+ * array. </p>
+ *
+ * @return The array that backs this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is backed by an array but is read-only
+ *
+ * @throws UnsupportedOperationException
+ * If this buffer is not backed by an accessible array
+ */
+ public final $type$[] array() {
+ if (hb == null)
+ throw new UnsupportedOperationException();
+ if (isReadOnly)
+ throw new ReadOnlyBufferException();
+ return hb;
+ }
+
+ /**
+ * Returns the offset within this buffer's backing array of the first
+ * element of the buffer <i>(optional operation)</i>.
+ *
+ * <p> If this buffer is backed by an array then buffer position <i>p</i>
+ * corresponds to array index <i>p</i> + {@code arrayOffset()}.
+ *
+ * <p> Invoke the {@link #hasArray hasArray} method before invoking this
+ * method in order to ensure that this buffer has an accessible backing
+ * array. </p>
+ *
+ * @return The offset within this buffer's array
+ * of the first element of the buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is backed by an array but is read-only
+ *
+ * @throws UnsupportedOperationException
+ * If this buffer is not backed by an accessible array
+ */
+ public final int arrayOffset() {
+ if (hb == null)
+ throw new UnsupportedOperationException();
+ if (isReadOnly)
+ throw new ReadOnlyBufferException();
+ return offset;
+ }
+
+ // -- Covariant return type overrides
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public
+#if[!byte]
+ final
+#end[!byte]
+ $Type$Buffer position(int newPosition) {
+ super.position(newPosition);
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public
+#if[!byte]
+ final
+#end[!byte]
+ $Type$Buffer limit(int newLimit) {
+ super.limit(newLimit);
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public
+#if[!byte]
+ final
+#end[!byte]
+ $Type$Buffer mark() {
+ super.mark();
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public
+#if[!byte]
+ final
+#end[!byte]
+ $Type$Buffer reset() {
+ super.reset();
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public
+#if[!byte]
+ final
+#end[!byte]
+ $Type$Buffer clear() {
+ super.clear();
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public
+#if[!byte]
+ final
+#end[!byte]
+ $Type$Buffer flip() {
+ super.flip();
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public
+#if[!byte]
+ final
+#end[!byte]
+ $Type$Buffer rewind() {
+ super.rewind();
+ return this;
+ }
+
+ /**
+ * Compacts this buffer <i>(optional operation)</i>.
+ *
+ * <p> The $type$s between the buffer's current position and its limit,
+ * if any, are copied to the beginning of the buffer. That is, the
+ * $type$ at index <i>p</i> = {@code position()} is copied
+ * to index zero, the $type$ at index <i>p</i> + 1 is copied
+ * to index one, and so forth until the $type$ at index
+ * {@code limit()} - 1 is copied to index
+ * <i>n</i> = {@code limit()} - {@code 1} - <i>p</i>.
+ * The buffer's position is then set to <i>n+1</i> and its limit is set to
+ * its capacity. The mark, if defined, is discarded.
+ *
+ * <p> The buffer's position is set to the number of $type$s copied,
+ * rather than to zero, so that an invocation of this method can be
+ * followed immediately by an invocation of another relative <i>put</i>
+ * method. </p>
+ *
+#if[byte]
+ *
+ * <p> Invoke this method after writing data from a buffer in case the
+ * write was incomplete. The following loop, for example, copies bytes
+ * from one channel to another via the buffer {@code buf}:
+ *
+ * <blockquote><pre>{@code
+ * buf.clear(); // Prepare buffer for use
+ * while (in.read(buf) >= 0 || buf.position != 0) {
+ * buf.flip();
+ * out.write(buf);
+ * buf.compact(); // In case of partial write
+ * }
+ * }</pre></blockquote>
+ *
+#end[byte]
+ *
+ * @return This buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ */
+ public abstract $Type$Buffer compact();
+
+ /**
+ * Tells whether or not this $type$ buffer is direct.
+ *
+ * @return {@code true} if, and only if, this buffer is direct
+ */
+ public abstract boolean isDirect();
+
+#if[!char]
+
+ /**
+ * Returns a string summarizing the state of this buffer.
+ *
+ * @return A summary string
+ */
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append(getClass().getName());
+ sb.append("[pos=");
+ sb.append(position());
+ sb.append(" lim=");
+ sb.append(limit());
+ sb.append(" cap=");
+ sb.append(capacity());
+ sb.append("]");
+ return sb.toString();
+ }
+
+#end[!char]
+
+
+ // ## Should really use unchecked accessors here for speed
+
+ /**
+ * Returns the current hash code of this buffer.
+ *
+ * <p> The hash code of a $type$ buffer depends only upon its remaining
+ * elements; that is, upon the elements from {@code position()} up to, and
+ * including, the element at {@code limit()} - {@code 1}.
+ *
+ * <p> Because buffer hash codes are content-dependent, it is inadvisable
+ * to use buffers as keys in hash maps or similar data structures unless it
+ * is known that their contents will not change. </p>
+ *
+ * @return The current hash code of this buffer
+ */
+ public int hashCode() {
+ int h = 1;
+ int p = position();
+ for (int i = limit() - 1; i >= p; i--)
+#if[int]
+ h = 31 * h + get(i);
+#else[int]
+ h = 31 * h + (int)get(i);
+#end[int]
+ return h;
+ }
+
+ /**
+ * Tells whether or not this buffer is equal to another object.
+ *
+ * <p> Two $type$ buffers are equal if, and only if,
+ *
+ * <ol>
+ *
+ * <li><p> They have the same element type, </p></li>
+ *
+ * <li><p> They have the same number of remaining elements, and
+ * </p></li>
+ *
+ * <li><p> The two sequences of remaining elements, considered
+ * independently of their starting positions, are pointwise equal.
+#if[floatingPointType]
+ * This method considers two $type$ elements {@code a} and {@code b}
+ * to be equal if
+ * {@code (a == b) || ($Fulltype$.isNaN(a) && $Fulltype$.isNaN(b))}.
+ * The values {@code -0.0} and {@code +0.0} are considered to be
+ * equal, unlike {@link $Fulltype$#equals(Object)}.
+#end[floatingPointType]
+ * </p></li>
+ *
+ * </ol>
+ *
+ * <p> A $type$ buffer is not equal to any other type of object. </p>
+ *
+ * @param ob The object to which this buffer is to be compared
+ *
+ * @return {@code true} if, and only if, this buffer is equal to the
+ * given object
+ */
+ public boolean equals(Object ob) {
+ if (this == ob)
+ return true;
+ if (!(ob instanceof $Type$Buffer))
+ return false;
+ $Type$Buffer that = ($Type$Buffer)ob;
+ if (this.remaining() != that.remaining())
+ return false;
+ return BufferMismatch.mismatch(this, this.position(),
+ that, that.position(),
+ this.remaining()) < 0;
+ }
+
+ /**
+ * Compares this buffer to another.
+ *
+ * <p> Two $type$ buffers are compared by comparing their sequences of
+ * remaining elements lexicographically, without regard to the starting
+ * position of each sequence within its corresponding buffer.
+#if[floatingPointType]
+ * Pairs of {@code $type$} elements are compared as if by invoking
+ * {@link $Fulltype$#compare($type$,$type$)}, except that
+ * {@code -0.0} and {@code 0.0} are considered to be equal.
+ * {@code $Fulltype$.NaN} is considered by this method to be equal
+ * to itself and greater than all other {@code $type$} values
+ * (including {@code $Fulltype$.POSITIVE_INFINITY}).
+#else[floatingPointType]
+ * Pairs of {@code $type$} elements are compared as if by invoking
+ * {@link $Fulltype$#compare($type$,$type$)}.
+#end[floatingPointType]
+ *
+ * <p> A $type$ buffer is not comparable to any other type of object.
+ *
+ * @return A negative integer, zero, or a positive integer as this buffer
+ * is less than, equal to, or greater than the given buffer
+ */
+ public int compareTo($Type$Buffer that) {
+ int i = BufferMismatch.mismatch(this, this.position(),
+ that, that.position(),
+ Math.min(this.remaining(), that.remaining()));
+ if (i >= 0) {
+ return compare(this.get(this.position() + i), that.get(that.position() + i));
+ }
+ return this.remaining() - that.remaining();
+ }
+
+ private static int compare($type$ x, $type$ y) {
+#if[floatingPointType]
+ return ((x < y) ? -1 :
+ (x > y) ? +1 :
+ (x == y) ? 0 :
+ $Fulltype$.isNaN(x) ? ($Fulltype$.isNaN(y) ? 0 : +1) : -1);
+#else[floatingPointType]
+ return $Fulltype$.compare(x, y);
+#end[floatingPointType]
+ }
+
+ /**
+ * Finds and returns the relative index of the first mismatch between this
+ * buffer and a given buffer. The index is relative to the
+ * {@link #position() position} of each buffer and will be in the range of
+ * 0 (inclusive) up to the smaller of the {@link #remaining() remaining}
+ * elements in each buffer (exclusive).
+ *
+ * <p> If the two buffers share a common prefix then the returned index is
+ * the length of the common prefix and it follows that there is a mismatch
+ * between the two buffers at that index within the respective buffers.
+ * If one buffer is a proper prefix of the other then the returned index is
+ * the smaller of the remaining elements in each buffer, and it follows that
+ * the index is only valid for the buffer with the larger number of
+ * remaining elements.
+ * Otherwise, there is no mismatch.
+ *
+ * @param that
+ * The byte buffer to be tested for a mismatch with this buffer
+ *
+ * @return The relative index of the first mismatch between this and the
+ * given buffer, otherwise -1 if no mismatch.
+ *
+ * @since 11
+ */
+ public int mismatch($Type$Buffer that) {
+ int length = Math.min(this.remaining(), that.remaining());
+ int r = BufferMismatch.mismatch(this, this.position(),
+ that, that.position(),
+ length);
+ return (r == -1 && this.remaining() != that.remaining()) ? length : r;
+ }
+
+ // -- Other char stuff --
+
+#if[char]
+
+ /**
+ * Returns a string containing the characters in this buffer.
+ *
+ * <p> The first character of the resulting string will be the character at
+ * this buffer's position, while the last character will be the character
+ * at index {@code limit()} - 1. Invoking this method does not
+ * change the buffer's position. </p>
+ *
+ * @return The specified string
+ */
+ public String toString() {
+ return toString(position(), limit());
+ }
+
+ abstract String toString(int start, int end); // package-private
+
+
+ // --- Methods to support CharSequence ---
+
+ /**
+ * Returns the length of this character buffer.
+ *
+ * <p> When viewed as a character sequence, the length of a character
+ * buffer is simply the number of characters between the position
+ * (inclusive) and the limit (exclusive); that is, it is equivalent to
+ * {@code remaining()}. </p>
+ *
+ * @return The length of this character buffer
+ */
+ public final int length() {
+ return remaining();
+ }
+
+ /**
+ * Reads the character at the given index relative to the current
+ * position.
+ *
+ * @param index
+ * The index of the character to be read, relative to the position;
+ * must be non-negative and smaller than {@code remaining()}
+ *
+ * @return The character at index
+ * <code>position() + index</code>
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on {@code index} do not hold
+ */
+ public final char charAt(int index) {
+ return get(position() + checkIndex(index, 1));
+ }
+
+ /**
+ * Creates a new character buffer that represents the specified subsequence
+ * of this buffer, relative to the current position.
+ *
+ * <p> The new buffer will share this buffer's content; that is, if the
+ * content of this buffer is mutable then modifications to one buffer will
+ * cause the other to be modified. The new buffer's capacity will be that
+ * of this buffer, its position will be
+ * {@code position()} + {@code start}, and its limit will be
+ * {@code position()} + {@code end}. The new buffer will be
+ * direct if, and only if, this buffer is direct, and it will be read-only
+ * if, and only if, this buffer is read-only. </p>
+ *
+ * @param start
+ * The index, relative to the current position, of the first
+ * character in the subsequence; must be non-negative and no larger
+ * than {@code remaining()}
+ *
+ * @param end
+ * The index, relative to the current position, of the character
+ * following the last character in the subsequence; must be no
+ * smaller than {@code start} and no larger than
+ * {@code remaining()}
+ *
+ * @return The new character buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on {@code start} and {@code end}
+ * do not hold
+ */
+ public abstract CharBuffer subSequence(int start, int end);
+
+
+ // --- Methods to support Appendable ---
+
+ /**
+ * Appends the specified character sequence to this
+ * buffer <i>(optional operation)</i>.
+ *
+ * <p> An invocation of this method of the form {@code dst.append(csq)}
+ * behaves in exactly the same way as the invocation
+ *
+ * <pre>
+ * dst.put(csq.toString()) </pre>
+ *
+ * <p> Depending on the specification of {@code toString} for the
+ * character sequence {@code csq}, the entire sequence may not be
+ * appended. For instance, invoking the {@link $Type$Buffer#toString()
+ * toString} method of a character buffer will return a subsequence whose
+ * content depends upon the buffer's position and limit.
+ *
+ * @param csq
+ * The character sequence to append. If {@code csq} is
+ * {@code null}, then the four characters {@code "null"} are
+ * appended to this character buffer.
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ *
+ * @since 1.5
+ */
+ public $Type$Buffer append(CharSequence csq) {
+ if (csq == null)
+ return put("null");
+ else
+ return put(csq.toString());
+ }
+
+ /**
+ * Appends a subsequence of the specified character sequence to this
+ * buffer <i>(optional operation)</i>.
+ *
+ * <p> An invocation of this method of the form {@code dst.append(csq, start,
+ * end)} when {@code csq} is not {@code null}, behaves in exactly the
+ * same way as the invocation
+ *
+ * <pre>
+ * dst.put(csq.subSequence(start, end).toString()) </pre>
+ *
+ * @param csq
+ * The character sequence from which a subsequence will be
+ * appended. If {@code csq} is {@code null}, then characters
+ * will be appended as if {@code csq} contained the four
+ * characters {@code "null"}.
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If {@code start} or {@code end} are negative, {@code start}
+ * is greater than {@code end}, or {@code end} is greater than
+ * {@code csq.length()}
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ *
+ * @since 1.5
+ */
+ public $Type$Buffer append(CharSequence csq, int start, int end) {
+ CharSequence cs = (csq == null ? "null" : csq);
+ return put(cs.subSequence(start, end).toString());
+ }
+
+ /**
+ * Appends the specified $type$ to this
+ * buffer <i>(optional operation)</i>.
+ *
+ * <p> An invocation of this method of the form {@code dst.append($x$)}
+ * behaves in exactly the same way as the invocation
+ *
+ * <pre>
+ * dst.put($x$) </pre>
+ *
+ * @param $x$
+ * The 16-bit $type$ to append
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ *
+ * @since 1.5
+ */
+ public $Type$Buffer append($type$ $x$) {
+ return put($x$);
+ }
+
+#end[char]
+
+
+ // -- Other byte stuff: Access to binary data --
+
+#if[!byte]
+
+ /**
+ * Retrieves this buffer's byte order.
+ *
+ * <p> The byte order of $a$ $type$ buffer created by allocation or by
+ * wrapping an existing {@code $type$} array is the {@link
+ * ByteOrder#nativeOrder native order} of the underlying
+ * hardware. The byte order of $a$ $type$ buffer created as a <a
+ * href="ByteBuffer.html#views">view</a> of a byte buffer is that of the
+ * byte buffer at the moment that the view is created. </p>
+ *
+ * @return This buffer's byte order
+ */
+ public abstract ByteOrder order();
+
+#end[!byte]
+
+#if[char]
+ // The order or null if the buffer does not cover a memory region,
+ // such as StringCharBuffer
+ abstract ByteOrder charRegionOrder();
+#end[char]
+
+#if[byte]
+
+ boolean bigEndian // package-private
+ = true;
+ boolean nativeByteOrder // package-private
+ = (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN);
+
+ /**
+ * Retrieves this buffer's byte order.
+ *
+ * <p> The byte order is used when reading or writing multibyte values, and
+ * when creating buffers that are views of this byte buffer. The order of
+ * a newly-created byte buffer is always {@link ByteOrder#BIG_ENDIAN
+ * BIG_ENDIAN}. </p>
+ *
+ * @return This buffer's byte order
+ */
+ public final ByteOrder order() {
+ return bigEndian ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN;
+ }
+
+ /**
+ * Modifies this buffer's byte order.
+ *
+ * @param bo
+ * The new byte order,
+ * either {@link ByteOrder#BIG_ENDIAN BIG_ENDIAN}
+ * or {@link ByteOrder#LITTLE_ENDIAN LITTLE_ENDIAN}
+ *
+ * @return This buffer
+ */
+ public final $Type$Buffer order(ByteOrder bo) {
+ bigEndian = (bo == ByteOrder.BIG_ENDIAN);
+ nativeByteOrder =
+ (bigEndian == (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN));
+ return this;
+ }
+
+ /**
+ * Returns the memory address, pointing to the byte at the given index,
+ * modulus the given unit size.
+ *
+ * <p> A return value greater than zero indicates the address of the byte at
+ * the index is misaligned for the unit size, and the value's quantity
+ * indicates how much the index should be rounded up or down to locate a
+ * byte at an aligned address. Otherwise, a value of {@code 0} indicates
+ * that the address of the byte at the index is aligned for the unit size.
+ *
+ * @apiNote
+ * This method may be utilized to determine if unit size bytes from an
+ * index can be accessed atomically, if supported by the native platform.
+ *
+ * @implNote
+ * This implementation throws {@code UnsupportedOperationException} for
+ * non-direct buffers when the given unit size is greater then {@code 8}.
+ *
+ * @param index
+ * The index to query for alignment offset, must be non-negative, no
+ * upper bounds check is performed
+ *
+ * @param unitSize
+ * The unit size in bytes, must be a power of {@code 2}
+ *
+ * @return The indexed byte's memory address modulus the unit size
+ *
+ * @throws IllegalArgumentException
+ * If the index is negative or the unit size is not a power of
+ * {@code 2}
+ *
+ * @throws UnsupportedOperationException
+ * If the native platform does not guarantee stable alignment offset
+ * values for the given unit size when managing the memory regions
+ * of buffers of the same kind as this buffer (direct or
+ * non-direct). For example, if garbage collection would result
+ * in the moving of a memory region covered by a non-direct buffer
+ * from one location to another and both locations have different
+ * alignment characteristics.
+ *
+ * @see #alignedSlice(int)
+ * @since 9
+ */
+ public final int alignmentOffset(int index, int unitSize) {
+ if (index < 0)
+ throw new IllegalArgumentException("Index less than zero: " + index);
+ if (unitSize < 1 || (unitSize & (unitSize - 1)) != 0)
+ throw new IllegalArgumentException("Unit size not a power of two: " + unitSize);
+ if (unitSize > 8 && !isDirect())
+ throw new UnsupportedOperationException("Unit size unsupported for non-direct buffers: " + unitSize);
+
+ return (int) ((address + index) % unitSize);
+ }
+
+ /**
+ * Creates a new byte buffer whose content is a shared and aligned
+ * subsequence of this buffer's content.
+ *
+ * <p> The content of the new buffer will start at this buffer's current
+ * position rounded up to the index of the nearest aligned byte for the
+ * given unit size, and end at this buffer's limit rounded down to the index
+ * of the nearest aligned byte for the given unit size.
+ * If rounding results in out-of-bound values then the new buffer's capacity
+ * and limit will be zero. If rounding is within bounds the following
+ * expressions will be true for a new buffer {@code nb} and unit size
+ * {@code unitSize}:
+ * <pre>{@code
+ * nb.alignmentOffset(0, unitSize) == 0
+ * nb.alignmentOffset(nb.limit(), unitSize) == 0
+ * }</pre>
+ *
+ * <p> Changes to this buffer's content will be visible in the new
+ * buffer, and vice versa; the two buffers' position, limit, and mark
+ * values will be independent.
+ *
+ * <p> The new buffer's position will be zero, its capacity and its limit
+ * will be the number of bytes remaining in this buffer or fewer subject to
+ * alignment, its mark will be undefined, and its byte order will be
+ * {@link ByteOrder#BIG_ENDIAN BIG_ENDIAN}.
+ *
+ * The new buffer will be direct if, and only if, this buffer is direct, and
+ * it will be read-only if, and only if, this buffer is read-only. </p>
+ *
+ * @apiNote
+ * This method may be utilized to create a new buffer where unit size bytes
+ * from index, that is a multiple of the unit size, may be accessed
+ * atomically, if supported by the native platform.
+ *
+ * @implNote
+ * This implementation throws {@code UnsupportedOperationException} for
+ * non-direct buffers when the given unit size is greater then {@code 8}.
+ *
+ * @param unitSize
+ * The unit size in bytes, must be a power of {@code 2}
+ *
+ * @return The new byte buffer
+ *
+ * @throws IllegalArgumentException
+ * If the unit size not a power of {@code 2}
+ *
+ * @throws UnsupportedOperationException
+ * If the native platform does not guarantee stable aligned slices
+ * for the given unit size when managing the memory regions
+ * of buffers of the same kind as this buffer (direct or
+ * non-direct). For example, if garbage collection would result
+ * in the moving of a memory region covered by a non-direct buffer
+ * from one location to another and both locations have different
+ * alignment characteristics.
+ *
+ * @see #alignmentOffset(int, int)
+ * @see #slice()
+ * @since 9
+ */
+ public final ByteBuffer alignedSlice(int unitSize) {
+ int pos = position();
+ int lim = limit();
+
+ int pos_mod = alignmentOffset(pos, unitSize);
+ int lim_mod = alignmentOffset(lim, unitSize);
+
+ // Round up the position to align with unit size
+ int aligned_pos = (pos_mod > 0)
+ ? pos + (unitSize - pos_mod)
+ : pos;
+
+ // Round down the limit to align with unit size
+ int aligned_lim = lim - lim_mod;
+
+ if (aligned_pos > lim || aligned_lim < pos) {
+ aligned_pos = aligned_lim = pos;
+ }
+
+ return slice(aligned_pos, aligned_lim);
+ }
+
+ abstract ByteBuffer slice(int pos, int lim);
+
+ // #BIN
+ //
+ // Binary-data access methods for short, char, int, long, float,
+ // and double will be inserted here
+
+#end[byte]
+
+#if[streamableType]
+
+#if[char]
+ @Override
+#end[char]
+ public $Streamtype$Stream $type$s() {
+ return StreamSupport.$streamtype$Stream(() -> new $Type$BufferSpliterator(this),
+ Buffer.SPLITERATOR_CHARACTERISTICS, false);
+ }
+
+#end[streamableType]
+
+}
\ No newline at end of file
diff --git a/ojluni/src/main/java/java/nio/channels/Selector.java b/ojluni/src/main/java/java/nio/channels/Selector.java
index 6ba1948..4fb98f3 100644
--- a/ojluni/src/main/java/java/nio/channels/Selector.java
+++ b/ojluni/src/main/java/java/nio/channels/Selector.java
@@ -80,8 +80,8 @@
* <p> A key is added to its selector's cancelled-key set when it is cancelled,
* whether by closing its channel or by invoking its {@link SelectionKey#cancel
* cancel} method. Cancelling a key will cause its channel to be deregistered
- * during the next selection operation, at which time the key will removed from
- * all of the selector's key sets.
+ * during the next selection operation, at which time the key will be removed
+ * from all of the selector's key sets.
*
* <a id="sks"></a><p> Keys are added to the selected-key set by selection
* operations. A key may be removed directly from the selected-key set by
diff --git a/ojluni/src/main/java/java/nio/file/LinkPermission.java b/ojluni/src/main/java/java/nio/file/LinkPermission.java
index a7c3cc8..c838549 100644
--- a/ojluni/src/main/java/java/nio/file/LinkPermission.java
+++ b/ojluni/src/main/java/java/nio/file/LinkPermission.java
@@ -104,7 +104,7 @@
public LinkPermission(String name, String actions) {
super(name);
checkName(name);
- if (actions != null && actions.length() > 0) {
+ if (actions != null && !actions.isEmpty()) {
throw new IllegalArgumentException("actions: " + actions);
}
}
diff --git a/ojluni/src/main/java/java/text/DateFormat.java b/ojluni/src/main/java/java/text/DateFormat.java
index 7564363..40214bc 100644
--- a/ojluni/src/main/java/java/text/DateFormat.java
+++ b/ojluni/src/main/java/java/text/DateFormat.java
@@ -49,7 +49,8 @@
import java.util.TimeZone;
import libcore.icu.ICU;
-// Android-removed: Remove javadoc related to "rg" and "ca" Locale extension.
+// Android-removed: Remove javadoc related to "tz", "rg" and "ca" Locale extension.
+// The "tz" extension isn't supported until the Calendar class is upgraded to version 11.
// The "ca" extension isn't supported, because Android's java.text supports Gregorian calendar only.
// The "rg" extension isn't supported until https://unicode-org.atlassian.net/browse/ICU-21831
// is resolved, because java.text.* stack relies on ICU on resource resolution.
@@ -97,11 +98,6 @@
* }</pre>
* </blockquote>
*
- * Starting from Android 13, <p>if the specified locale contains "tz" (timezone)
- * <a href="../util/Locale.html#def_locale_extension">Unicode
- * extensions</a>, the time zone for formatting
- * are overridden.
- *
* <p>You can use a DateFormat to parse also.
* <blockquote>
* <pre>{@code
diff --git a/ojluni/src/main/java/java/time/Clock.java b/ojluni/src/main/java/java/time/Clock.java
index b112784..37e723e 100644
--- a/ojluni/src/main/java/java/time/Clock.java
+++ b/ojluni/src/main/java/java/time/Clock.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -61,12 +61,15 @@
*/
package java.time;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import static java.time.LocalTime.NANOS_PER_MINUTE;
import static java.time.LocalTime.NANOS_PER_SECOND;
-
+import static java.time.LocalTime.NANOS_PER_MILLI;
import java.io.Serializable;
import java.util.Objects;
import java.util.TimeZone;
+import jdk.internal.misc.VM;
/**
* A clock providing access to the current instant, date and time using a time-zone.
@@ -124,10 +127,13 @@
* document whether or not they do support serialization.
*
* @implNote
- * The clock implementation provided here is based on {@link System#currentTimeMillis()}.
- * That method provides little to no guarantee about the accuracy of the clock.
- * Applications requiring a more accurate clock must implement this abstract class
- * themselves using a different external clock, such as an NTP server.
+ * The clock implementation provided here is based on the same underlying clock
+ * as {@link System#currentTimeMillis()}, but may have a precision finer than
+ * milliseconds if available.
+ * However, little to no guarantee is provided about the accuracy of the
+ * underlying clock. Applications requiring a more accurate clock must implement
+ * this abstract class themselves using a different external clock, such as an
+ * NTP server.
*
* @since 1.8
*/
@@ -152,7 +158,7 @@
* @return a clock that uses the best available system clock in the UTC zone, not null
*/
public static Clock systemUTC() {
- return new SystemClock(ZoneOffset.UTC);
+ return SystemClock.UTC;
}
/**
@@ -179,7 +185,7 @@
}
/**
- * Obtains a clock that returns the current instant using best available
+ * Obtains a clock that returns the current instant using the best available
* system clock.
* <p>
* This clock is based on the best available system clock.
@@ -195,13 +201,41 @@
*/
public static Clock system(ZoneId zone) {
Objects.requireNonNull(zone, "zone");
+ if (zone == ZoneOffset.UTC) {
+ return SystemClock.UTC;
+ }
return new SystemClock(zone);
}
//-------------------------------------------------------------------------
/**
+ * Obtains a clock that returns the current instant ticking in whole milliseconds
+ * using the best available system clock.
+ * <p>
+ * This clock will always have the nano-of-second field truncated to milliseconds.
+ * This ensures that the visible time ticks in whole milliseconds.
+ * The underlying clock is the best available system clock, equivalent to
+ * using {@link #system(ZoneId)}.
+ * <p>
+ * Implementations may use a caching strategy for performance reasons.
+ * As such, it is possible that the start of the millisecond observed via this
+ * clock will be later than that observed directly via the underlying clock.
+ * <p>
+ * The returned implementation is immutable, thread-safe and {@code Serializable}.
+ * It is equivalent to {@code tick(system(zone), Duration.ofMillis(1))}.
+ *
+ * @param zone the time-zone to use to convert the instant to date-time, not null
+ * @return a clock that ticks in whole milliseconds using the specified zone, not null
+ * @since 9
+ */
+ public static Clock tickMillis(ZoneId zone) {
+ return new TickClock(system(zone), NANOS_PER_MILLI);
+ }
+
+ //-------------------------------------------------------------------------
+ /**
* Obtains a clock that returns the current instant ticking in whole seconds
- * using best available system clock.
+ * using the best available system clock.
* <p>
* This clock will always have the nano-of-second field set to zero.
* This ensures that the visible time ticks in whole seconds.
@@ -224,7 +258,7 @@
/**
* Obtains a clock that returns the current instant ticking in whole minutes
- * using best available system clock.
+ * using the best available system clock.
* <p>
* This clock will always have the nano-of-second and second-of-minute fields set to zero.
* This ensures that the visible time ticks in whole minutes.
@@ -446,10 +480,24 @@
*/
static final class SystemClock extends Clock implements Serializable {
private static final long serialVersionUID = 6740630888130243051L;
+ private static final long OFFSET_SEED =
+ System.currentTimeMillis()/1000 - 1024; // initial offest
+ static final SystemClock UTC = new SystemClock(ZoneOffset.UTC);
+
private final ZoneId zone;
+ // We don't actually need a volatile here.
+ // We don't care if offset is set or read concurrently by multiple
+ // threads - we just need a value which is 'recent enough' - in other
+ // words something that has been updated at least once in the last
+ // 2^32 secs (~136 years). And even if we by chance see an invalid
+ // offset, the worst that can happen is that we will get a -1 value
+ // from getNanoTimeAdjustment, forcing us to update the offset
+ // once again.
+ private transient long offset;
SystemClock(ZoneId zone) {
this.zone = zone;
+ this.offset = OFFSET_SEED;
}
@Override
public ZoneId getZone() {
@@ -464,11 +512,50 @@
}
@Override
public long millis() {
+ // System.currentTimeMillis() and VM.getNanoTimeAdjustment(offset)
+ // use the same time source - System.currentTimeMillis() simply
+ // limits the resolution to milliseconds.
+ // So we take the faster path and call System.currentTimeMillis()
+ // directly - in order to avoid the performance penalty of
+ // VM.getNanoTimeAdjustment(offset) which is less efficient.
return System.currentTimeMillis();
}
@Override
public Instant instant() {
- return Instant.ofEpochMilli(millis());
+ // Take a local copy of offset. offset can be updated concurrently
+ // by other threads (even if we haven't made it volatile) so we will
+ // work with a local copy.
+ long localOffset = offset;
+ long adjustment = VM.getNanoTimeAdjustment(localOffset);
+
+ if (adjustment == -1) {
+ // -1 is a sentinel value returned by VM.getNanoTimeAdjustment
+ // when the offset it is given is too far off the current UTC
+ // time. In principle, this should not happen unless the
+ // JVM has run for more than ~136 years (not likely) or
+ // someone is fiddling with the system time, or the offset is
+ // by chance at 1ns in the future (very unlikely).
+ // We can easily recover from all these conditions by bringing
+ // back the offset in range and retry.
+
+ // bring back the offset in range. We use -1024 to make
+ // it more unlikely to hit the 1ns in the future condition.
+ localOffset = System.currentTimeMillis()/1000 - 1024;
+
+ // retry
+ adjustment = VM.getNanoTimeAdjustment(localOffset);
+
+ if (adjustment == -1) {
+ // Should not happen: we just recomputed a new offset.
+ // It should have fixed the issue.
+ throw new InternalError("Offset " + localOffset + " is not in range");
+ } else {
+ // OK - recovery succeeded. Update the offset for the
+ // next call...
+ offset = localOffset;
+ }
+ }
+ return Instant.ofEpochSecond(localOffset, adjustment);
}
@Override
public boolean equals(Object obj) {
@@ -485,6 +572,12 @@
public String toString() {
return "SystemClock[" + zone + "]";
}
+ private void readObject(ObjectInputStream is)
+ throws IOException, ClassNotFoundException {
+ // ensure that offset is initialized
+ is.defaultReadObject();
+ offset = OFFSET_SEED;
+ }
}
//-----------------------------------------------------------------------
@@ -493,7 +586,7 @@
* This is typically used for testing.
*/
static final class FixedClock extends Clock implements Serializable {
- private static final long serialVersionUID = 7430389292664866958L;
+ private static final long serialVersionUID = 7430389292664866958L;
private final Instant instant;
private final ZoneId zone;
@@ -543,7 +636,7 @@
* Implementation of a clock that adds an offset to an underlying clock.
*/
static final class OffsetClock extends Clock implements Serializable {
- private static final long serialVersionUID = 2007484719125426256L;
+ private static final long serialVersionUID = 2007484719125426256L;
private final Clock baseClock;
private final Duration offset;
diff --git a/ojluni/src/main/java/java/time/DayOfWeek.java b/ojluni/src/main/java/java/time/DayOfWeek.java
index ee49f8a..43dc3aa 100644
--- a/ojluni/src/main/java/java/time/DayOfWeek.java
+++ b/ojluni/src/main/java/java/time/DayOfWeek.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
diff --git a/ojluni/src/main/java/java/time/Instant.java b/ojluni/src/main/java/java/time/Instant.java
index c87ac18..e507b35 100644
--- a/ojluni/src/main/java/java/time/Instant.java
+++ b/ojluni/src/main/java/java/time/Instant.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -305,7 +305,7 @@
* This method allows an arbitrary number of nanoseconds to be passed in.
* The factory will alter the values of the second and nanosecond in order
* to ensure that the stored nanosecond is in the range 0 to 999,999,999.
- * For example, the following will result in the exactly the same instant:
+ * For example, the following will result in exactly the same instant:
* <pre>
* Instant.ofEpochSecond(3, 1);
* Instant.ofEpochSecond(4, -999_999_999);
@@ -336,7 +336,7 @@
*/
public static Instant ofEpochMilli(long epochMilli) {
long secs = Math.floorDiv(epochMilli, 1000);
- int mos = (int)Math.floorMod(epochMilli, 1000);
+ int mos = Math.floorMod(epochMilli, 1000);
return create(secs, mos * 1000_000);
}
@@ -555,7 +555,6 @@
case NANO_OF_SECOND: return nanos;
case MICRO_OF_SECOND: return nanos / 1000;
case MILLI_OF_SECOND: return nanos / 1000_000;
- case INSTANT_SECONDS: INSTANT_SECONDS.checkValidIntValue(seconds);
}
throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
}
@@ -605,7 +604,7 @@
* <p>
* The epoch second count is a simple incrementing count of seconds where
* second 0 is 1970-01-01T00:00:00Z.
- * The nanosecond part of the day is returned by {@code getNanosOfSecond}.
+ * The nanosecond part is returned by {@link #getNano}.
*
* @return the seconds from the epoch of 1970-01-01T00:00:00Z
*/
@@ -618,7 +617,7 @@
* of the second.
* <p>
* The nanosecond-of-second value measures the total number of nanoseconds from
- * the second returned by {@code getEpochSecond}.
+ * the second returned by {@link #getEpochSecond}.
*
* @return the nanoseconds within the second, always positive, never exceeds 999,999,999
*/
@@ -752,7 +751,7 @@
throw new UnsupportedTemporalTypeException("Unit must divide into a standard day without remainder");
}
long nod = (seconds % LocalTime.SECONDS_PER_DAY) * LocalTime.NANOS_PER_SECOND + nanos;
- long result = (nod / dur) * dur;
+ long result = Math.floorDiv(nod, dur) * dur;
return plusNanos(result - nod);
}
@@ -793,33 +792,33 @@
* The supported fields behave as follows:
* <ul>
* <li>{@code NANOS} -
- * Returns a {@code Instant} with the specified number of nanoseconds added.
+ * Returns an {@code Instant} with the specified number of nanoseconds added.
* This is equivalent to {@link #plusNanos(long)}.
* <li>{@code MICROS} -
- * Returns a {@code Instant} with the specified number of microseconds added.
+ * Returns an {@code Instant} with the specified number of microseconds added.
* This is equivalent to {@link #plusNanos(long)} with the amount
* multiplied by 1,000.
* <li>{@code MILLIS} -
- * Returns a {@code Instant} with the specified number of milliseconds added.
+ * Returns an {@code Instant} with the specified number of milliseconds added.
* This is equivalent to {@link #plusNanos(long)} with the amount
* multiplied by 1,000,000.
* <li>{@code SECONDS} -
- * Returns a {@code Instant} with the specified number of seconds added.
+ * Returns an {@code Instant} with the specified number of seconds added.
* This is equivalent to {@link #plusSeconds(long)}.
* <li>{@code MINUTES} -
- * Returns a {@code Instant} with the specified number of minutes added.
+ * Returns an {@code Instant} with the specified number of minutes added.
* This is equivalent to {@link #plusSeconds(long)} with the amount
* multiplied by 60.
* <li>{@code HOURS} -
- * Returns a {@code Instant} with the specified number of hours added.
+ * Returns an {@code Instant} with the specified number of hours added.
* This is equivalent to {@link #plusSeconds(long)} with the amount
* multiplied by 3,600.
* <li>{@code HALF_DAYS} -
- * Returns a {@code Instant} with the specified number of half-days added.
+ * Returns an {@code Instant} with the specified number of half-days added.
* This is equivalent to {@link #plusSeconds(long)} with the amount
* multiplied by 43,200 (12 hours).
* <li>{@code DAYS} -
- * Returns a {@code Instant} with the specified number of days added.
+ * Returns an {@code Instant} with the specified number of days added.
* This is equivalent to {@link #plusSeconds(long)} with the amount
* multiplied by 86,400 (24 hours).
* </ul>
@@ -952,7 +951,7 @@
/**
* Returns a copy of this instant with the specified amount subtracted.
* <p>
- * This returns a {@code Instant}, based on this one, with the amount
+ * This returns an {@code Instant}, based on this one, with the amount
* in terms of the unit subtracted. If it is not possible to subtract the amount,
* because the unit is not supported or for some other reason, an exception is thrown.
* <p>
@@ -1100,7 +1099,7 @@
* complete units between the two instants.
* The {@code Temporal} passed to this method is converted to a
* {@code Instant} using {@link #from(TemporalAccessor)}.
- * For example, the amount in days between two dates can be calculated
+ * For example, the amount in seconds between two dates can be calculated
* using {@code startInstant.until(endInstant, SECONDS)}.
* <p>
* There are two equivalent ways of using this method.
diff --git a/ojluni/src/main/java/java/time/LocalDate.java b/ojluni/src/main/java/java/time/LocalDate.java
index c23b270..17325d5 100644
--- a/ojluni/src/main/java/java/time/LocalDate.java
+++ b/ojluni/src/main/java/java/time/LocalDate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -74,6 +74,7 @@
import static java.time.temporal.ChronoField.PROLEPTIC_MONTH;
import static java.time.temporal.ChronoField.YEAR;
+import dalvik.annotation.codegen.CovariantReturnType;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
@@ -82,6 +83,7 @@
import java.io.Serializable;
import java.time.chrono.ChronoLocalDate;
import java.time.chrono.Era;
+import java.time.chrono.IsoEra;
import java.time.chrono.IsoChronology;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
@@ -100,6 +102,8 @@
import java.time.zone.ZoneOffsetTransition;
import java.time.zone.ZoneRules;
import java.util.Objects;
+import java.util.stream.LongStream;
+import java.util.stream.Stream;
// Android-changed: removed ValueBased paragraph.
/**
@@ -141,6 +145,10 @@
* This could be used by an application as a "far future" date.
*/
public static final LocalDate MAX = LocalDate.of(Year.MAX_VALUE, 12, 31);
+ /**
+ * The epoch year {@code LocalDate}, '1970-01-01'.
+ */
+ public static final LocalDate EPOCH = LocalDate.of(1970, 1, 1);
/**
* Serialization version.
@@ -214,12 +222,8 @@
*/
public static LocalDate now(Clock clock) {
Objects.requireNonNull(clock, "clock");
- // inline to avoid creating object and Instant checks
final Instant now = clock.instant(); // called once
- ZoneOffset offset = clock.getZone().getRules().getOffset(now);
- long epochSec = now.getEpochSecond() + offset.getTotalSeconds(); // overflow caught later
- long epochDay = Math.floorDiv(epochSec, SECONDS_PER_DAY);
- return LocalDate.ofEpochDay(epochDay);
+ return ofInstant(now, clock.getZone());
}
//-----------------------------------------------------------------------
@@ -294,6 +298,31 @@
//-----------------------------------------------------------------------
/**
+ * Obtains an instance of {@code LocalDate} from an {@code Instant} and zone ID.
+ * <p>
+ * This creates a local date based on the specified instant.
+ * First, the offset from UTC/Greenwich is obtained using the zone ID and instant,
+ * which is simple as there is only one valid offset for each instant.
+ * Then, the instant and offset are used to calculate the local date.
+ *
+ * @param instant the instant to create the date from, not null
+ * @param zone the time-zone, which may be an offset, not null
+ * @return the local date, not null
+ * @throws DateTimeException if the result exceeds the supported range
+ * @since 9
+ */
+ public static LocalDate ofInstant(Instant instant, ZoneId zone) {
+ Objects.requireNonNull(instant, "instant");
+ Objects.requireNonNull(zone, "zone");
+ ZoneRules rules = zone.getRules();
+ ZoneOffset offset = rules.getOffset(instant);
+ long localSecond = instant.getEpochSecond() + offset.getTotalSeconds();
+ long localEpochDay = Math.floorDiv(localSecond, SECONDS_PER_DAY);
+ return ofEpochDay(localEpochDay);
+ }
+
+ //-----------------------------------------------------------------------
+ /**
* Obtains an instance of {@code LocalDate} from the epoch day count.
* <p>
* This returns a {@code LocalDate} with the specified epoch-day.
@@ -305,6 +334,7 @@
* @throws DateTimeException if the epoch day exceeds the supported date range
*/
public static LocalDate ofEpochDay(long epochDay) {
+ EPOCH_DAY.checkValidValue(epochDay);
long zeroDay = epochDay + DAYS_0000_TO_1970;
// find the march-based year
zeroDay -= 60; // adjust to 0000-03-01 so leap day is at end of four year cycle
@@ -594,7 +624,7 @@
* If the field is a {@link ChronoField} then the query is implemented here.
* The {@link #isSupported(TemporalField) supported fields} will return valid
* values based on this date, except {@code EPOCH_DAY} and {@code PROLEPTIC_MONTH}
- * which are too large to fit in an {@code int} and throw a {@code DateTimeException}.
+ * which are too large to fit in an {@code int} and throw an {@code UnsupportedTemporalTypeException}.
* All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
* <p>
* If the field is not a {@code ChronoField}, then the result of this method
@@ -706,15 +736,14 @@
* Users of this class should typically ignore this method as it exists primarily
* to fulfill the {@link ChronoLocalDate} contract where it is necessary to support
* the Japanese calendar system.
- * <p>
- * The returned era will be a singleton capable of being compared with the constants
- * in {@link IsoChronology} using the {@code ==} operator.
*
- * @return the {@code IsoChronology} era constant applicable at this date, not null
+ * @return the IsoEra applicable at this date, not null
*/
@Override // override for Javadoc
+ // Android-changed: To match OpenJDK 11 API, this API returns IsoEra type after Android T.
+ @CovariantReturnType(returnType = java.time.chrono.IsoEra.class, presentAfter = 33)
public Era getEra() {
- return ChronoLocalDate.super.getEra();
+ return (getYear() >= 1 ? IsoEra.CE : IsoEra.BCE);
}
/**
@@ -796,7 +825,7 @@
* @return the day-of-week, not null
*/
public DayOfWeek getDayOfWeek() {
- int dow0 = (int)Math.floorMod(toEpochDay() + 3, 7);
+ int dow0 = Math.floorMod(toEpochDay() + 3, 7);
return DayOfWeek.of(dow0 + 1);
}
@@ -1299,7 +1328,7 @@
long monthCount = year * 12L + (month - 1);
long calcMonths = monthCount + monthsToAdd; // safe overflow
int newYear = YEAR.checkValidIntValue(Math.floorDiv(calcMonths, 12));
- int newMonth = (int)Math.floorMod(calcMonths, 12) + 1;
+ int newMonth = Math.floorMod(calcMonths, 12) + 1;
return resolvePreviousValid(newYear, newMonth, day);
}
@@ -1341,6 +1370,23 @@
if (daysToAdd == 0) {
return this;
}
+ long dom = day + daysToAdd;
+ if (dom > 0) {
+ if (dom <= 28) {
+ return new LocalDate(year, month, (int) dom);
+ } else if (dom <= 59) { // 59th Jan is 28th Feb, 59th Feb is 31st Mar
+ long monthLen = lengthOfMonth();
+ if (dom <= monthLen) {
+ return new LocalDate(year, month, (int) dom);
+ } else if (month < 12) {
+ return new LocalDate(year, month + 1, (int) (dom - monthLen));
+ } else {
+ YEAR.checkValidValue(year + 1);
+ return new LocalDate(year + 1, 1, (int) (dom - monthLen));
+ }
+ }
+ }
+
long mjDay = Math.addExact(toEpochDay(), daysToAdd);
return LocalDate.ofEpochDay(mjDay);
}
@@ -1671,6 +1717,89 @@
}
/**
+ * Returns a sequential ordered stream of dates. The returned stream starts from this date
+ * (inclusive) and goes to {@code endExclusive} (exclusive) by an incremental step of 1 day.
+ * <p>
+ * This method is equivalent to {@code datesUntil(endExclusive, Period.ofDays(1))}.
+ *
+ * @param endExclusive the end date, exclusive, not null
+ * @return a sequential {@code Stream} for the range of {@code LocalDate} values
+ * @throws IllegalArgumentException if end date is before this date
+ * @since 9
+ */
+ public Stream<LocalDate> datesUntil(LocalDate endExclusive) {
+ long end = endExclusive.toEpochDay();
+ long start = toEpochDay();
+ if (end < start) {
+ throw new IllegalArgumentException(endExclusive + " < " + this);
+ }
+ return LongStream.range(start, end).mapToObj(LocalDate::ofEpochDay);
+ }
+
+ /**
+ * Returns a sequential ordered stream of dates by given incremental step. The returned stream
+ * starts from this date (inclusive) and goes to {@code endExclusive} (exclusive).
+ * <p>
+ * The n-th date which appears in the stream is equal to {@code this.plus(step.multipliedBy(n))}
+ * (but the result of step multiplication never overflows). For example, if this date is
+ * {@code 2015-01-31}, the end date is {@code 2015-05-01} and the step is 1 month, then the
+ * stream contains {@code 2015-01-31}, {@code 2015-02-28}, {@code 2015-03-31}, and
+ * {@code 2015-04-30}.
+ *
+ * @param endExclusive the end date, exclusive, not null
+ * @param step the non-zero, non-negative {@code Period} which represents the step.
+ * @return a sequential {@code Stream} for the range of {@code LocalDate} values
+ * @throws IllegalArgumentException if step is zero, or {@code step.getDays()} and
+ * {@code step.toTotalMonths()} have opposite sign, or end date is before this date
+ * and step is positive, or end date is after this date and step is negative
+ * @since 9
+ */
+ public Stream<LocalDate> datesUntil(LocalDate endExclusive, Period step) {
+ if (step.isZero()) {
+ throw new IllegalArgumentException("step is zero");
+ }
+ long end = endExclusive.toEpochDay();
+ long start = toEpochDay();
+ long until = end - start;
+ long months = step.toTotalMonths();
+ long days = step.getDays();
+ if ((months < 0 && days > 0) || (months > 0 && days < 0)) {
+ throw new IllegalArgumentException("period months and days are of opposite sign");
+ }
+ if (until == 0) {
+ return Stream.empty();
+ }
+ int sign = months > 0 || days > 0 ? 1 : -1;
+ if (sign < 0 ^ until < 0) {
+ throw new IllegalArgumentException(endExclusive + (sign < 0 ? " > " : " < ") + this);
+ }
+ if (months == 0) {
+ long steps = (until - sign) / days; // non-negative
+ return LongStream.rangeClosed(0, steps).mapToObj(
+ n -> LocalDate.ofEpochDay(start + n * days));
+ }
+ // 48699/1600 = 365.2425/12, no overflow, non-negative result
+ long steps = until * 1600 / (months * 48699 + days * 1600) + 1;
+ long addMonths = months * steps;
+ long addDays = days * steps;
+ long maxAddMonths = months > 0 ? MAX.getProlepticMonth() - getProlepticMonth()
+ : getProlepticMonth() - MIN.getProlepticMonth();
+ // adjust steps estimation
+ if (addMonths * sign > maxAddMonths
+ || (plusMonths(addMonths).toEpochDay() + addDays) * sign >= end * sign) {
+ steps--;
+ addMonths -= months;
+ addDays -= days;
+ if (addMonths * sign > maxAddMonths
+ || (plusMonths(addMonths).toEpochDay() + addDays) * sign >= end * sign) {
+ steps--;
+ }
+ }
+ return LongStream.rangeClosed(0, steps).mapToObj(
+ n -> this.plusMonths(months * n).plusDays(days * n));
+ }
+
+ /**
* Formats this date using the specified formatter.
* <p>
* This date will be passed to the formatter to produce a string.
@@ -1840,6 +1969,29 @@
return total - DAYS_0000_TO_1970;
}
+ /**
+ * Converts this {@code LocalDate} to the number of seconds since the epoch
+ * of 1970-01-01T00:00:00Z.
+ * <p>
+ * This combines this local date with the specified time and
+ * offset to calculate the epoch-second value, which is the
+ * number of elapsed seconds from 1970-01-01T00:00:00Z.
+ * Instants on the time-line after the epoch are positive, earlier
+ * are negative.
+ *
+ * @param time the local time, not null
+ * @param offset the zone offset, not null
+ * @return the number of seconds since the epoch of 1970-01-01T00:00:00Z, may be negative
+ * @since 9
+ */
+ public long toEpochSecond(LocalTime time, ZoneOffset offset) {
+ Objects.requireNonNull(time, "time");
+ Objects.requireNonNull(offset, "offset");
+ long secs = toEpochDay() * SECONDS_PER_DAY + time.toSecondOfDay();
+ secs -= offset.getTotalSeconds();
+ return secs;
+ }
+
//-----------------------------------------------------------------------
/**
* Compares this date to another date.
diff --git a/ojluni/src/main/java/java/time/LocalDateTime.java b/ojluni/src/main/java/java/time/LocalDateTime.java
index 5821ffd..ee0b7d8 100644
--- a/ojluni/src/main/java/java/time/LocalDateTime.java
+++ b/ojluni/src/main/java/java/time/LocalDateTime.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -412,7 +412,7 @@
NANO_OF_SECOND.checkValidValue(nanoOfSecond);
long localSecond = epochSecond + offset.getTotalSeconds(); // overflow caught later
long localEpochDay = Math.floorDiv(localSecond, SECONDS_PER_DAY);
- int secsOfDay = (int)Math.floorMod(localSecond, SECONDS_PER_DAY);
+ int secsOfDay = Math.floorMod(localSecond, SECONDS_PER_DAY);
LocalDate date = LocalDate.ofEpochDay(localEpochDay);
LocalTime time = LocalTime.ofNanoOfDay(secsOfDay * NANOS_PER_SECOND + nanoOfSecond);
return new LocalDateTime(date, time);
@@ -659,7 +659,7 @@
* The {@link #isSupported(TemporalField) supported fields} will return valid
* values based on this date-time, except {@code NANO_OF_DAY}, {@code MICRO_OF_DAY},
* {@code EPOCH_DAY} and {@code PROLEPTIC_MONTH} which are too large to fit in
- * an {@code int} and throw a {@code DateTimeException}.
+ * an {@code int} and throw an {@code UnsupportedTemporalTypeException}.
* All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
* <p>
* If the field is not a {@code ChronoField}, then the result of this method
@@ -1401,8 +1401,8 @@
* </ol>
* <p>
* For example, 2008-02-29 (leap year) minus one year would result in the
- * invalid date 2009-02-29 (standard year). Instead of returning an invalid
- * result, the last valid day of the month, 2009-02-28, is selected instead.
+ * invalid date 2007-02-29 (standard year). Instead of returning an invalid
+ * result, the last valid day of the month, 2007-02-28, is selected instead.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1425,8 +1425,8 @@
* </ol>
* <p>
* For example, 2007-03-31 minus one month would result in the invalid date
- * 2007-04-31. Instead of returning an invalid result, the last valid day
- * of the month, 2007-04-30, is selected instead.
+ * 2007-02-31. Instead of returning an invalid result, the last valid day
+ * of the month, 2007-02-28, is selected instead.
* <p>
* This instance is immutable and unaffected by this method call.
*
diff --git a/ojluni/src/main/java/java/time/MonthDay.java b/ojluni/src/main/java/java/time/MonthDay.java
index 50bc2c8..e1a8d4d 100644
--- a/ojluni/src/main/java/java/time/MonthDay.java
+++ b/ojluni/src/main/java/java/time/MonthDay.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
diff --git a/ojluni/src/main/java/java/time/OffsetDateTime.java b/ojluni/src/main/java/java/time/OffsetDateTime.java
index c2c8e0a..f9b6205 100644
--- a/ojluni/src/main/java/java/time/OffsetDateTime.java
+++ b/ojluni/src/main/java/java/time/OffsetDateTime.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -101,7 +101,7 @@
* {@code OffsetDateTime} is an immutable representation of a date-time with an offset.
* This class stores all date and time fields, to a precision of nanoseconds,
* as well as the offset from UTC/Greenwich. For example, the value
- * "2nd October 2007 at 13:45.30.123456789 +02:00" can be stored in an {@code OffsetDateTime}.
+ * "2nd October 2007 at 13:45:30.123456789 +02:00" can be stored in an {@code OffsetDateTime}.
* <p>
* {@code OffsetDateTime}, {@link java.time.ZonedDateTime} and {@link java.time.Instant} all store an instant
* on the time-line to nanosecond precision.
@@ -570,7 +570,7 @@
* The {@link #isSupported(TemporalField) supported fields} will return valid
* values based on this date-time, except {@code NANO_OF_DAY}, {@code MICRO_OF_DAY},
* {@code EPOCH_DAY}, {@code PROLEPTIC_MONTH} and {@code INSTANT_SECONDS} which are too
- * large to fit in an {@code int} and throw a {@code DateTimeException}.
+ * large to fit in an {@code int} and throw an {@code UnsupportedTemporalTypeException}.
* All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
* <p>
* If the field is not a {@code ChronoField}, then the result of this method
@@ -1387,8 +1387,8 @@
* </ol>
* <p>
* For example, 2008-02-29 (leap year) minus one year would result in the
- * invalid date 2009-02-29 (standard year). Instead of returning an invalid
- * result, the last valid day of the month, 2009-02-28, is selected instead.
+ * invalid date 2007-02-29 (standard year). Instead of returning an invalid
+ * result, the last valid day of the month, 2007-02-28, is selected instead.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1411,8 +1411,8 @@
* </ol>
* <p>
* For example, 2007-03-31 minus one month would result in the invalid date
- * 2007-04-31. Instead of returning an invalid result, the last valid day
- * of the month, 2007-04-30, is selected instead.
+ * 2007-02-31. Instead of returning an invalid result, the last valid day
+ * of the month, 2007-02-28, is selected instead.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1431,7 +1431,7 @@
* the month and year fields as necessary to ensure the result remains valid.
* The result is only invalid if the maximum/minimum year is exceeded.
* <p>
- * For example, 2008-12-31 minus one week would result in 2009-01-07.
+ * For example, 2009-01-07 minus one week would result in 2008-12-31.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1450,7 +1450,7 @@
* month and year fields as necessary to ensure the result remains valid.
* The result is only invalid if the maximum/minimum year is exceeded.
* <p>
- * For example, 2008-12-31 minus one day would result in 2009-01-01.
+ * For example, 2009-01-01 minus one day would result in 2008-12-31.
* <p>
* This instance is immutable and unaffected by this method call.
*
diff --git a/ojluni/src/main/java/java/time/OffsetTime.java b/ojluni/src/main/java/java/time/OffsetTime.java
index c54b926..5fc9942 100644
--- a/ojluni/src/main/java/java/time/OffsetTime.java
+++ b/ojluni/src/main/java/java/time/OffsetTime.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -101,7 +101,7 @@
* viewed as hour-minute-second-offset.
* This class stores all time fields, to a precision of nanoseconds,
* as well as a zone offset.
- * For example, the value "13:45.30.123456789+02:00" can be stored
+ * For example, the value "13:45:30.123456789+02:00" can be stored
* in an {@code OffsetTime}.
*
* @implSpec
@@ -252,7 +252,7 @@
ZoneRules rules = zone.getRules();
ZoneOffset offset = rules.getOffset(instant);
long localSecond = instant.getEpochSecond() + offset.getTotalSeconds(); // overflow caught later
- int secsOfDay = (int) Math.floorMod(localSecond, SECONDS_PER_DAY);
+ int secsOfDay = Math.floorMod(localSecond, SECONDS_PER_DAY);
LocalTime time = LocalTime.ofNanoOfDay(secsOfDay * NANOS_PER_SECOND + instant.getNano());
return new OffsetTime(time, offset);
}
@@ -475,7 +475,7 @@
* If the field is a {@link ChronoField} then the query is implemented here.
* The {@link #isSupported(TemporalField) supported fields} will return valid
* values based on this time, except {@code NANO_OF_DAY} and {@code MICRO_OF_DAY}
- * which are too large to fit in an {@code int} and throw a {@code DateTimeException}.
+ * which are too large to fit in an {@code int} and throw an {@code UnsupportedTemporalTypeException}.
* All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
* <p>
* If the field is not a {@code ChronoField}, then the result of this method
@@ -1226,6 +1226,28 @@
return nod - offsetNanos;
}
+ /**
+ * Converts this {@code OffsetTime} to the number of seconds since the epoch
+ * of 1970-01-01T00:00:00Z.
+ * <p>
+ * This combines this offset time with the specified date to calculate the
+ * epoch-second value, which is the number of elapsed seconds from
+ * 1970-01-01T00:00:00Z.
+ * Instants on the time-line after the epoch are positive, earlier
+ * are negative.
+ *
+ * @param date the localdate, not null
+ * @return the number of seconds since the epoch of 1970-01-01T00:00:00Z, may be negative
+ * @since 9
+ */
+ public long toEpochSecond(LocalDate date) {
+ Objects.requireNonNull(date, "date");
+ long epochDay = date.toEpochDay();
+ long secs = epochDay * 86400 + time.toSecondOfDay();
+ secs -= offset.getTotalSeconds();
+ return secs;
+ }
+
//-----------------------------------------------------------------------
/**
* Compares this {@code OffsetTime} to another time.
@@ -1252,7 +1274,6 @@
*
* @param other the other time to compare to, not null
* @return the comparator value, negative if less, positive if greater
- * @throws NullPointerException if {@code other} is null
*/
@Override
public int compareTo(OffsetTime other) {
diff --git a/ojluni/src/main/java/java/time/Period.java b/ojluni/src/main/java/java/time/Period.java
index f264994..aaffdd6 100644
--- a/ojluni/src/main/java/java/time/Period.java
+++ b/ojluni/src/main/java/java/time/Period.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -83,8 +83,6 @@
import java.time.temporal.TemporalQueries;
import java.time.temporal.TemporalUnit;
import java.time.temporal.UnsupportedTemporalTypeException;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.regex.Matcher;
@@ -146,8 +144,7 @@
/**
* The set of supported units.
*/
- private static final List<TemporalUnit> SUPPORTED_UNITS =
- Collections.unmodifiableList(Arrays.<TemporalUnit>asList(YEARS, MONTHS, DAYS));
+ private static final List<TemporalUnit> SUPPORTED_UNITS = List.of(YEARS, MONTHS, DAYS);
/**
* The number of years.
@@ -323,17 +320,17 @@
Objects.requireNonNull(text, "text");
Matcher matcher = PATTERN.matcher(text);
if (matcher.matches()) {
- int negate = ("-".equals(matcher.group(1)) ? -1 : 1);
- String yearMatch = matcher.group(2);
- String monthMatch = matcher.group(3);
- String weekMatch = matcher.group(4);
- String dayMatch = matcher.group(5);
- if (yearMatch != null || monthMatch != null || dayMatch != null || weekMatch != null) {
+ int negate = (charMatch(text, matcher.start(1), matcher.end(1), '-') ? -1 : 1);
+ int yearStart = matcher.start(2), yearEnd = matcher.end(2);
+ int monthStart = matcher.start(3), monthEnd = matcher.end(3);
+ int weekStart = matcher.start(4), weekEnd = matcher.end(4);
+ int dayStart = matcher.start(5), dayEnd = matcher.end(5);
+ if (yearStart >= 0 || monthStart >= 0 || weekStart >= 0 || dayStart >= 0) {
try {
- int years = parseNumber(text, yearMatch, negate);
- int months = parseNumber(text, monthMatch, negate);
- int weeks = parseNumber(text, weekMatch, negate);
- int days = parseNumber(text, dayMatch, negate);
+ int years = parseNumber(text, yearStart, yearEnd, negate);
+ int months = parseNumber(text, monthStart, monthEnd, negate);
+ int weeks = parseNumber(text, weekStart, weekEnd, negate);
+ int days = parseNumber(text, dayStart, dayEnd, negate);
days = Math.addExact(days, Math.multiplyExact(weeks, 7));
return create(years, months, days);
} catch (NumberFormatException ex) {
@@ -344,11 +341,15 @@
throw new DateTimeParseException("Text cannot be parsed to a Period", text, 0);
}
- private static int parseNumber(CharSequence text, String str, int negate) {
- if (str == null) {
+ private static boolean charMatch(CharSequence text, int start, int end, char c) {
+ return (start >= 0 && end == start + 1 && text.charAt(start) == c);
+ }
+
+ private static int parseNumber(CharSequence text, int start, int end, int negate) {
+ if (start < 0 || end < 0) {
return 0;
}
- int val = Integer.parseInt(str);
+ int val = Integer.parseInt(text, start, end, 10);
try {
return Math.multiplyExact(val, negate);
} catch (ArithmeticException ex) {
@@ -811,7 +812,7 @@
* Returns a copy of this period with the years and months normalized.
* <p>
* This normalizes the years and months units, leaving the days unit unchanged.
- * The months unit is adjusted to have an absolute value less than 11,
+ * The months unit is adjusted to have an absolute value less than 12,
* with the years unit being adjusted to compensate. For example, a period of
* "1 Year and 15 months" will be normalized to "2 years and 3 months".
* <p>
diff --git a/ojluni/src/main/java/java/time/Year.java b/ojluni/src/main/java/java/time/Year.java
index a1d5679..b477e7d 100644
--- a/ojluni/src/main/java/java/time/Year.java
+++ b/ojluni/src/main/java/java/time/Year.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
diff --git a/ojluni/src/main/java/java/time/YearMonth.java b/ojluni/src/main/java/java/time/YearMonth.java
index 582a9d8..30b7a58 100644
--- a/ojluni/src/main/java/java/time/YearMonth.java
+++ b/ojluni/src/main/java/java/time/YearMonth.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -844,7 +844,7 @@
long monthCount = year * 12L + (month - 1);
long calcMonths = monthCount + monthsToAdd; // safe overflow
int newYear = YEAR.checkValidIntValue(Math.floorDiv(calcMonths, 12));
- int newMonth = (int)Math.floorMod(calcMonths, 12) + 1;
+ int newMonth = Math.floorMod(calcMonths, 12) + 1;
return with(newYear, newMonth);
}
diff --git a/ojluni/src/main/java/java/time/ZoneId.java b/ojluni/src/main/java/java/time/ZoneId.java
index 11e34e0..17bd039 100644
--- a/ojluni/src/main/java/java/time/ZoneId.java
+++ b/ojluni/src/main/java/java/time/ZoneId.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -76,14 +76,15 @@
import java.time.zone.ZoneRules;
import java.time.zone.ZoneRulesException;
import java.time.zone.ZoneRulesProvider;
-import java.util.Collections;
-import java.util.HashMap;
+import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TimeZone;
+import static java.util.Map.entry;
+
// Android-changed: removed ValueBased paragraph.
// Android-changed: removed {@link ZoneRulesProvider}.
/**
@@ -215,39 +216,36 @@
* </ul>
* The map is unmodifiable.
*/
- public static final Map<String, String> SHORT_IDS;
- static {
- Map<String, String> map = new HashMap<>(64);
- map.put("ACT", "Australia/Darwin");
- map.put("AET", "Australia/Sydney");
- map.put("AGT", "America/Argentina/Buenos_Aires");
- map.put("ART", "Africa/Cairo");
- map.put("AST", "America/Anchorage");
- map.put("BET", "America/Sao_Paulo");
- map.put("BST", "Asia/Dhaka");
- map.put("CAT", "Africa/Harare");
- map.put("CNT", "America/St_Johns");
- map.put("CST", "America/Chicago");
- map.put("CTT", "Asia/Shanghai");
- map.put("EAT", "Africa/Addis_Ababa");
- map.put("ECT", "Europe/Paris");
- map.put("IET", "America/Indiana/Indianapolis");
- map.put("IST", "Asia/Kolkata");
- map.put("JST", "Asia/Tokyo");
- map.put("MIT", "Pacific/Apia");
- map.put("NET", "Asia/Yerevan");
- map.put("NST", "Pacific/Auckland");
- map.put("PLT", "Asia/Karachi");
- map.put("PNT", "America/Phoenix");
- map.put("PRT", "America/Puerto_Rico");
- map.put("PST", "America/Los_Angeles");
- map.put("SST", "Pacific/Guadalcanal");
- map.put("VST", "Asia/Ho_Chi_Minh");
- map.put("EST", "-05:00");
- map.put("MST", "-07:00");
- map.put("HST", "-10:00");
- SHORT_IDS = Collections.unmodifiableMap(map);
- }
+ public static final Map<String, String> SHORT_IDS = Map.ofEntries(
+ entry("ACT", "Australia/Darwin"),
+ entry("AET", "Australia/Sydney"),
+ entry("AGT", "America/Argentina/Buenos_Aires"),
+ entry("ART", "Africa/Cairo"),
+ entry("AST", "America/Anchorage"),
+ entry("BET", "America/Sao_Paulo"),
+ entry("BST", "Asia/Dhaka"),
+ entry("CAT", "Africa/Harare"),
+ entry("CNT", "America/St_Johns"),
+ entry("CST", "America/Chicago"),
+ entry("CTT", "Asia/Shanghai"),
+ entry("EAT", "Africa/Addis_Ababa"),
+ entry("ECT", "Europe/Paris"),
+ entry("IET", "America/Indiana/Indianapolis"),
+ entry("IST", "Asia/Kolkata"),
+ entry("JST", "Asia/Tokyo"),
+ entry("MIT", "Pacific/Apia"),
+ entry("NET", "Asia/Yerevan"),
+ entry("NST", "Pacific/Auckland"),
+ entry("PLT", "Asia/Karachi"),
+ entry("PNT", "America/Phoenix"),
+ entry("PRT", "America/Puerto_Rico"),
+ entry("PST", "America/Los_Angeles"),
+ entry("SST", "Pacific/Guadalcanal"),
+ entry("VST", "Asia/Ho_Chi_Minh"),
+ entry("EST", "-05:00"),
+ entry("MST", "-07:00"),
+ entry("HST", "-10:00")
+ );
/**
* Serialization version.
*/
@@ -282,7 +280,7 @@
* @return a modifiable copy of the set of zone IDs, not null
*/
public static Set<String> getAvailableZoneIds() {
- return ZoneRulesProvider.getAvailableZoneIds();
+ return new HashSet<String>(ZoneRulesProvider.getAvailableZoneIds());
}
//-----------------------------------------------------------------------
@@ -305,8 +303,7 @@
public static ZoneId of(String zoneId, Map<String, String> aliasMap) {
Objects.requireNonNull(zoneId, "zoneId");
Objects.requireNonNull(aliasMap, "aliasMap");
- String id = aliasMap.get(zoneId);
- id = (id != null ? id : zoneId);
+ String id = Objects.requireNonNullElse(aliasMap.get(zoneId), zoneId);
return of(id);
}
@@ -370,7 +367,7 @@
public static ZoneId ofOffset(String prefix, ZoneOffset offset) {
Objects.requireNonNull(prefix, "prefix");
Objects.requireNonNull(offset, "offset");
- if (prefix.length() == 0) {
+ if (prefix.isEmpty()) {
return offset;
}
diff --git a/ojluni/src/main/java/java/time/ZoneOffset.java b/ojluni/src/main/java/java/time/ZoneOffset.java
index 4dfb94d..615ef64 100644
--- a/ojluni/src/main/java/java/time/ZoneOffset.java
+++ b/ojluni/src/main/java/java/time/ZoneOffset.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -144,7 +144,7 @@
*/
public static final ZoneOffset UTC = ZoneOffset.ofTotalSeconds(0);
/**
- * Constant for the maximum supported offset.
+ * Constant for the minimum supported offset.
*/
public static final ZoneOffset MIN = ZoneOffset.ofTotalSeconds(-MAX_SECONDS);
/**
@@ -369,15 +369,15 @@
} else if ((minutes > 0 && seconds < 0) || (minutes < 0 && seconds > 0)) {
throw new DateTimeException("Zone offset minutes and seconds must have the same sign");
}
- if (Math.abs(minutes) > 59) {
- throw new DateTimeException("Zone offset minutes not in valid range: abs(value) " +
- Math.abs(minutes) + " is not in the range 0 to 59");
+ if (minutes < -59 || minutes > 59) {
+ throw new DateTimeException("Zone offset minutes not in valid range: value " +
+ minutes + " is not in the range -59 to 59");
}
- if (Math.abs(seconds) > 59) {
- throw new DateTimeException("Zone offset seconds not in valid range: abs(value) " +
- Math.abs(seconds) + " is not in the range 0 to 59");
+ if (seconds < -59 || seconds > 59) {
+ throw new DateTimeException("Zone offset seconds not in valid range: value " +
+ seconds + " is not in the range -59 to 59");
}
- if (Math.abs(hours) == 18 && (Math.abs(minutes) > 0 || Math.abs(seconds) > 0)) {
+ if (Math.abs(hours) == 18 && (minutes | seconds) != 0) {
throw new DateTimeException("Zone offset not in valid range: -18:00 to +18:00");
}
}
@@ -405,7 +405,7 @@
* @throws DateTimeException if the offset is not in the required range
*/
public static ZoneOffset ofTotalSeconds(int totalSeconds) {
- if (Math.abs(totalSeconds) > MAX_SECONDS) {
+ if (totalSeconds < -MAX_SECONDS || totalSeconds > MAX_SECONDS) {
throw new DateTimeException("Zone offset not in valid range: -18:00 to +18:00");
}
if (totalSeconds % (15 * SECONDS_PER_MINUTE) == 0) {
@@ -690,11 +690,12 @@
* The comparison is "consistent with equals", as defined by {@link Comparable}.
*
* @param other the other date to compare to, not null
- * @return the comparator value, negative if less, postive if greater
+ * @return the comparator value, negative if less, positive if greater
* @throws NullPointerException if {@code other} is null
*/
@Override
public int compareTo(ZoneOffset other) {
+ // abs(totalSeconds) <= MAX_SECONDS, so no overflow can happen here
return other.totalSeconds - totalSeconds;
}
diff --git a/ojluni/src/main/java/java/time/ZonedDateTime.java b/ojluni/src/main/java/java/time/ZonedDateTime.java
index 4af3bda..cc37c19 100644
--- a/ojluni/src/main/java/java/time/ZonedDateTime.java
+++ b/ojluni/src/main/java/java/time/ZonedDateTime.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -464,6 +464,7 @@
* @param offset the zone offset, not null
* @param zone the time-zone, not null
* @return the zoned date-time, not null
+ * @throws DateTimeException if the combination of arguments is invalid
*/
public static ZonedDateTime ofStrict(LocalDateTime localDateTime, ZoneOffset offset, ZoneId zone) {
Objects.requireNonNull(localDateTime, "localDateTime");
@@ -786,7 +787,7 @@
* The {@link #isSupported(TemporalField) supported fields} will return valid
* values based on this date-time, except {@code NANO_OF_DAY}, {@code MICRO_OF_DAY},
* {@code EPOCH_DAY}, {@code PROLEPTIC_MONTH} and {@code INSTANT_SECONDS} which are too
- * large to fit in an {@code int} and throw a {@code DateTimeException}.
+ * large to fit in an {@code int} and throw an {@code UnsupportedTemporalTypeException}.
* All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
* <p>
* If the field is not a {@code ChronoField}, then the result of this method
@@ -1700,13 +1701,18 @@
* Note that this is a different approach to that used by days, months and years,
* thus adding one day is not the same as adding 24 hours.
* <p>
- * For example, consider a time-zone where the spring DST cutover means that the
- * local times 01:00 to 01:59 occur twice changing from offset +02:00 to +01:00.
+ * For example, consider a time-zone, such as 'Europe/Paris', where the
+ * Autumn DST cutover means that the local times 02:00 to 02:59 occur twice
+ * changing from offset +02:00 in summer to +01:00 in winter.
* <ul>
- * <li>Adding one hour to 00:30+02:00 will result in 01:30+02:00
- * <li>Adding one hour to 01:30+02:00 will result in 01:30+01:00
- * <li>Adding one hour to 01:30+01:00 will result in 02:30+01:00
- * <li>Adding three hours to 00:30+02:00 will result in 02:30+01:00
+ * <li>Adding one hour to 01:30+02:00 will result in 02:30+02:00
+ * (both in summer time)
+ * <li>Adding one hour to 02:30+02:00 will result in 02:30+01:00
+ * (moving from summer to winter time)
+ * <li>Adding one hour to 02:30+01:00 will result in 03:30+01:00
+ * (both in winter time)
+ * <li>Adding three hours to 01:30+02:00 will result in 03:30+01:00
+ * (moving from summer to winter time)
* </ul>
* <p>
* This instance is immutable and unaffected by this method call.
@@ -1941,13 +1947,18 @@
* Note that this is a different approach to that used by days, months and years,
* thus subtracting one day is not the same as adding 24 hours.
* <p>
- * For example, consider a time-zone where the spring DST cutover means that the
- * local times 01:00 to 01:59 occur twice changing from offset +02:00 to +01:00.
+ * For example, consider a time-zone, such as 'Europe/Paris', where the
+ * Autumn DST cutover means that the local times 02:00 to 02:59 occur twice
+ * changing from offset +02:00 in summer to +01:00 in winter.
* <ul>
- * <li>Subtracting one hour from 02:30+01:00 will result in 01:30+02:00
- * <li>Subtracting one hour from 01:30+01:00 will result in 01:30+02:00
- * <li>Subtracting one hour from 01:30+02:00 will result in 00:30+01:00
- * <li>Subtracting three hours from 02:30+01:00 will result in 00:30+02:00
+ * <li>Subtracting one hour from 03:30+01:00 will result in 02:30+01:00
+ * (both in winter time)
+ * <li>Subtracting one hour from 02:30+01:00 will result in 02:30+02:00
+ * (moving from winter to summer time)
+ * <li>Subtracting one hour from 02:30+02:00 will result in 01:30+02:00
+ * (both in summer time)
+ * <li>Subtracting three hours from 03:30+01:00 will result in 01:30+02:00
+ * (moving from winter to summer time)
* </ul>
* <p>
* This instance is immutable and unaffected by this method call.
diff --git a/ojluni/src/main/java/java/time/chrono/AbstractChronology.java b/ojluni/src/main/java/java/time/chrono/AbstractChronology.java
index c2e91d7..a32ecb7 100644
--- a/ojluni/src/main/java/java/time/chrono/AbstractChronology.java
+++ b/ojluni/src/main/java/java/time/chrono/AbstractChronology.java
@@ -127,36 +127,6 @@
public abstract class AbstractChronology implements Chronology {
/**
- * ChronoLocalDate order constant.
- */
- static final Comparator<ChronoLocalDate> DATE_ORDER =
- (Comparator<ChronoLocalDate> & Serializable) (date1, date2) -> {
- return Long.compare(date1.toEpochDay(), date2.toEpochDay());
- };
- /**
- * ChronoLocalDateTime order constant.
- */
- static final Comparator<ChronoLocalDateTime<? extends ChronoLocalDate>> DATE_TIME_ORDER =
- (Comparator<ChronoLocalDateTime<? extends ChronoLocalDate>> & Serializable) (dateTime1, dateTime2) -> {
- int cmp = Long.compare(dateTime1.toLocalDate().toEpochDay(), dateTime2.toLocalDate().toEpochDay());
- if (cmp == 0) {
- cmp = Long.compare(dateTime1.toLocalTime().toNanoOfDay(), dateTime2.toLocalTime().toNanoOfDay());
- }
- return cmp;
- };
- /**
- * ChronoZonedDateTime order constant.
- */
- static final Comparator<ChronoZonedDateTime<?>> INSTANT_ORDER =
- (Comparator<ChronoZonedDateTime<?>> & Serializable) (dateTime1, dateTime2) -> {
- int cmp = Long.compare(dateTime1.toEpochSecond(), dateTime2.toEpochSecond());
- if (cmp == 0) {
- cmp = Long.compare(dateTime1.toLocalTime().getNano(), dateTime2.toLocalTime().getNano());
- }
- return cmp;
- };
-
- /**
* Map of available calendars by ID.
*/
private static final ConcurrentHashMap<String, Chronology> CHRONOS_BY_ID = new ConcurrentHashMap<>();
diff --git a/ojluni/src/main/java/java/time/chrono/ChronoLocalDate.java b/ojluni/src/main/java/java/time/chrono/ChronoLocalDate.java
index 5848e94..fb69386 100644
--- a/ojluni/src/main/java/java/time/chrono/ChronoLocalDate.java
+++ b/ojluni/src/main/java/java/time/chrono/ChronoLocalDate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -66,6 +66,7 @@
import static java.time.temporal.ChronoField.YEAR;
import static java.time.temporal.ChronoUnit.DAYS;
+import java.io.Serializable;
import java.time.DateTimeException;
import java.time.LocalDate;
import java.time.LocalTime;
@@ -256,7 +257,9 @@
* @see #isEqual
*/
static Comparator<ChronoLocalDate> timeLineOrder() {
- return AbstractChronology.DATE_ORDER;
+ return (Comparator<ChronoLocalDate> & Serializable) (date1, date2) -> {
+ return Long.compare(date1.toEpochDay(), date2.toEpochDay());
+ };
}
//-----------------------------------------------------------------------
diff --git a/ojluni/src/main/java/java/time/chrono/ChronoLocalDateImpl.java b/ojluni/src/main/java/java/time/chrono/ChronoLocalDateImpl.java
index 8fe8d19..3d236ff 100644
--- a/ojluni/src/main/java/java/time/chrono/ChronoLocalDateImpl.java
+++ b/ojluni/src/main/java/java/time/chrono/ChronoLocalDateImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -110,7 +110,7 @@
* int year = date.get(ChronoField.YEAR);
* System.out.printf(" Today is %s %s %d-%s-%d%n", date.getChronology().getID(),
* dow, day, month, year);
-
+ *
* // Print today's date and the last day of the year
* ChronoLocalDate now1 = Chronology.of("Hijrah").dateNow();
* ChronoLocalDate first = now1.with(ChronoField.DAY_OF_MONTH, 1)
diff --git a/ojluni/src/main/java/java/time/chrono/ChronoLocalDateTime.java b/ojluni/src/main/java/java/time/chrono/ChronoLocalDateTime.java
index ce77f4d..51637c2 100644
--- a/ojluni/src/main/java/java/time/chrono/ChronoLocalDateTime.java
+++ b/ojluni/src/main/java/java/time/chrono/ChronoLocalDateTime.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -66,6 +66,7 @@
import static java.time.temporal.ChronoUnit.FOREVER;
import static java.time.temporal.ChronoUnit.NANOS;
+import java.io.Serializable;
import java.time.DateTimeException;
import java.time.Instant;
import java.time.LocalDateTime;
@@ -136,7 +137,13 @@
* @see #isEqual
*/
static Comparator<ChronoLocalDateTime<?>> timeLineOrder() {
- return AbstractChronology.DATE_TIME_ORDER;
+ return (Comparator<ChronoLocalDateTime<? extends ChronoLocalDate>> & Serializable) (dateTime1, dateTime2) -> {
+ int cmp = Long.compare(dateTime1.toLocalDate().toEpochDay(), dateTime2.toLocalDate().toEpochDay());
+ if (cmp == 0) {
+ cmp = Long.compare(dateTime1.toLocalTime().toNanoOfDay(), dateTime2.toLocalTime().toNanoOfDay());
+ }
+ return cmp;
+ };
}
//-----------------------------------------------------------------------
@@ -194,7 +201,7 @@
*
* @return the date part of this date-time, not null
*/
- D toLocalDate() ;
+ D toLocalDate();
/**
* Gets the local time part of this date-time.
diff --git a/ojluni/src/main/java/java/time/chrono/ChronoPeriodImpl.java b/ojluni/src/main/java/java/time/chrono/ChronoPeriodImpl.java
index 911144d..646af14 100644
--- a/ojluni/src/main/java/java/time/chrono/ChronoPeriodImpl.java
+++ b/ojluni/src/main/java/java/time/chrono/ChronoPeriodImpl.java
@@ -77,8 +77,6 @@
import java.time.temporal.TemporalUnit;
import java.time.temporal.UnsupportedTemporalTypeException;
import java.time.temporal.ValueRange;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import java.util.Objects;
@@ -105,8 +103,7 @@
/**
* The set of supported units.
*/
- private static final List<TemporalUnit> SUPPORTED_UNITS =
- Collections.unmodifiableList(Arrays.<TemporalUnit>asList(YEARS, MONTHS, DAYS));
+ private static final List<TemporalUnit> SUPPORTED_UNITS = List.of(YEARS, MONTHS, DAYS);
/**
* The chronology.
diff --git a/ojluni/src/main/java/java/time/chrono/ChronoZonedDateTime.java b/ojluni/src/main/java/java/time/chrono/ChronoZonedDateTime.java
index cae9adc..eadcf9d 100644
--- a/ojluni/src/main/java/java/time/chrono/ChronoZonedDateTime.java
+++ b/ojluni/src/main/java/java/time/chrono/ChronoZonedDateTime.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -66,6 +66,7 @@
import static java.time.temporal.ChronoUnit.FOREVER;
import static java.time.temporal.ChronoUnit.NANOS;
+import java.io.Serializable;
import java.time.DateTimeException;
import java.time.Instant;
import java.time.LocalTime;
@@ -137,7 +138,13 @@
* @see #isEqual
*/
static Comparator<ChronoZonedDateTime<?>> timeLineOrder() {
- return AbstractChronology.INSTANT_ORDER;
+ return (Comparator<ChronoZonedDateTime<?>> & Serializable) (dateTime1, dateTime2) -> {
+ int cmp = Long.compare(dateTime1.toEpochSecond(), dateTime2.toEpochSecond());
+ if (cmp == 0) {
+ cmp = Long.compare(dateTime1.toLocalTime().getNano(), dateTime2.toLocalTime().getNano());
+ }
+ return cmp;
+ };
}
//-----------------------------------------------------------------------
diff --git a/ojluni/src/main/java/java/time/chrono/Chronology.java b/ojluni/src/main/java/java/time/chrono/Chronology.java
index 0b2d2e1..f35f9b9 100644
--- a/ojluni/src/main/java/java/time/chrono/Chronology.java
+++ b/ojluni/src/main/java/java/time/chrono/Chronology.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -61,12 +61,17 @@
*/
package java.time.chrono;
+import static java.time.temporal.ChronoField.HOUR_OF_DAY;
+import static java.time.temporal.ChronoField.MINUTE_OF_HOUR;
+import static java.time.temporal.ChronoField.SECOND_OF_MINUTE;
+
import java.time.Clock;
import java.time.DateTimeException;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.ZoneId;
+import java.time.ZoneOffset;
import java.time.format.DateTimeFormatterBuilder;
import java.time.format.ResolverStyle;
import java.time.format.TextStyle;
@@ -146,7 +151,7 @@
* Each chronology must define a chronology ID that is unique within the system.
* If the chronology represents a calendar system defined by the
* CLDR specification then the calendar type is the concatenation of the
- * CLDR type and, if applicable, the CLDR variant,
+ * CLDR type and, if applicable, the CLDR variant.
*
* @implSpec
* This interface must be implemented with care to ensure other classes operate correctly.
@@ -172,12 +177,12 @@
*
* @param temporal the temporal to convert, not null
* @return the chronology, not null
- * @throws DateTimeException if unable to convert to an {@code Chronology}
+ * @throws DateTimeException if unable to convert to a {@code Chronology}
*/
static Chronology from(TemporalAccessor temporal) {
Objects.requireNonNull(temporal, "temporal");
Chronology obj = temporal.query(TemporalQueries.chronology());
- return (obj != null ? obj : IsoChronology.INSTANCE);
+ return Objects.requireNonNullElse(obj, IsoChronology.INSTANCE);
}
//-----------------------------------------------------------------------
@@ -198,7 +203,7 @@
* For example, the locale "en-JP-u-ca-japanese" represents the English
* language as used in Japan with the Japanese calendar system.
* <p>
- * This method finds the desired calendar system by in a manner equivalent
+ * This method finds the desired calendar system in a manner equivalent
* to passing "ca" to {@link Locale#getUnicodeLocaleType(String)}.
* If the "ca" key is not present, then {@code IsoChronology} is returned.
* <p>
@@ -281,7 +286,7 @@
* <p>
* The calendar type is an identifier defined by the CLDR and
* <em>Unicode Locale Data Markup Language (LDML)</em> specifications
- * to uniquely identification a calendar.
+ * to uniquely identify a calendar.
* The {@code getCalendarType} is the concatenation of the CLDR calendar type
* and the variant, if applicable, is appended separated by "-".
* The calendar type is used to lookup the {@code Chronology} using {@link #of(String)}.
@@ -538,7 +543,14 @@
* <ul>
* <li>a leap-year must imply a year-length longer than a non leap-year.
* <li>a chronology that does not support the concept of a year must return false.
+ * <li>the correct result must be returned for all years within the
+ * valid range of years for the chronology.
* </ul>
+ * <p>
+ * Outside the range of valid years an implementation is free to return
+ * either a best guess or false.
+ * An implementation must not throw an exception, even if the year is
+ * outside the range of valid years.
*
* @param prolepticYear the proleptic-year to check, not validated for range
* @return true if the year is a leap year
@@ -705,6 +717,59 @@
return new ChronoPeriodImpl(this, years, months, days);
}
+ //---------------------------------------------------------------------
+
+ /**
+ * Gets the number of seconds from the epoch of 1970-01-01T00:00:00Z.
+ * <p>
+ * The number of seconds is calculated using the proleptic-year,
+ * month, day-of-month, hour, minute, second, and zoneOffset.
+ *
+ * @param prolepticYear the chronology proleptic-year
+ * @param month the chronology month-of-year
+ * @param dayOfMonth the chronology day-of-month
+ * @param hour the hour-of-day, from 0 to 23
+ * @param minute the minute-of-hour, from 0 to 59
+ * @param second the second-of-minute, from 0 to 59
+ * @param zoneOffset the zone offset, not null
+ * @return the number of seconds relative to 1970-01-01T00:00:00Z, may be negative
+ * @throws DateTimeException if any of the values are out of range
+ * @since 9
+ */
+ public default long epochSecond(int prolepticYear, int month, int dayOfMonth,
+ int hour, int minute, int second, ZoneOffset zoneOffset) {
+ Objects.requireNonNull(zoneOffset, "zoneOffset");
+ HOUR_OF_DAY.checkValidValue(hour);
+ MINUTE_OF_HOUR.checkValidValue(minute);
+ SECOND_OF_MINUTE.checkValidValue(second);
+ long daysInSec = Math.multiplyExact(date(prolepticYear, month, dayOfMonth).toEpochDay(), 86400);
+ long timeinSec = (hour * 60 + minute) * 60 + second;
+ return Math.addExact(daysInSec, timeinSec - zoneOffset.getTotalSeconds());
+ }
+
+ /**
+ * Gets the number of seconds from the epoch of 1970-01-01T00:00:00Z.
+ * <p>
+ * The number of seconds is calculated using the era, year-of-era,
+ * month, day-of-month, hour, minute, second, and zoneOffset.
+ *
+ * @param era the era of the correct type for the chronology, not null
+ * @param yearOfEra the chronology year-of-era
+ * @param month the chronology month-of-year
+ * @param dayOfMonth the chronology day-of-month
+ * @param hour the hour-of-day, from 0 to 23
+ * @param minute the minute-of-hour, from 0 to 59
+ * @param second the second-of-minute, from 0 to 59
+ * @param zoneOffset the zone offset, not null
+ * @return the number of seconds relative to 1970-01-01T00:00:00Z, may be negative
+ * @throws DateTimeException if any of the values are out of range
+ * @since 9
+ */
+ public default long epochSecond(Era era, int yearOfEra, int month, int dayOfMonth,
+ int hour, int minute, int second, ZoneOffset zoneOffset) {
+ Objects.requireNonNull(era, "era");
+ return epochSecond(prolepticYear(era, yearOfEra), month, dayOfMonth, hour, minute, second, zoneOffset);
+ }
//-----------------------------------------------------------------------
/**
* Compares this chronology to another chronology.
diff --git a/ojluni/src/main/java/java/time/chrono/Era.java b/ojluni/src/main/java/java/time/chrono/Era.java
index 019050c..5cf0968 100644
--- a/ojluni/src/main/java/java/time/chrono/Era.java
+++ b/ojluni/src/main/java/java/time/chrono/Era.java
@@ -310,8 +310,8 @@
* The parameters control the style of the returned text and the locale.
* <p>
* If no textual mapping is found then the {@link #getValue() numeric value} is returned.
- * <p>
- * This default implementation is suitable for all implementations.
+ *
+ * @apiNote This default implementation is suitable for most implementations.
*
* @param style the style of the text required, not null
* @param locale the locale to use, not null
diff --git a/ojluni/src/main/java/java/time/chrono/HijrahChronology.java b/ojluni/src/main/java/java/time/chrono/HijrahChronology.java
index e7b3554..6de5cc7 100644
--- a/ojluni/src/main/java/java/time/chrono/HijrahChronology.java
+++ b/ojluni/src/main/java/java/time/chrono/HijrahChronology.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -59,15 +59,13 @@
import static java.time.temporal.ChronoField.EPOCH_DAY;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
+import java.io.FilePermission;
import java.io.InputStream;
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.security.AccessController;
-import java.security.PrivilegedActionException;
+import java.security.PrivilegedAction;
import java.time.Clock;
import java.time.DateTimeException;
import java.time.Instant;
@@ -82,7 +80,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Objects;
import java.util.Properties;
import sun.util.logging.PlatformLogger;
@@ -106,18 +103,19 @@
*
* <p>
* CLDR and LDML identify variants:
- * <table cellpadding="2" summary="Variants of Hijrah Calendars">
+ * <table class="striped" style="text-align:left">
+ * <caption style="display:none">Variants of Hijrah Calendars</caption>
* <thead>
- * <tr class="tableSubHeadingColor">
- * <th class="colFirst" align="left" >Chronology ID</th>
- * <th class="colFirst" align="left" >Calendar Type</th>
- * <th class="colFirst" align="left" >Locale extension, see {@link java.util.Locale}</th>
- * <th class="colLast" align="left" >Description</th>
+ * <tr>
+ * <th scope="col">Chronology ID</th>
+ * <th scope="col">Calendar Type</th>
+ * <th scope="col">Locale extension, see {@link java.util.Locale}</th>
+ * <th scope="col">Description</th>
* </tr>
* </thead>
* <tbody>
- * <tr class="altColor">
- * <td>Hijrah-umalqura</td>
+ * <tr>
+ * <th scope="row">Hijrah-umalqura</th>
* <td>islamic-umalqura</td>
* <td>ca-islamic-umalqura</td>
* <td>Islamic - Umm Al-Qura calendar of Saudi Arabia</td>
@@ -145,63 +143,43 @@
* property resource that defines the {@code ID}, the {@code calendar type},
* the start of the calendar, the alignment with the
* ISO calendar, and the length of each month for a range of years.
- * The variants are identified in the {@code calendars.properties} file.
- * The new properties are prefixed with {@code "calendars.hijrah."}:
- * <table cellpadding="2" border="0" summary="Configuration of Hijrah Calendar Variants">
- * <thead>
- * <tr class="tableSubHeadingColor">
- * <th class="colFirst" align="left">Property Name</th>
- * <th class="colFirst" align="left">Property value</th>
- * <th class="colLast" align="left">Description </th>
- * </tr>
- * </thead>
- * <tbody>
- * <tr class="altColor">
- * <td>calendars.hijrah.{ID}</td>
- * <td>The property resource defining the {@code {ID}} variant</td>
- * <td>The property resource is located with the {@code calendars.properties} file</td>
- * </tr>
- * <tr class="rowColor">
- * <td>calendars.hijrah.{ID}.type</td>
- * <td>The calendar type</td>
- * <td>LDML defines the calendar type names</td>
- * </tr>
- * </tbody>
- * </table>
+ * The variants are loaded by HijrahChronology as a resource from
+ * hijrah-config-<calendar type>.properties.
* <p>
* The Hijrah property resource is a set of properties that describe the calendar.
* The syntax is defined by {@code java.util.Properties#load(Reader)}.
- * <table cellpadding="2" summary="Configuration of Hijrah Calendar">
+ * <table class="striped" style="text-align:left">
+ * <caption style="display:none">Configuration of Hijrah Calendar</caption>
* <thead>
- * <tr class="tableSubHeadingColor">
- * <th class="colFirst" align="left" > Property Name</th>
- * <th class="colFirst" align="left" > Property value</th>
- * <th class="colLast" align="left" > Description </th>
+ * <tr>
+ * <th scope="col">Property Name</th>
+ * <th scope="col">Property value</th>
+ * <th scope="col">Description</th>
* </tr>
* </thead>
* <tbody>
- * <tr class="altColor">
- * <td>id</td>
+ * <tr>
+ * <th scope="row">id</th>
* <td>Chronology Id, for example, "Hijrah-umalqura"</td>
* <td>The Id of the calendar in common usage</td>
* </tr>
- * <tr class="rowColor">
- * <td>type</td>
+ * <tr>
+ * <th scope="row">type</th>
* <td>Calendar type, for example, "islamic-umalqura"</td>
* <td>LDML defines the calendar types</td>
* </tr>
- * <tr class="altColor">
- * <td>version</td>
+ * <tr>
+ * <th scope="row">version</th>
* <td>Version, for example: "1.8.0_1"</td>
* <td>The version of the Hijrah variant data</td>
* </tr>
- * <tr class="rowColor">
- * <td>iso-start</td>
+ * <tr>
+ * <th scope="row">iso-start</th>
* <td>ISO start date, formatted as {@code yyyy-MM-dd}, for example: "1900-04-30"</td>
* <td>The ISO date of the first day of the minimum Hijrah year.</td>
* </tr>
- * <tr class="altColor">
- * <td>yyyy - a numeric 4 digit year, for example "1434"</td>
+ * <tr>
+ * <th scope="row">yyyy - a numeric 4 digit year, for example "1434"</th>
* <td>The value is a sequence of 12 month lengths,
* for example: "29 30 29 30 29 30 30 30 29 30 29 29"</td>
* <td>The lengths of the 12 months of the year separated by whitespace.
@@ -279,91 +257,41 @@
* Computed by {@link #createEpochMonths}.
*/
private transient int maxYearLength;
- /**
- * A reference to the properties stored in
- * ${java.home}/lib/calendars.properties
- */
- private final transient static Properties calendarProperties;
/**
- * Prefix of property names for Hijrah calendar variants.
+ * Prefix of resource names for Hijrah calendar variants.
*/
- private static final String PROP_PREFIX = "calendar.hijrah.";
- /**
- * Suffix of property names containing the calendar type of a variant.
- */
- private static final String PROP_TYPE_SUFFIX = ".type";
+ private static final String RESOURCE_PREFIX = "hijrah-config-";
/**
- * Static initialization of the predefined calendars found in the
- * lib/calendars.properties file.
+ * Suffix of resource names for Hijrah calendar variants.
+ */
+ private static final String RESOURCE_SUFFIX = ".properties";
+
+ /**
+ * Static initialization of the built-in calendars.
+ * The data is not loaded until it is used.
*/
static {
- try {
- calendarProperties = sun.util.calendar.BaseCalendar.getCalendarProperties();
- } catch (IOException ioe) {
- throw new InternalError("Can't initialize lib/calendars.properties", ioe);
- }
-
- try {
- INSTANCE = new HijrahChronology("Hijrah-umalqura");
- // Register it by its aliases
- AbstractChronology.registerChrono(INSTANCE, "Hijrah");
- AbstractChronology.registerChrono(INSTANCE, "islamic");
- } catch (DateTimeException ex) {
- // Absence of Hijrah calendar is fatal to initializing this class.
- PlatformLogger logger = PlatformLogger.getLogger("java.time.chrono");
- logger.severe("Unable to initialize Hijrah calendar: Hijrah-umalqura", ex);
- throw new RuntimeException("Unable to initialize Hijrah-umalqura calendar", ex.getCause());
- }
- registerVariants();
+ INSTANCE = new HijrahChronology("Hijrah-umalqura", "islamic-umalqura");
+ // Register it by its aliases
+ AbstractChronology.registerChrono(INSTANCE, "Hijrah");
+ AbstractChronology.registerChrono(INSTANCE, "islamic");
}
/**
- * For each Hijrah variant listed, create the HijrahChronology and register it.
- * Exceptions during initialization are logged but otherwise ignored.
- */
- private static void registerVariants() {
- for (String name : calendarProperties.stringPropertyNames()) {
- if (name.startsWith(PROP_PREFIX)) {
- String id = name.substring(PROP_PREFIX.length());
- if (id.indexOf('.') >= 0) {
- continue; // no name or not a simple name of a calendar
- }
- if (id.equals(INSTANCE.getId())) {
- continue; // do not duplicate the default
- }
- try {
- // Create and register the variant
- HijrahChronology chrono = new HijrahChronology(id);
- AbstractChronology.registerChrono(chrono);
- } catch (DateTimeException ex) {
- // Log error and continue
- PlatformLogger logger = PlatformLogger.getLogger("java.time.chrono");
- logger.severe("Unable to initialize Hijrah calendar: " + id, ex);
- }
- }
- }
- }
-
- /**
- * Create a HijrahChronology for the named variant.
- * The resource and calendar type are retrieved from properties
- * in the {@code calendars.properties}.
- * The property names are {@code "calendar.hijrah." + id}
- * and {@code "calendar.hijrah." + id + ".type"}
+ * Create a HijrahChronology for the named variant and type.
+ *
* @param id the id of the calendar
- * @throws DateTimeException if the calendar type is missing from the properties file.
- * @throws IllegalArgumentException if the id is empty
+ * @param calType the typeId of the calendar
+ * @throws IllegalArgumentException if the id or typeId is empty
*/
- private HijrahChronology(String id) throws DateTimeException {
+ private HijrahChronology(String id, String calType) {
if (id.isEmpty()) {
throw new IllegalArgumentException("calendar id is empty");
}
- String propName = PROP_PREFIX + id + PROP_TYPE_SUFFIX;
- String calType = calendarProperties.getProperty(propName);
- if (calType == null || calType.isEmpty()) {
- throw new DateTimeException("calendarType is missing or empty for: " + propName);
+ if (calType.isEmpty()) {
+ throw new IllegalArgumentException("calendar typeId is empty");
}
this.typeId = id;
this.calendarType = calType;
@@ -560,6 +488,16 @@
return yearOfEra;
}
+ /**
+ * Creates the HijrahEra object from the numeric value.
+ * The Hijrah calendar system has only one era covering the
+ * proleptic years greater than zero.
+ * This method returns the singleton HijrahEra for the value 1.
+ *
+ * @param eraValue the era value
+ * @return the calendar system era, not null
+ * @throws DateTimeException if unable to create the era
+ */
@Override
public HijrahEra eraOf(int eraValue) {
switch (eraValue) {
@@ -572,7 +510,7 @@
@Override
public List<Era> eras() {
- return Arrays.<Era>asList(HijrahEra.values());
+ return List.of(HijrahEra.values());
}
//-----------------------------------------------------------------------
@@ -728,7 +666,7 @@
}
/**
- * Return the maximum supported Hijrah ear.
+ * Return the maximum supported Hijrah year.
*
* @return the minimum
*/
@@ -865,22 +803,33 @@
/**
* Return the configuration properties from the resource.
* <p>
- * The default location of the variant configuration resource is:
+ * The location of the variant configuration resource is:
* <pre>
- * "$java.home/lib/" + resource-name
+ * "/java/time/chrono/hijrah-config-" + calendarType + ".properties"
* </pre>
*
- * @param resource the name of the calendar property resource
+ * @param calendarType the calendarType of the calendar variant
* @return a Properties containing the properties read from the resource.
* @throws Exception if access to the property resource fails
*/
- private static Properties readConfigProperties(final String resource) throws Exception {
- // Android-changed: Load system resources.
- Properties props = new Properties();
- try (InputStream is = ClassLoader.getSystemResourceAsStream(resource)) {
+ private Properties readConfigProperties(final String calendarType) throws Exception {
+ String resourceName = RESOURCE_PREFIX + calendarType + RESOURCE_SUFFIX;
+ // BEGIN Android-changed: Load system resources.
+ /*
+ PrivilegedAction<InputStream> getResourceAction = () -> HijrahChronology.class.getResourceAsStream(resourceName);
+ FilePermission perm1 = new FilePermission("<<ALL FILES>>", "read");
+ RuntimePermission perm2 = new RuntimePermission("accessSystemModules");
+ try (InputStream is = AccessController.doPrivileged(getResourceAction, null, perm1, perm2)) {
+ */
+ try (InputStream is = HijrahChronology.class.getResourceAsStream(resourceName)) {
+ // END Android-changed: Load system resources.
+ if (is == null) {
+ throw new RuntimeException("Hijrah calendar resource not found: /java/time/chrono/" + resourceName);
+ }
+ Properties props = new Properties();
props.load(is);
+ return props;
}
- return props;
}
/**
@@ -896,9 +845,7 @@
*/
private void loadCalendarData() {
try {
- String resourceName = calendarProperties.getProperty(PROP_PREFIX + typeId);
- Objects.requireNonNull(resourceName, "Resource missing for calendar: " + PROP_PREFIX + typeId);
- Properties props = readConfigProperties(resourceName);
+ Properties props = readConfigProperties(calendarType);
Map<Integer, int[]> years = new HashMap<>();
int minYear = Integer.MAX_VALUE;
@@ -927,7 +874,7 @@
default:
try {
// Everything else is either a year or invalid
- int year = Integer.valueOf(key);
+ int year = Integer.parseInt(key);
int[] months = parseMonths((String) entry.getValue());
years.put(year, months);
maxYear = Math.max(maxYear, year);
@@ -1035,7 +982,7 @@
}
for (int i = 0; i < 12; i++) {
try {
- months[i] = Integer.valueOf(numbers[i]);
+ months[i] = Integer.parseInt(numbers[i]);
} catch (NumberFormatException nfe) {
throw new IllegalArgumentException("bad key: " + numbers[i]);
}
@@ -1057,9 +1004,9 @@
throw new IllegalArgumentException("date must be yyyy-MM-dd");
}
int[] ymd = new int[3];
- ymd[0] = Integer.valueOf(string.substring(0, 4));
- ymd[1] = Integer.valueOf(string.substring(5, 7));
- ymd[2] = Integer.valueOf(string.substring(8, 10));
+ ymd[0] = Integer.parseInt(string, 0, 4, 10);
+ ymd[1] = Integer.parseInt(string, 5, 7, 10);
+ ymd[2] = Integer.parseInt(string, 8, 10, 10);
return ymd;
} catch (NumberFormatException ex) {
throw new IllegalArgumentException("date must be yyyy-MM-dd", ex);
diff --git a/ojluni/src/main/java/java/time/chrono/HijrahDate.java b/ojluni/src/main/java/java/time/chrono/HijrahDate.java
index de2cb13..2ab5109 100644
--- a/ojluni/src/main/java/java/time/chrono/HijrahDate.java
+++ b/ojluni/src/main/java/java/time/chrono/HijrahDate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -362,7 +362,7 @@
if (field instanceof ChronoField) {
switch ((ChronoField) field) {
case DAY_OF_WEEK: return getDayOfWeek();
- case ALIGNED_DAY_OF_WEEK_IN_MONTH: return ((getDayOfWeek() - 1) % 7) + 1;
+ case ALIGNED_DAY_OF_WEEK_IN_MONTH: return ((dayOfMonth - 1) % 7) + 1;
case ALIGNED_DAY_OF_WEEK_IN_YEAR: return ((getDayOfYear() - 1) % 7) + 1;
case DAY_OF_MONTH: return this.dayOfMonth;
case DAY_OF_YEAR: return this.getDayOfYear();
@@ -491,7 +491,7 @@
* @return the day-of-week; computed from the epochday
*/
private int getDayOfWeek() {
- int dow0 = (int)Math.floorMod(toEpochDay() + 3, 7);
+ int dow0 = Math.floorMod(toEpochDay() + 3, 7);
return dow0 + 1;
}
diff --git a/ojluni/src/main/java/java/time/chrono/HijrahEra.java b/ojluni/src/main/java/java/time/chrono/HijrahEra.java
index 4390f69..0d79e7d 100644
--- a/ojluni/src/main/java/java/time/chrono/HijrahEra.java
+++ b/ojluni/src/main/java/java/time/chrono/HijrahEra.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -64,10 +64,13 @@
import static java.time.temporal.ChronoField.ERA;
import java.time.DateTimeException;
+import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.TextStyle;
import java.time.temporal.ChronoField;
import java.time.temporal.TemporalField;
import java.time.temporal.UnsupportedTemporalTypeException;
import java.time.temporal.ValueRange;
+import java.util.Locale;
/**
* An era in the Hijrah calendar system.
@@ -155,4 +158,18 @@
return Era.super.range(field);
}
+ /**
+ * {@inheritDoc}
+ *
+ * @param style {@inheritDoc}
+ * @param locale {@inheritDoc}
+ */
+ @Override
+ public String getDisplayName(TextStyle style, Locale locale) {
+ return new DateTimeFormatterBuilder()
+ .appendText(ERA, style)
+ .toFormatter(locale)
+ .withChronology(HijrahChronology.INSTANCE)
+ .format(HijrahDate.now());
+ }
}
diff --git a/ojluni/src/main/java/java/time/chrono/IsoChronology.java b/ojluni/src/main/java/java/time/chrono/IsoChronology.java
index a9c79ff..18d7368 100644
--- a/ojluni/src/main/java/java/time/chrono/IsoChronology.java
+++ b/ojluni/src/main/java/java/time/chrono/IsoChronology.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -61,14 +61,17 @@
*/
package java.time.chrono;
-import java.io.InvalidObjectException;
import static java.time.temporal.ChronoField.DAY_OF_MONTH;
import static java.time.temporal.ChronoField.ERA;
+import static java.time.temporal.ChronoField.HOUR_OF_DAY;
+import static java.time.temporal.ChronoField.MINUTE_OF_HOUR;
import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
import static java.time.temporal.ChronoField.PROLEPTIC_MONTH;
+import static java.time.temporal.ChronoField.SECOND_OF_MINUTE;
import static java.time.temporal.ChronoField.YEAR;
import static java.time.temporal.ChronoField.YEAR_OF_ERA;
+import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.time.Clock;
@@ -79,14 +82,14 @@
import java.time.Month;
import java.time.Period;
import java.time.Year;
-import java.time.ZoneId;
import java.time.ZonedDateTime;
+import java.time.ZoneId;
+import java.time.ZoneOffset;
import java.time.format.ResolverStyle;
import java.time.temporal.ChronoField;
import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalField;
import java.time.temporal.ValueRange;
-import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -132,6 +135,8 @@
*/
private static final long serialVersionUID = -1440403870442975015L;
+ private static final long DAYS_0000_TO_1970 = (146097 * 5L) - (30L * 365L + 7L); // taken from LocalDate
+
/**
* Restricted constructor.
*/
@@ -263,6 +268,94 @@
return LocalDate.from(temporal);
}
+ //-----------------------------------------------------------------------
+ /**
+ * Gets the number of seconds from the epoch of 1970-01-01T00:00:00Z.
+ * <p>
+ * The number of seconds is calculated using the year,
+ * month, day-of-month, hour, minute, second, and zoneOffset.
+ *
+ * @param prolepticYear the year, from MIN_YEAR to MAX_YEAR
+ * @param month the month-of-year, from 1 to 12
+ * @param dayOfMonth the day-of-month, from 1 to 31
+ * @param hour the hour-of-day, from 0 to 23
+ * @param minute the minute-of-hour, from 0 to 59
+ * @param second the second-of-minute, from 0 to 59
+ * @param zoneOffset the zone offset, not null
+ * @return the number of seconds relative to 1970-01-01T00:00:00Z, may be negative
+ * @throws DateTimeException if the value of any argument is out of range,
+ * or if the day-of-month is invalid for the month-of-year
+ * @since 9
+ */
+ @Override
+ public long epochSecond(int prolepticYear, int month, int dayOfMonth,
+ int hour, int minute, int second, ZoneOffset zoneOffset) {
+ YEAR.checkValidValue(prolepticYear);
+ MONTH_OF_YEAR.checkValidValue(month);
+ DAY_OF_MONTH.checkValidValue(dayOfMonth);
+ HOUR_OF_DAY.checkValidValue(hour);
+ MINUTE_OF_HOUR.checkValidValue(minute);
+ SECOND_OF_MINUTE.checkValidValue(second);
+ Objects.requireNonNull(zoneOffset, "zoneOffset");
+ if (dayOfMonth > 28) {
+ int dom = numberOfDaysOfMonth(prolepticYear, month);
+ if (dayOfMonth > dom) {
+ if (dayOfMonth == 29) {
+ throw new DateTimeException("Invalid date 'February 29' as '" + prolepticYear + "' is not a leap year");
+ } else {
+ throw new DateTimeException("Invalid date '" + Month.of(month).name() + " " + dayOfMonth + "'");
+ }
+ }
+ }
+
+ long totalDays = 0;
+ int timeinSec = 0;
+ totalDays += 365L * prolepticYear;
+ if (prolepticYear >= 0) {
+ totalDays += (prolepticYear + 3L) / 4 - (prolepticYear + 99L) / 100 + (prolepticYear + 399L) / 400;
+ } else {
+ totalDays -= prolepticYear / -4 - prolepticYear / -100 + prolepticYear / -400;
+ }
+ totalDays += (367 * month - 362) / 12;
+ totalDays += dayOfMonth - 1;
+ if (month > 2) {
+ totalDays--;
+ if (IsoChronology.INSTANCE.isLeapYear(prolepticYear) == false) {
+ totalDays--;
+ }
+ }
+ totalDays -= DAYS_0000_TO_1970;
+ timeinSec = (hour * 60 + minute ) * 60 + second;
+ return Math.addExact(Math.multiplyExact(totalDays, 86400L), timeinSec - zoneOffset.getTotalSeconds());
+ }
+
+ /**
+ * Gets the number of days for the given month in the given year.
+ *
+ * @param year the year to represent, from MIN_YEAR to MAX_YEAR
+ * @param month the month-of-year to represent, from 1 to 12
+ * @return the number of days for the given month in the given year
+ */
+ private int numberOfDaysOfMonth(int year, int month) {
+ int dom;
+ switch (month) {
+ case 2:
+ dom = (IsoChronology.INSTANCE.isLeapYear(year) ? 29 : 28);
+ break;
+ case 4:
+ case 6:
+ case 9:
+ case 11:
+ dom = 30;
+ break;
+ default:
+ dom = 31;
+ break;
+ }
+ return dom;
+ }
+
+
/**
* Obtains an ISO local date-time from another date-time object.
* <p>
@@ -398,7 +491,7 @@
@Override
public List<Era> eras() {
- return Arrays.<Era>asList(IsoEra.values());
+ return List.of(IsoEra.values());
}
//-----------------------------------------------------------------------
diff --git a/ojluni/src/main/java/java/time/chrono/IsoEra.java b/ojluni/src/main/java/java/time/chrono/IsoEra.java
index bd29969..887d76f 100644
--- a/ojluni/src/main/java/java/time/chrono/IsoEra.java
+++ b/ojluni/src/main/java/java/time/chrono/IsoEra.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -70,26 +70,27 @@
* A definition has therefore been created with two eras - 'Current era' (CE) for
* years on or after 0001-01-01 (ISO), and 'Before current era' (BCE) for years before that.
*
- * <table summary="ISO years and eras" cellpadding="2" cellspacing="3" border="0" >
+ * <table class="striped" style="text-align:left">
+ * <caption style="display:none">ISO years and eras</caption>
* <thead>
- * <tr class="tableSubHeadingColor">
- * <th class="colFirst" align="left">year-of-era</th>
- * <th class="colFirst" align="left">era</th>
- * <th class="colLast" align="left">proleptic-year</th>
+ * <tr>
+ * <th scope="col">year-of-era</th>
+ * <th scope="col">era</th>
+ * <th scope="col">proleptic-year</th>
* </tr>
* </thead>
* <tbody>
- * <tr class="rowColor">
- * <td>2</td><td>CE</td><td>2</td>
+ * <tr>
+ * <td>2</td><td>CE</td><th scope="row">2</th>
* </tr>
- * <tr class="altColor">
- * <td>1</td><td>CE</td><td>1</td>
+ * <tr>
+ * <td>1</td><td>CE</td><th scope="row">1</th>
* </tr>
- * <tr class="rowColor">
- * <td>1</td><td>BCE</td><td>0</td>
+ * <tr>
+ * <td>1</td><td>BCE</td><th scope="row">0</th>
* </tr>
- * <tr class="altColor">
- * <td>2</td><td>BCE</td><td>-1</td>
+ * <tr>
+ * <td>2</td><td>BCE</td><th scope="row">-1</th>
* </tr>
* </tbody>
* </table>
diff --git a/ojluni/src/main/java/java/time/chrono/JapaneseChronology.java b/ojluni/src/main/java/java/time/chrono/JapaneseChronology.java
index 034a3bc..0e487af 100644
--- a/ojluni/src/main/java/java/time/chrono/JapaneseChronology.java
+++ b/ojluni/src/main/java/java/time/chrono/JapaneseChronology.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -81,7 +81,6 @@
import java.time.temporal.TemporalField;
import java.time.temporal.UnsupportedTemporalTypeException;
import java.time.temporal.ValueRange;
-import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
import java.util.Locale;
@@ -386,7 +385,7 @@
@Override
public List<Era> eras() {
- return Arrays.<Era>asList(JapaneseEra.values());
+ return List.of(JapaneseEra.values());
}
JapaneseEra getCurrentEra() {
@@ -469,38 +468,38 @@
return era.getPrivateEra().getSinceDate().getYear() + yearOfEra - 1;
}
- private ChronoLocalDate resolveYMD(JapaneseEra era, int yoe, Map<TemporalField,Long> fieldValues, ResolverStyle resolverStyle) {
- fieldValues.remove(ERA);
- fieldValues.remove(YEAR_OF_ERA);
- if (resolverStyle == ResolverStyle.LENIENT) {
- int y = prolepticYearLenient(era, yoe);
- long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1);
- long days = Math.subtractExact(fieldValues.remove(DAY_OF_MONTH), 1);
- return date(y, 1, 1).plus(months, MONTHS).plus(days, DAYS);
- }
- int moy = range(MONTH_OF_YEAR).checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR), MONTH_OF_YEAR);
- int dom = range(DAY_OF_MONTH).checkValidIntValue(fieldValues.remove(DAY_OF_MONTH), DAY_OF_MONTH);
- if (resolverStyle == ResolverStyle.SMART) { // previous valid
- if (yoe < 1) {
- throw new DateTimeException("Invalid YearOfEra: " + yoe);
- }
- int y = prolepticYearLenient(era, yoe);
- JapaneseDate result;
- try {
- result = date(y, moy, dom);
- } catch (DateTimeException ex) {
- result = date(y, moy, 1).with(TemporalAdjusters.lastDayOfMonth());
- }
- // handle the era being changed
- // only allow if the new date is in the same Jan-Dec as the era change
- // determine by ensuring either original yoe or result yoe is 1
- if (result.getEra() != era && result.get(YEAR_OF_ERA) > 1 && yoe > 1) {
- throw new DateTimeException("Invalid YearOfEra for Era: " + era + " " + yoe);
- }
- return result;
- }
- return date(era, yoe, moy, dom);
- }
+ private ChronoLocalDate resolveYMD(JapaneseEra era, int yoe, Map<TemporalField,Long> fieldValues, ResolverStyle resolverStyle) {
+ fieldValues.remove(ERA);
+ fieldValues.remove(YEAR_OF_ERA);
+ if (resolverStyle == ResolverStyle.LENIENT) {
+ int y = prolepticYearLenient(era, yoe);
+ long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1);
+ long days = Math.subtractExact(fieldValues.remove(DAY_OF_MONTH), 1);
+ return date(y, 1, 1).plus(months, MONTHS).plus(days, DAYS);
+ }
+ int moy = range(MONTH_OF_YEAR).checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR), MONTH_OF_YEAR);
+ int dom = range(DAY_OF_MONTH).checkValidIntValue(fieldValues.remove(DAY_OF_MONTH), DAY_OF_MONTH);
+ if (resolverStyle == ResolverStyle.SMART) { // previous valid
+ if (yoe < 1) {
+ throw new DateTimeException("Invalid YearOfEra: " + yoe);
+ }
+ int y = prolepticYearLenient(era, yoe);
+ JapaneseDate result;
+ try {
+ result = date(y, moy, dom);
+ } catch (DateTimeException ex) {
+ result = date(y, moy, 1).with(TemporalAdjusters.lastDayOfMonth());
+ }
+ // handle the era being changed
+ // only allow if the new date is in the same Jan-Dec as the era change
+ // determine by ensuring either original yoe or result yoe is 1
+ if (result.getEra() != era && result.get(YEAR_OF_ERA) > 1 && yoe > 1) {
+ throw new DateTimeException("Invalid YearOfEra for Era: " + era + " " + yoe);
+ }
+ return result;
+ }
+ return date(era, yoe, moy, dom);
+ }
private ChronoLocalDate resolveYD(JapaneseEra era, int yoe, Map <TemporalField,Long> fieldValues, ResolverStyle resolverStyle) {
fieldValues.remove(ERA);
diff --git a/ojluni/src/main/java/java/time/chrono/JapaneseDate.java b/ojluni/src/main/java/java/time/chrono/JapaneseDate.java
index 143c4a4..c638a31 100644
--- a/ojluni/src/main/java/java/time/chrono/JapaneseDate.java
+++ b/ojluni/src/main/java/java/time/chrono/JapaneseDate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -432,10 +432,6 @@
field == ALIGNED_WEEK_OF_MONTH || field == ALIGNED_WEEK_OF_YEAR) {
return false;
}
- // Android-changed: Apply upstream OpenJDK 9 compilation fix.
- // Applied OpenJDK 9 change from http://hg.openjdk.java.net/jdk9/dev/jdk/rev/2b7b09c81bf1
- // On OpenJDK 8, either version is supported and has the same behavior.
- // return ChronoLocalDate.super.isSupported(field);
return super.isSupported(field);
}
diff --git a/ojluni/src/main/java/java/time/chrono/JapaneseEra.java b/ojluni/src/main/java/java/time/chrono/JapaneseEra.java
index 81805d0..83fcb94 100644
--- a/ojluni/src/main/java/java/time/chrono/JapaneseEra.java
+++ b/ojluni/src/main/java/java/time/chrono/JapaneseEra.java
@@ -237,10 +237,11 @@
* @throws DateTimeException if the value is invalid
*/
public static JapaneseEra of(int japaneseEra) {
- if (japaneseEra < MEIJI.eraValue || japaneseEra + ERA_OFFSET > KNOWN_ERAS.length) {
+ int i = ordinal(japaneseEra);
+ if (i < 0 || i >= KNOWN_ERAS.length) {
throw new DateTimeException("Invalid era: " + japaneseEra);
}
- return KNOWN_ERAS[ordinal(japaneseEra)];
+ return KNOWN_ERAS[i];
}
/**
diff --git a/ojluni/src/main/java/java/time/chrono/MinguoChronology.java b/ojluni/src/main/java/java/time/chrono/MinguoChronology.java
index 841884c..fd6fdc3 100644
--- a/ojluni/src/main/java/java/time/chrono/MinguoChronology.java
+++ b/ojluni/src/main/java/java/time/chrono/MinguoChronology.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -72,7 +72,6 @@
import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalField;
import java.time.temporal.ValueRange;
-import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -306,7 +305,7 @@
@Override
public List<Era> eras() {
- return Arrays.<Era>asList(MinguoEra.values());
+ return List.of(MinguoEra.values());
}
//-----------------------------------------------------------------------
diff --git a/ojluni/src/main/java/java/time/chrono/MinguoDate.java b/ojluni/src/main/java/java/time/chrono/MinguoDate.java
index 71e0a12..798c8f8 100644
--- a/ojluni/src/main/java/java/time/chrono/MinguoDate.java
+++ b/ojluni/src/main/java/java/time/chrono/MinguoDate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
diff --git a/ojluni/src/main/java/java/time/chrono/MinguoEra.java b/ojluni/src/main/java/java/time/chrono/MinguoEra.java
index fd96de1..048fcbf 100644
--- a/ojluni/src/main/java/java/time/chrono/MinguoEra.java
+++ b/ojluni/src/main/java/java/time/chrono/MinguoEra.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -61,7 +61,12 @@
*/
package java.time.chrono;
+import static java.time.temporal.ChronoField.ERA;
+
import java.time.DateTimeException;
+import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.TextStyle;
+import java.util.Locale;
/**
* An era in the Minguo calendar system.
@@ -71,27 +76,28 @@
* All previous years, zero or earlier in the proleptic count or one and greater
* in the year-of-era count, are part of the 'Before Republic of China' era.
*
- * <table summary="Minguo years and eras" cellpadding="2" cellspacing="3" border="0" >
+ * <table class="striped" style="text-align:left">
+ * <caption style="display:none">Minguo years and eras</caption>
* <thead>
- * <tr class="tableSubHeadingColor">
- * <th class="colFirst" align="left">year-of-era</th>
- * <th class="colFirst" align="left">era</th>
- * <th class="colFirst" align="left">proleptic-year</th>
- * <th class="colLast" align="left">ISO proleptic-year</th>
+ * <tr>
+ * <th>year-of-era</th>
+ * <th>era</th>
+ * <th>proleptic-year</th>
+ * <th>ISO proleptic-year</th>
* </tr>
* </thead>
* <tbody>
- * <tr class="rowColor">
- * <td>2</td><td>ROC</td><td>2</td><td>1913</td>
+ * <tr>
+ * <td>2</td><td>ROC</td><th scope="row">2</th><td>1913</td>
* </tr>
- * <tr class="altColor">
- * <td>1</td><td>ROC</td><td>1</td><td>1912</td>
+ * <tr>
+ * <td>1</td><td>ROC</td><th scope="row">1</th><td>1912</td>
* </tr>
- * <tr class="rowColor">
- * <td>1</td><td>BEFORE_ROC</td><td>0</td><td>1911</td>
+ * <tr>
+ * <td>1</td><td>BEFORE_ROC</td><th scope="row">0</th><td>1911</td>
* </tr>
- * <tr class="altColor">
- * <td>2</td><td>BEFORE_ROC</td><td>-1</td><td>1910</td>
+ * <tr>
+ * <td>2</td><td>BEFORE_ROC</td><th scope="row">-1</th><td>1910</td>
* </tr>
* </tbody>
* </table>
@@ -152,4 +158,19 @@
return ordinal();
}
+ /**
+ * {@inheritDoc}
+ *
+ * @param style {@inheritDoc}
+ * @param locale {@inheritDoc}
+ */
+ @Override
+ public String getDisplayName(TextStyle style, Locale locale) {
+ return new DateTimeFormatterBuilder()
+ .appendText(ERA, style)
+ .toFormatter(locale)
+ .withChronology(MinguoChronology.INSTANCE)
+ .format(this == ROC ? MinguoDate.of(1, 1, 1) : MinguoDate.of(0, 1, 1));
+ }
+
}
diff --git a/ojluni/src/main/java/java/time/chrono/ThaiBuddhistChronology.java b/ojluni/src/main/java/java/time/chrono/ThaiBuddhistChronology.java
index 5b96c85..c6938b2 100644
--- a/ojluni/src/main/java/java/time/chrono/ThaiBuddhistChronology.java
+++ b/ojluni/src/main/java/java/time/chrono/ThaiBuddhistChronology.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -342,7 +342,7 @@
@Override
public List<Era> eras() {
- return Arrays.<Era>asList(ThaiBuddhistEra.values());
+ return List.of(ThaiBuddhistEra.values());
}
//-----------------------------------------------------------------------
diff --git a/ojluni/src/main/java/java/time/chrono/ThaiBuddhistDate.java b/ojluni/src/main/java/java/time/chrono/ThaiBuddhistDate.java
index cc58cea..21efbf7 100644
--- a/ojluni/src/main/java/java/time/chrono/ThaiBuddhistDate.java
+++ b/ojluni/src/main/java/java/time/chrono/ThaiBuddhistDate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
diff --git a/ojluni/src/main/java/java/time/chrono/ThaiBuddhistEra.java b/ojluni/src/main/java/java/time/chrono/ThaiBuddhistEra.java
index e3e6e86..35e42fc 100644
--- a/ojluni/src/main/java/java/time/chrono/ThaiBuddhistEra.java
+++ b/ojluni/src/main/java/java/time/chrono/ThaiBuddhistEra.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -61,7 +61,12 @@
*/
package java.time.chrono;
+import static java.time.temporal.ChronoField.ERA;
+
import java.time.DateTimeException;
+import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.TextStyle;
+import java.util.Locale;
/**
* An era in the Thai Buddhist calendar system.
@@ -71,27 +76,28 @@
* All previous years, zero or earlier in the proleptic count or one and greater
* in the year-of-era count, are part of the 'Before Buddhist' era.
*
- * <table summary="Buddhist years and eras" cellpadding="2" cellspacing="3" border="0" >
+ * <table class="striped" style="text-align:left">
+ * <caption style="display:none">Buddhist years and eras</caption>
* <thead>
- * <tr class="tableSubHeadingColor">
- * <th class="colFirst" align="left">year-of-era</th>
- * <th class="colFirst" align="left">era</th>
- * <th class="colFirst" align="left">proleptic-year</th>
- * <th class="colLast" align="left">ISO proleptic-year</th>
+ * <tr>
+ * <th scope="col">year-of-era</th>
+ * <th scope="col">era</th>
+ * <th scope="col">proleptic-year</th>
+ * <th scope="col">ISO proleptic-year</th>
* </tr>
* </thead>
* <tbody>
- * <tr class="rowColor">
- * <td>2</td><td>BE</td><td>2</td><td>-542</td>
+ * <tr>
+ * <td>2</td><td>BE</td><th scope="row">2</th><td>-542</td>
* </tr>
- * <tr class="altColor">
- * <td>1</td><td>BE</td><td>1</td><td>-543</td>
+ * <tr>
+ * <td>1</td><td>BE</td><th scope="row">1</th><td>-543</td>
* </tr>
- * <tr class="rowColor">
- * <td>1</td><td>BEFORE_BE</td><td>0</td><td>-544</td>
+ * <tr>
+ * <td>1</td><td>BEFORE_BE</td><th scope="row">0</th><td>-544</td>
* </tr>
- * <tr class="altColor">
- * <td>2</td><td>BEFORE_BE</td><td>-1</td><td>-545</td>
+ * <tr>
+ * <td>2</td><td>BEFORE_BE</td><th scope="row">-1</th><td>-545</td>
* </tr>
* </tbody>
* </table>
@@ -152,4 +158,19 @@
return ordinal();
}
+ /**
+ * {@inheritDoc}
+ *
+ * @param style {@inheritDoc}
+ * @param locale {@inheritDoc}
+ */
+ @Override
+ public String getDisplayName(TextStyle style, Locale locale) {
+ return new DateTimeFormatterBuilder()
+ .appendText(ERA, style)
+ .toFormatter(locale)
+ .withChronology(ThaiBuddhistChronology.INSTANCE)
+ .format(this == BE ? ThaiBuddhistDate.of(1, 1, 1) : ThaiBuddhistDate.of(0, 1, 1));
+ }
+
}
diff --git a/ojluni/src/main/java/java/time/format/DateTimeFormatter.java b/ojluni/src/main/java/java/time/format/DateTimeFormatter.java
index 57a0bf8..761cab7 100644
--- a/ojluni/src/main/java/java/time/format/DateTimeFormatter.java
+++ b/ojluni/src/main/java/java/time/format/DateTimeFormatter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -80,6 +80,7 @@
import java.time.Period;
import java.time.ZoneId;
import java.time.ZoneOffset;
+import java.time.chrono.ChronoLocalDateTime;
import java.time.chrono.Chronology;
import java.time.chrono.IsoChronology;
import java.time.format.DateTimeFormatterBuilder.CompositePrinterParser;
@@ -95,7 +96,9 @@
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
+import java.util.Optional;
import java.util.Set;
+import libcore.icu.ICU;
/**
* Formatter for printing and parsing date-time objects.
@@ -149,106 +152,107 @@
* implementation of {@code java.text.Format}.
*
* <h3 id="predefined">Predefined Formatters</h3>
- * <table summary="Predefined Formatters" cellpadding="2" cellspacing="3" border="0" >
+ * <table class="striped" style="text-align:left">
+ * <caption>Predefined Formatters</caption>
* <thead>
- * <tr class="tableSubHeadingColor">
- * <th class="colFirst" align="left">Formatter</th>
- * <th class="colFirst" align="left">Description</th>
- * <th class="colLast" align="left">Example</th>
+ * <tr>
+ * <th scope="col">Formatter</th>
+ * <th scope="col">Description</th>
+ * <th scope="col">Example</th>
* </tr>
* </thead>
* <tbody>
- * <tr class="rowColor">
- * <td>{@link #ofLocalizedDate ofLocalizedDate(dateStyle)} </td>
+ * <tr>
+ * <th scope="row">{@link #ofLocalizedDate ofLocalizedDate(dateStyle)} </th>
* <td> Formatter with date style from the locale </td>
* <td> '2011-12-03'</td>
* </tr>
- * <tr class="altColor">
- * <td> {@link #ofLocalizedTime ofLocalizedTime(timeStyle)} </td>
+ * <tr>
+ * <th scope="row"> {@link #ofLocalizedTime ofLocalizedTime(timeStyle)} </th>
* <td> Formatter with time style from the locale </td>
* <td> '10:15:30'</td>
* </tr>
- * <tr class="rowColor">
- * <td> {@link #ofLocalizedDateTime ofLocalizedDateTime(dateTimeStyle)} </td>
+ * <tr>
+ * <th scope="row"> {@link #ofLocalizedDateTime ofLocalizedDateTime(dateTimeStyle)} </th>
* <td> Formatter with a style for date and time from the locale</td>
* <td> '3 Jun 2008 11:05:30'</td>
* </tr>
- * <tr class="altColor">
- * <td> {@link #ofLocalizedDateTime ofLocalizedDateTime(dateStyle,timeStyle)}
- * </td>
+ * <tr>
+ * <th scope="row"> {@link #ofLocalizedDateTime ofLocalizedDateTime(dateStyle,timeStyle)}
+ * </th>
* <td> Formatter with date and time styles from the locale </td>
* <td> '3 Jun 2008 11:05'</td>
* </tr>
- * <tr class="rowColor">
- * <td> {@link #BASIC_ISO_DATE}</td>
+ * <tr>
+ * <th scope="row"> {@link #BASIC_ISO_DATE}</th>
* <td>Basic ISO date </td> <td>'20111203'</td>
* </tr>
- * <tr class="altColor">
- * <td> {@link #ISO_LOCAL_DATE}</td>
+ * <tr>
+ * <th scope="row"> {@link #ISO_LOCAL_DATE}</th>
* <td> ISO Local Date </td>
* <td>'2011-12-03'</td>
* </tr>
- * <tr class="rowColor">
- * <td> {@link #ISO_OFFSET_DATE}</td>
+ * <tr>
+ * <th scope="row"> {@link #ISO_OFFSET_DATE}</th>
* <td> ISO Date with offset </td>
* <td>'2011-12-03+01:00'</td>
* </tr>
- * <tr class="altColor">
- * <td> {@link #ISO_DATE}</td>
+ * <tr>
+ * <th scope="row"> {@link #ISO_DATE}</th>
* <td> ISO Date with or without offset </td>
* <td> '2011-12-03+01:00'; '2011-12-03'</td>
* </tr>
- * <tr class="rowColor">
- * <td> {@link #ISO_LOCAL_TIME}</td>
+ * <tr>
+ * <th scope="row"> {@link #ISO_LOCAL_TIME}</th>
* <td> Time without offset </td>
* <td>'10:15:30'</td>
* </tr>
- * <tr class="altColor">
- * <td> {@link #ISO_OFFSET_TIME}</td>
+ * <tr>
+ * <th scope="row"> {@link #ISO_OFFSET_TIME}</th>
* <td> Time with offset </td>
* <td>'10:15:30+01:00'</td>
* </tr>
- * <tr class="rowColor">
- * <td> {@link #ISO_TIME}</td>
+ * <tr>
+ * <th scope="row"> {@link #ISO_TIME}</th>
* <td> Time with or without offset </td>
* <td>'10:15:30+01:00'; '10:15:30'</td>
* </tr>
- * <tr class="altColor">
- * <td> {@link #ISO_LOCAL_DATE_TIME}</td>
+ * <tr>
+ * <th scope="row"> {@link #ISO_LOCAL_DATE_TIME}</th>
* <td> ISO Local Date and Time </td>
* <td>'2011-12-03T10:15:30'</td>
* </tr>
- * <tr class="rowColor">
- * <td> {@link #ISO_OFFSET_DATE_TIME}</td>
+ * <tr>
+ * <th scope="row"> {@link #ISO_OFFSET_DATE_TIME}</th>
* <td> Date Time with Offset
- * </td><td>2011-12-03T10:15:30+01:00'</td>
+ * </td><td>'2011-12-03T10:15:30+01:00'</td>
* </tr>
- * <tr class="altColor">
- * <td> {@link #ISO_ZONED_DATE_TIME}</td>
+ * <tr>
+ * <th scope="row"> {@link #ISO_ZONED_DATE_TIME}</th>
* <td> Zoned Date Time </td>
* <td>'2011-12-03T10:15:30+01:00[Europe/Paris]'</td>
* </tr>
- * <tr class="rowColor">
- * <td> {@link #ISO_DATE_TIME}</td>
+ * <tr>
+ * <th scope="row"> {@link #ISO_DATE_TIME}</th>
* <td> Date and time with ZoneId </td>
* <td>'2011-12-03T10:15:30+01:00[Europe/Paris]'</td>
* </tr>
- * <tr class="altColor">
- * <td> {@link #ISO_ORDINAL_DATE}</td>
+ * <tr>
+ * <th scope="row"> {@link #ISO_ORDINAL_DATE}</th>
* <td> Year and day of year </td>
* <td>'2012-337'</td>
* </tr>
- * <tr class="rowColor">
- * <td> {@link #ISO_WEEK_DATE}</td>
+ * <tr>
+ * <th scope="row"> {@link #ISO_WEEK_DATE}</th>
* <td> Year and Week </td>
- * <td>2012-W48-6'</td></tr>
- * <tr class="altColor">
- * <td> {@link #ISO_INSTANT}</td>
+ * <td>'2012-W48-6'</td></tr>
+ * <tr>
+ * <th scope="row"> {@link #ISO_INSTANT}</th>
* <td> Date and Time of an Instant </td>
* <td>'2011-12-03T10:15:30Z' </td>
* </tr>
- * <tr class="rowColor">
- * <td> {@link #RFC_1123_DATE_TIME}</td>
+ * <tr>
+ * <th scope="row"> {@link #RFC_1123_DATE_TIME}</th>
* <td> RFC 1123 / RFC 822 </td>
* <td>'Tue, 3 Jun 2008 11:05:30 GMT'</td>
* </tr>
@@ -274,54 +278,60 @@
* <p>
* All letters 'A' to 'Z' and 'a' to 'z' are reserved as pattern letters. The
* following pattern letters are defined:
- * <pre>
- * Symbol Meaning Presentation Examples
- * ------ ------- ------------ -------
- * G era text AD; Anno Domini; A
- * u year year 2004; 04
- * y year-of-era year 2004; 04
- * D day-of-year number 189
- * M/L month-of-year number/text 7; 07; Jul; July; J
- * d day-of-month number 10
+ * <table class="striped">
+ * <caption>Pattern Letters and Symbols</caption>
+ * <thead>
+ * <tr><th scope="col">Symbol</th> <th scope="col">Meaning</th> <th scope="col">Presentation</th> <th scope="col">Examples</th>
+ * </thead>
+ * <tbody>
+ * <tr><th scope="row">G</th> <td>era</td> <td>text</td> <td>AD; Anno Domini; A</td>
+ * <tr><th scope="row">u</th> <td>year</td> <td>year</td> <td>2004; 04</td>
+ * <tr><th scope="row">y</th> <td>year-of-era</td> <td>year</td> <td>2004; 04</td>
+ * <tr><th scope="row">D</th> <td>day-of-year</td> <td>number</td> <td>189</td>
+ * <tr><th scope="row">M/L</th> <td>month-of-year</td> <td>number/text</td> <td>7; 07; Jul; July; J</td>
+ * <tr><th scope="row">d</th> <td>day-of-month</td> <td>number</td> <td>10</td>
+ * <tr><th scope="row">g</th> <td>modified-julian-day</td> <td>number</td> <td>2451334</td>
*
- * Q/q quarter-of-year number/text 3; 03; Q3; 3rd quarter
- * Y week-based-year year 1996; 96
- * w week-of-week-based-year number 27
- * W week-of-month number 4
- * E day-of-week text Tue; Tuesday; T
- * e/c localized day-of-week number/text 2; 02; Tue; Tuesday; T
- * F week-of-month number 3
+ * <tr><th scope="row">Q/q</th> <td>quarter-of-year</td> <td>number/text</td> <td>3; 03; Q3; 3rd quarter</td>
+ * <tr><th scope="row">Y</th> <td>week-based-year</td> <td>year</td> <td>1996; 96</td>
+ * <tr><th scope="row">w</th> <td>week-of-week-based-year</td> <td>number</td> <td>27</td>
+ * <tr><th scope="row">W</th> <td>week-of-month</td> <td>number</td> <td>4</td>
+ * <tr><th scope="row">E</th> <td>day-of-week</td> <td>text</td> <td>Tue; Tuesday; T</td>
+ * <tr><th scope="row">e/c</th> <td>localized day-of-week</td> <td>number/text</td> <td>2; 02; Tue; Tuesday; T</td>
+ * <tr><th scope="row">F</th> <td>day-of-week-in-month</td> <td>number</td> <td>3</td>
*
- * a am-pm-of-day text PM
- * h clock-hour-of-am-pm (1-12) number 12
- * K hour-of-am-pm (0-11) number 0
- * k clock-hour-of-am-pm (1-24) number 0
+ * <tr><th scope="row">a</th> <td>am-pm-of-day</td> <td>text</td> <td>PM</td>
+ * <tr><th scope="row">h</th> <td>clock-hour-of-am-pm (1-12)</td> <td>number</td> <td>12</td>
+ * <tr><th scope="row">K</th> <td>hour-of-am-pm (0-11)</td> <td>number</td> <td>0</td>
+ * <tr><th scope="row">k</th> <td>clock-hour-of-day (1-24)</td> <td>number</td> <td>24</td>
*
- * H hour-of-day (0-23) number 0
- * m minute-of-hour number 30
- * s second-of-minute number 55
- * S fraction-of-second fraction 978
- * A milli-of-day number 1234
- * n nano-of-second number 987654321
- * N nano-of-day number 1234000000
+ * <tr><th scope="row">H</th> <td>hour-of-day (0-23)</td> <td>number</td> <td>0</td>
+ * <tr><th scope="row">m</th> <td>minute-of-hour</td> <td>number</td> <td>30</td>
+ * <tr><th scope="row">s</th> <td>second-of-minute</td> <td>number</td> <td>55</td>
+ * <tr><th scope="row">S</th> <td>fraction-of-second</td> <td>fraction</td> <td>978</td>
+ * <tr><th scope="row">A</th> <td>milli-of-day</td> <td>number</td> <td>1234</td>
+ * <tr><th scope="row">n</th> <td>nano-of-second</td> <td>number</td> <td>987654321</td>
+ * <tr><th scope="row">N</th> <td>nano-of-day</td> <td>number</td> <td>1234000000</td>
*
- * V time-zone ID zone-id America/Los_Angeles; Z; -08:30
- * z time-zone name zone-name Pacific Standard Time; PST
- * O localized zone-offset offset-O GMT+8; GMT+08:00; UTC-08:00;
- * X zone-offset 'Z' for zero offset-X Z; -08; -0830; -08:30; -083015; -08:30:15;
- * x zone-offset offset-x +0000; -08; -0830; -08:30; -083015; -08:30:15;
- * Z zone-offset offset-Z +0000; -0800; -08:00;
+ * <tr><th scope="row">V</th> <td>time-zone ID</td> <td>zone-id</td> <td>America/Los_Angeles; Z; -08:30</td>
+ * <tr><th scope="row">v</th> <td>generic time-zone name</td> <td>zone-name</td> <td>Pacific Time; PT</td>
+ * <tr><th scope="row">z</th> <td>time-zone name</td> <td>zone-name</td> <td>Pacific Standard Time; PST</td>
+ * <tr><th scope="row">O</th> <td>localized zone-offset</td> <td>offset-O</td> <td>GMT+8; GMT+08:00; UTC-08:00</td>
+ * <tr><th scope="row">X</th> <td>zone-offset 'Z' for zero</td> <td>offset-X</td> <td>Z; -08; -0830; -08:30; -083015; -08:30:15</td>
+ * <tr><th scope="row">x</th> <td>zone-offset</td> <td>offset-x</td> <td>+0000; -08; -0830; -08:30; -083015; -08:30:15</td>
+ * <tr><th scope="row">Z</th> <td>zone-offset</td> <td>offset-Z</td> <td>+0000; -0800; -08:00</td>
*
- * p pad next pad modifier 1
+ * <tr><th scope="row">p</th> <td>pad next</td> <td>pad modifier</td> <td>1</td>
*
- * ' escape for text delimiter
- * '' single quote literal '
- * [ optional section start
- * ] optional section end
- * # reserved for future use
- * { reserved for future use
- * } reserved for future use
- * </pre>
+ * <tr><th scope="row">'</th> <td>escape for text</td> <td>delimiter</td> <td></td>
+ * <tr><th scope="row">''</th> <td>single quote</td> <td>literal</td> <td>'</td>
+ * <tr><th scope="row">[</th> <td>optional section start</td> <td></td> <td></td>
+ * <tr><th scope="row">]</th> <td>optional section end</td> <td></td> <td></td>
+ * <tr><th scope="row">#</th> <td>reserved for future use</td> <td></td> <td></td>
+ * <tr><th scope="row">{</th> <td>reserved for future use</td> <td></td> <td></td>
+ * <tr><th scope="row">}</th> <td>reserved for future use</td> <td></td> <td></td>
+ * </tbody>
+ * </table>
* <p>
* The count of pattern letters determines the format.
* <p>
@@ -363,9 +373,17 @@
* letters throws {@code IllegalArgumentException}.
* <p>
* <b>Zone names</b>: This outputs the display name of the time-zone ID. If the
- * count of letters is one, two or three, then the short name is output. If the
- * count of letters is four, then the full name is output. Five or more letters
- * throws {@code IllegalArgumentException}.
+ * pattern letter is 'z' the output is the daylight savings aware zone name.
+ * If there is insufficient information to determine whether DST applies,
+ * the name ignoring daylight savings time will be used.
+ * If the count of letters is one, two or three, then the short name is output.
+ * If the count of letters is four, then the full name is output.
+ * Five or more letters throws {@code IllegalArgumentException}.
+ * <p>
+ * If the pattern letter is 'v' the output provides the zone name ignoring
+ * daylight savings time. If the count of letters is one, then the short name is output.
+ * If the count of letters is four, then the full name is output.
+ * Two, three and five or more letters throw {@code IllegalArgumentException}.
* <p>
* <b>Offset X and x</b>: This formats the offset based on the number of pattern
* letters. One letter outputs just the hour, such as '+01', unless the minute
@@ -473,6 +491,17 @@
* day-of-week was valid for the date.
* <li>If an {@linkplain #parsedExcessDays() excess number of days}
* was parsed then it is added to the date if a date is available.
+ * <li> If a second-based field is present, but {@code LocalTime} was not parsed,
+ * then the resolver ensures that milli, micro and nano second values are
+ * available to meet the contract of {@link ChronoField}.
+ * These will be set to zero if missing.
+ * <li>If both date and time were parsed and either an offset or zone is present,
+ * the field {@link ChronoField#INSTANT_SECONDS} is created.
+ * If an offset was parsed then the offset will be combined with the
+ * {@code LocalDateTime} to form the instant, with any zone ignored.
+ * If a {@code ZoneId} was parsed without an offset then the zone will be
+ * combined with the {@code LocalDateTime} to form the instant using the rules
+ * of {@link ChronoLocalDateTime#atZone(ZoneId)}.
* </ol>
*
* @implSpec
@@ -521,7 +550,7 @@
* For example, {@code d MMM uuuu} will format 2011-12-03 as '3 Dec 2011'.
* <p>
* The formatter will use the {@link Locale#getDefault(Locale.Category) default FORMAT locale}.
- * This can be changed using {@link DateTimeFormatter#withLocale(Locale)} on the returned formatter
+ * This can be changed using {@link DateTimeFormatter#withLocale(Locale)} on the returned formatter.
* Alternatively use the {@link #ofPattern(String, Locale)} variant of this method.
* <p>
* The returned formatter has no override chronology or zone.
@@ -545,7 +574,7 @@
* For example, {@code d MMM uuuu} will format 2011-12-03 as '3 Dec 2011'.
* <p>
* The formatter will use the specified locale.
- * This can be changed using {@link DateTimeFormatter#withLocale(Locale)} on the returned formatter
+ * This can be changed using {@link DateTimeFormatter#withLocale(Locale)} on the returned formatter.
* <p>
* The returned formatter has no override chronology or zone.
* It uses {@link ResolverStyle#SMART SMART} resolver style.
@@ -607,6 +636,9 @@
* The returned formatter has a chronology of ISO set to ensure dates in
* other calendar systems are correctly converted.
* It has no override zone and uses the {@link ResolverStyle#SMART SMART} resolver style.
+ * The {@code FULL} and {@code LONG} styles typically require a time-zone.
+ * When formatting using these styles, a {@code ZoneId} must be available,
+ * either by using {@code ZonedDateTime} or {@link DateTimeFormatter#withZone}.
*
* @param timeStyle the formatter style to obtain, not null
* @return the time formatter, not null
@@ -635,6 +667,9 @@
* The returned formatter has a chronology of ISO set to ensure dates in
* other calendar systems are correctly converted.
* It has no override zone and uses the {@link ResolverStyle#SMART SMART} resolver style.
+ * The {@code FULL} and {@code LONG} styles typically require a time-zone.
+ * When formatting using these styles, a {@code ZoneId} must be available,
+ * either by using {@code ZonedDateTime} or {@link DateTimeFormatter#withZone}.
*
* @param dateTimeStyle the formatter style to obtain, not null
* @return the date-time formatter, not null
@@ -663,6 +698,9 @@
* The returned formatter has a chronology of ISO set to ensure dates in
* other calendar systems are correctly converted.
* It has no override zone and uses the {@link ResolverStyle#SMART SMART} resolver style.
+ * The {@code FULL} and {@code LONG} styles typically require a time-zone.
+ * When formatting using these styles, a {@code ZoneId} must be available,
+ * either by using {@code ZonedDateTime} or {@link DateTimeFormatter#withZone}.
*
* @param dateStyle the date formatter style to obtain, not null
* @param timeStyle the time formatter style to obtain, not null
@@ -911,6 +949,7 @@
* <li>The {@link #ISO_LOCAL_DATE_TIME}
* <li>The {@link ZoneOffset#getId() offset ID}. If the offset has seconds then
* they will be handled even though this is not part of the ISO-8601 standard.
+ * The offset parsing is lenient, which allows the minutes and seconds to be optional.
* Parsing is case insensitive.
* </ul>
* <p>
@@ -923,7 +962,9 @@
ISO_OFFSET_DATE_TIME = new DateTimeFormatterBuilder()
.parseCaseInsensitive()
.append(ISO_LOCAL_DATE_TIME)
+ .parseLenient()
.appendOffsetId()
+ .parseStrict()
.toFormatter(ResolverStyle.STRICT, IsoChronology.INSTANCE);
}
@@ -1099,7 +1140,7 @@
* This returns an immutable formatter capable of formatting and parsing
* the ISO-8601 instant format.
* When formatting, the second-of-minute is always output.
- * The nano-of-second outputs zero, three, six or nine digits digits as necessary.
+ * The nano-of-second outputs zero, three, six or nine digits as necessary.
* When parsing, time to at least the seconds field is required.
* Fractional seconds from zero to nine are parsed.
* The localized decimal style is not used.
@@ -1148,6 +1189,7 @@
* <li>If the offset is not available to format or parse then the format is complete.
* <li>The {@link ZoneOffset#getId() offset ID} without colons. If the offset has
* seconds then they will be handled even though this is not part of the ISO-8601 standard.
+ * The offset parsing is lenient, which allows the minutes and seconds to be optional.
* Parsing is case insensitive.
* </ul>
* <p>
@@ -1166,7 +1208,9 @@
.appendValue(MONTH_OF_YEAR, 2)
.appendValue(DAY_OF_MONTH, 2)
.optionalStart()
+ .parseLenient()
.appendOffset("+HHMMss", "Z")
+ .parseStrict()
.toFormatter(ResolverStyle.STRICT, IsoChronology.INSTANCE);
}
@@ -1395,12 +1439,15 @@
return locale;
}
+ // Android-changed: Remove javadoc reference to #localizedBy(Locale)
/**
* Returns a copy of this formatter with a new locale.
* <p>
* This is used to lookup any part of the formatter needing specific
* localization, such as the text or localized pattern.
* <p>
+ * The locale is stored as passed in, without further processing.
+ * <p>
* This instance is immutable and unaffected by this method call.
*
* @param locale the new locale, not null
@@ -1413,6 +1460,53 @@
return new DateTimeFormatter(printerParser, locale, decimalStyle, resolverStyle, resolverFields, chrono, zone);
}
+ // Android-changed: Remove "rg" extension support in the javadoc. See http://b/228322300.
+ /**
+ * Returns a copy of this formatter with localized values of the locale,
+ * calendar, decimal style and/or timezone, that superseded values in
+ * this formatter.
+ * <p>
+ * This is used to lookup any part of the formatter needing specific
+ * localization, such as the text or localized pattern. If the locale contains the
+ * "ca" (calendar), "nu" (numbering system) and/or
+ * "tz" (timezone)
+ * <a href="../../util/Locale.html#def_locale_extension">Unicode extensions</a>,
+ * the chronology, numbering system and/or the zone are overridden.
+ * <p>
+ * Unlike the {@link #withLocale withLocale} method, the call to this method may
+ * produce a different formatter depending on the order of method chaining with
+ * other withXXXX() methods.
+ * <p>
+ * This instance is immutable and unaffected by this method call.
+ *
+ * @param locale the locale, not null
+ * @return a formatter based on this formatter with localized values of
+ * the calendar, decimal style and/or timezone, that superseded values in this
+ * formatter.
+ * @see #withLocale(Locale)
+ * @since 10
+ */
+ public DateTimeFormatter localizedBy(Locale locale) {
+ if (this.locale.equals(locale)) {
+ return this;
+ }
+
+ // Check for decimalStyle/chronology/timezone in locale object
+ Chronology c = locale.getUnicodeLocaleType("ca") != null ?
+ Chronology.ofLocale(locale) : chrono;
+ DecimalStyle ds = locale.getUnicodeLocaleType("nu") != null ?
+ DecimalStyle.of(locale) : decimalStyle;
+ String tzType = locale.getUnicodeLocaleType("tz");
+ ZoneId z = tzType != null ?
+ // Android changed: Use ICU on Android.
+ // TimeZoneNameUtility.convertLDMLShortID(tzType)
+ Optional.ofNullable(ICU.convertToTzId(tzType))
+ .map(ZoneId::of)
+ .orElse(zone) :
+ zone;
+ return new DateTimeFormatter(printerParser, locale, ds, resolverStyle, resolverFields, c, z);
+ }
+
//-----------------------------------------------------------------------
/**
* Gets the DecimalStyle to be used during formatting.
@@ -1648,6 +1742,7 @@
public DateTimeFormatter withResolverFields(TemporalField... resolverFields) {
Set<TemporalField> fields = null;
if (resolverFields != null) {
+ // Set.of cannot be used because it is hostile to nulls and duplicate elements
fields = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(resolverFields)));
}
if (Objects.equals(this.resolverFields, fields)) {
diff --git a/ojluni/src/main/java/java/time/format/DateTimeFormatterBuilder.java b/ojluni/src/main/java/java/time/format/DateTimeFormatterBuilder.java
index fde036a..921d73c 100644
--- a/ojluni/src/main/java/java/time/format/DateTimeFormatterBuilder.java
+++ b/ojluni/src/main/java/java/time/format/DateTimeFormatterBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
*
* Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
*
- * All rights hg qreserved.
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -76,6 +76,7 @@
import static java.time.temporal.ChronoField.OFFSET_SECONDS;
import static java.time.temporal.ChronoField.SECOND_OF_MINUTE;
import static java.time.temporal.ChronoField.YEAR;
+import static java.time.temporal.ChronoField.ERA;
import com.android.icu.util.ExtendedCalendar;
@@ -90,14 +91,18 @@
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
+import java.time.LocalTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.chrono.ChronoLocalDate;
+import java.time.chrono.ChronoLocalDateTime;
import java.time.chrono.Chronology;
+import java.time.chrono.Era;
import java.time.chrono.IsoChronology;
import java.time.format.DateTimeTextProvider.LocaleStore;
import java.time.temporal.ChronoField;
import java.time.temporal.IsoFields;
+import java.time.temporal.JulianFields;
import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalField;
import java.time.temporal.TemporalQueries;
@@ -193,6 +198,7 @@
*/
private int valueParserIndex = -1;
+ // Android-changed: Remove "rg" extension support in the javadoc. See http://b/228322300.
/**
* Gets the formatting pattern for date and time styles for a locale and chronology.
* The locale and chronology are used to lookup the locale specific format
@@ -214,10 +220,11 @@
}
// BEGIN Android-changed: get format string from ICU.
- // LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased()
- // .getLocaleResources(locale);
- // String pattern = lr.getJavaTimeDateTimePattern(
- // convertStyle(timeStyle), convertStyle(dateStyle), chrono.getCalendarType());
+ // LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(JavaTimeDateTimePatternProvider.class, locale);
+ // JavaTimeDateTimePatternProvider provider = adapter.getJavaTimeDateTimePatternProvider();
+ // String pattern = provider.getJavaTimeDateTimePattern(convertStyle(timeStyle),
+ // convertStyle(dateStyle), chrono.getCalendarType(),
+ // CalendarDataUtility.findRegionOverride(locale));
// "iso8601" calendar type doesn't work well for ICU due to http://b/206566562.
// Workaround the issue by using Gregorian calendar.
@@ -670,6 +677,7 @@
}
//-----------------------------------------------------------------------
+ // Android changed: Fix the javadoc by adding # symbol before the method signature.
/**
* Appends the fractional value of a date-time field to the formatter.
* <p>
@@ -684,8 +692,11 @@
* No rounding occurs due to the maximum width - digits are simply dropped.
* <p>
* When parsing in strict mode, the number of parsed digits must be between
- * the minimum and maximum width. When parsing in lenient mode, the minimum
- * width is considered to be zero and the maximum is nine.
+ * the minimum and maximum width. In strict mode, if the minimum and maximum widths
+ * are equal and there is no decimal point then the parser will
+ * participate in adjacent value parsing, see
+ * {@link #appendValue(java.time.temporal.TemporalField, int)}. When parsing in lenient mode,
+ * the minimum width is considered to be zero and the maximum is nine.
* <p>
* If the value cannot be obtained then an exception will be thrown.
* If the value is negative an exception will be thrown.
@@ -704,7 +715,12 @@
*/
public DateTimeFormatterBuilder appendFraction(
TemporalField field, int minWidth, int maxWidth, boolean decimalPoint) {
- appendInternal(new FractionPrinterParser(field, minWidth, maxWidth, decimalPoint));
+ if (minWidth == maxWidth && decimalPoint == false) {
+ // adjacent parsing
+ appendValue(new FractionPrinterParser(field, minWidth, maxWidth, decimalPoint));
+ } else {
+ appendInternal(new FractionPrinterParser(field, minWidth, maxWidth, decimalPoint));
+ }
return this;
}
@@ -792,11 +808,22 @@
final LocaleStore store = new LocaleStore(map);
DateTimeTextProvider provider = new DateTimeTextProvider() {
@Override
+ public String getText(Chronology chrono, TemporalField field,
+ long value, TextStyle style, Locale locale) {
+ return store.getText(value, style);
+ }
+ @Override
public String getText(TemporalField field, long value, TextStyle style, Locale locale) {
return store.getText(value, style);
}
@Override
- public Iterator<Entry<String, Long>> getTextIterator(TemporalField field, TextStyle style, Locale locale) {
+ public Iterator<Entry<String, Long>> getTextIterator(Chronology chrono,
+ TemporalField field, TextStyle style, Locale locale) {
+ return store.getTextIterator(style);
+ }
+ @Override
+ public Iterator<Entry<String, Long>> getTextIterator(TemporalField field,
+ TextStyle style, Locale locale) {
return store.getTextIterator(style);
}
};
@@ -813,11 +840,11 @@
* They are converted to a date-time with a zone-offset of UTC and formatted
* using the standard ISO-8601 format.
* With this method, formatting nano-of-second outputs zero, three, six
- * or nine digits digits as necessary.
+ * or nine digits as necessary.
* The localized decimal style is not used.
* <p>
* The instant is obtained using {@link ChronoField#INSTANT_SECONDS INSTANT_SECONDS}
- * and optionally (@code NANO_OF_SECOND). The value of {@code INSTANT_SECONDS}
+ * and optionally {@code NANO_OF_SECOND}. The value of {@code INSTANT_SECONDS}
* may be outside the maximum range of {@code LocalDateTime}.
* <p>
* The {@linkplain ResolverStyle resolver style} has no effect on instant parsing.
@@ -855,7 +882,7 @@
* digits from zero to nine are accepted.
* <p>
* The instant is obtained using {@link ChronoField#INSTANT_SECONDS INSTANT_SECONDS}
- * and optionally (@code NANO_OF_SECOND). The value of {@code INSTANT_SECONDS}
+ * and optionally {@code NANO_OF_SECOND}. The value of {@code INSTANT_SECONDS}
* may be outside the maximum range of {@code LocalDateTime}.
* <p>
* The {@linkplain ResolverStyle resolver style} has no effect on instant parsing.
@@ -869,6 +896,7 @@
* @param fractionalDigits the number of fractional second digits to format with,
* from 0 to 9, or -1 to use as many digits as necessary
* @return this, for chaining, not null
+ * @throws IllegalArgumentException if the number of fractional digits is invalid
*/
public DateTimeFormatterBuilder appendInstant(int fractionalDigits) {
if (fractionalDigits < -1 || fractionalDigits > 9) {
@@ -883,7 +911,9 @@
* Appends the zone offset, such as '+01:00', to the formatter.
* <p>
* This appends an instruction to format/parse the offset ID to the builder.
- * This is equivalent to calling {@code appendOffset("+HH:MM:ss", "Z")}.
+ * This is equivalent to calling {@code appendOffset("+HH:mm:ss", "Z")}.
+ * See {@link #appendOffset(String, String)} for details on formatting
+ * and parsing.
*
* @return this, for chaining, not null
*/
@@ -903,9 +933,18 @@
* If the offset cannot be obtained then an exception is thrown unless the
* section of the formatter is optional.
* <p>
- * During parsing, the offset is parsed using the format defined below.
- * If the offset cannot be parsed then an exception is thrown unless the
- * section of the formatter is optional.
+ * When parsing in strict mode, the input must contain the mandatory
+ * and optional elements are defined by the specified pattern.
+ * If the offset cannot be parsed then an exception is thrown unless
+ * the section of the formatter is optional.
+ * <p>
+ * When parsing in lenient mode, only the hours are mandatory - minutes
+ * and seconds are optional. The colons are required if the specified
+ * pattern contains a colon. If the specified pattern is "+HH", the
+ * presence of colons is determined by whether the character after the
+ * hour digits is a colon or not.
+ * If the offset cannot be parsed then an exception is thrown unless
+ * the section of the formatter is optional.
* <p>
* The format of the offset is controlled by a pattern which must be one
* of the following:
@@ -919,7 +958,28 @@
* <li>{@code +HH:MM:ss} - hour and minute, with second if non-zero, with colon
* <li>{@code +HHMMSS} - hour, minute and second, no colon
* <li>{@code +HH:MM:SS} - hour, minute and second, with colon
+ * <li>{@code +HHmmss} - hour, with minute if non-zero or with minute and
+ * second if non-zero, no colon
+ * <li>{@code +HH:mm:ss} - hour, with minute if non-zero or with minute and
+ * second if non-zero, with colon
+ * <li>{@code +H} - hour only, ignoring minute and second
+ * <li>{@code +Hmm} - hour, with minute if non-zero, ignoring second, no colon
+ * <li>{@code +H:mm} - hour, with minute if non-zero, ignoring second, with colon
+ * <li>{@code +HMM} - hour and minute, ignoring second, no colon
+ * <li>{@code +H:MM} - hour and minute, ignoring second, with colon
+ * <li>{@code +HMMss} - hour and minute, with second if non-zero, no colon
+ * <li>{@code +H:MM:ss} - hour and minute, with second if non-zero, with colon
+ * <li>{@code +HMMSS} - hour, minute and second, no colon
+ * <li>{@code +H:MM:SS} - hour, minute and second, with colon
+ * <li>{@code +Hmmss} - hour, with minute if non-zero or with minute and
+ * second if non-zero, no colon
+ * <li>{@code +H:mm:ss} - hour, with minute if non-zero or with minute and
+ * second if non-zero, with colon
* </ul>
+ * Patterns containing "HH" will format and parse a two digit hour,
+ * zero-padded if necessary. Patterns containing "H" will format with no
+ * zero-padding, and parse either one or two digits.
+ * In lenient mode, the parser will be greedy and parse the maximum digits possible.
* The "no offset" text controls what text is printed when the total amount of
* the offset fields to be output is zero.
* Example values would be 'Z', '+00:00', 'UTC' or 'GMT'.
@@ -929,6 +989,7 @@
* @param pattern the pattern to use, not null
* @param noOffsetText the text to use when the offset is zero, not null
* @return this, for chaining, not null
+ * @throws IllegalArgumentException if the pattern is invalid
*/
public DateTimeFormatterBuilder appendOffset(String pattern, String noOffsetText) {
appendInternal(new OffsetIdPrinterParser(pattern, noOffsetText));
@@ -958,7 +1019,7 @@
* During parsing, the offset is parsed using the format defined above.
* If the offset cannot be parsed then an exception is thrown unless the
* section of the formatter is optional.
- * <p>
+ *
* @param style the format style to use, not null
* @return this, for chaining, not null
* @throws IllegalArgumentException if style is neither {@link TextStyle#FULL
@@ -1149,10 +1210,11 @@
* result of {@link ZoneOffset#getId()}.
* If the zone is not an offset, the textual name will be looked up
* for the locale set in the {@link DateTimeFormatter}.
- * If the temporal object being printed represents an instant, then the text
- * will be the summer or winter time text as appropriate.
+ * If the temporal object being printed represents an instant, or if it is a
+ * local date-time that is not in a daylight saving gap or overlap then
+ * the text will be the summer or winter time text as appropriate.
* If the lookup for text does not find any suitable result, then the
- * {@link ZoneId#getId() ID} will be printed instead.
+ * {@link ZoneId#getId() ID} will be printed.
* If the zone cannot be obtained then an exception is thrown unless the
* section of the formatter is optional.
* <p>
@@ -1169,7 +1231,7 @@
* @return this, for chaining, not null
*/
public DateTimeFormatterBuilder appendZoneText(TextStyle textStyle) {
- appendInternal(new ZoneTextPrinterParser(textStyle, null));
+ appendInternal(new ZoneTextPrinterParser(textStyle, null, false));
return this;
}
@@ -1185,10 +1247,11 @@
* result of {@link ZoneOffset#getId()}.
* If the zone is not an offset, the textual name will be looked up
* for the locale set in the {@link DateTimeFormatter}.
- * If the temporal object being printed represents an instant, then the text
+ * If the temporal object being printed represents an instant, or if it is a
+ * local date-time that is not in a daylight saving gap or overlap, then the text
* will be the summer or winter time text as appropriate.
* If the lookup for text does not find any suitable result, then the
- * {@link ZoneId#getId() ID} will be printed instead.
+ * {@link ZoneId#getId() ID} will be printed.
* If the zone cannot be obtained then an exception is thrown unless the
* section of the formatter is optional.
* <p>
@@ -1212,7 +1275,72 @@
public DateTimeFormatterBuilder appendZoneText(TextStyle textStyle,
Set<ZoneId> preferredZones) {
Objects.requireNonNull(preferredZones, "preferredZones");
- appendInternal(new ZoneTextPrinterParser(textStyle, preferredZones));
+ appendInternal(new ZoneTextPrinterParser(textStyle, preferredZones, false));
+ return this;
+ }
+ //----------------------------------------------------------------------
+ /**
+ * Appends the generic time-zone name, such as 'Pacific Time', to the formatter.
+ * <p>
+ * This appends an instruction to format/parse the generic textual
+ * name of the zone to the builder. The generic name is the same throughout the whole
+ * year, ignoring any daylight saving changes. For example, 'Pacific Time' is the
+ * generic name, whereas 'Pacific Standard Time' and 'Pacific Daylight Time' are the
+ * specific names, see {@link #appendZoneText(TextStyle)}.
+ * <p>
+ * During formatting, the zone is obtained using a mechanism equivalent
+ * to querying the temporal with {@link TemporalQueries#zoneId()}.
+ * If the zone is a {@code ZoneOffset} it will be printed using the
+ * result of {@link ZoneOffset#getId()}.
+ * If the zone is not an offset, the textual name will be looked up
+ * for the locale set in the {@link DateTimeFormatter}.
+ * If the lookup for text does not find any suitable result, then the
+ * {@link ZoneId#getId() ID} will be printed.
+ * If the zone cannot be obtained then an exception is thrown unless the
+ * section of the formatter is optional.
+ * <p>
+ * During parsing, either the textual zone name, the zone ID or the offset
+ * is accepted. Many textual zone names are not unique, such as CST can be
+ * for both "Central Standard Time" and "China Standard Time". In this
+ * situation, the zone id will be determined by the region information from
+ * formatter's {@link DateTimeFormatter#getLocale() locale} and the standard
+ * zone id for that area, for example, America/New_York for the America Eastern zone.
+ * The {@link #appendGenericZoneText(TextStyle, Set)} may be used
+ * to specify a set of preferred {@link ZoneId} in this situation.
+ *
+ * @param textStyle the text style to use, not null
+ * @return this, for chaining, not null
+ * @since 9
+ */
+ public DateTimeFormatterBuilder appendGenericZoneText(TextStyle textStyle) {
+ appendInternal(new ZoneTextPrinterParser(textStyle, null, true));
+ return this;
+ }
+
+ /**
+ * Appends the generic time-zone name, such as 'Pacific Time', to the formatter.
+ * <p>
+ * This appends an instruction to format/parse the generic textual
+ * name of the zone to the builder. The generic name is the same throughout the whole
+ * year, ignoring any daylight saving changes. For example, 'Pacific Time' is the
+ * generic name, whereas 'Pacific Standard Time' and 'Pacific Daylight Time' are the
+ * specific names, see {@link #appendZoneText(TextStyle)}.
+ * <p>
+ * This method also allows a set of preferred {@link ZoneId} to be
+ * specified for parsing. The matched preferred zone id will be used if the
+ * textural zone name being parsed is not unique.
+ * <p>
+ * See {@link #appendGenericZoneText(TextStyle)} for details about
+ * formatting and parsing.
+ *
+ * @param textStyle the text style to use, not null
+ * @param preferredZones the set of preferred zone ids, not null
+ * @return this, for chaining, not null
+ * @since 9
+ */
+ public DateTimeFormatterBuilder appendGenericZoneText(TextStyle textStyle,
+ Set<ZoneId> preferredZones) {
+ appendInternal(new ZoneTextPrinterParser(textStyle, preferredZones, true));
return this;
}
@@ -1272,6 +1400,9 @@
* During formatting, the chronology is obtained from the temporal object
* being formatted, which may have been overridden by
* {@link DateTimeFormatter#withChronology(Chronology)}.
+ * The {@code FULL} and {@code LONG} styles typically require a time-zone.
+ * When formatting using these styles, a {@code ZoneId} must be available,
+ * either by using {@code ZonedDateTime} or {@link DateTimeFormatter#withZone}.
* <p>
* During parsing, if a chronology has already been parsed, then it is used.
* Otherwise the default from {@code DateTimeFormatter.withChronology(Chronology)}
@@ -1319,7 +1450,7 @@
*/
public DateTimeFormatterBuilder appendLiteral(String literal) {
Objects.requireNonNull(literal, "literal");
- if (literal.length() > 0) {
+ if (!literal.isEmpty()) {
if (literal.length() == 1) {
appendInternal(new CharLiteralPrinterParser(literal.charAt(0)));
} else {
@@ -1381,6 +1512,7 @@
* D day-of-year number 189
* M/L month-of-year number/text 7; 07; Jul; July; J
* d day-of-month number 10
+ * g modified-julian-day number 2451334
*
* Q/q quarter-of-year number/text 3; 03; Q3; 3rd quarter
* Y week-based-year year 1996; 96
@@ -1388,12 +1520,12 @@
* W week-of-month number 4
* E day-of-week text Tue; Tuesday; T
* e/c localized day-of-week number/text 2; 02; Tue; Tuesday; T
- * F week-of-month number 3
+ * F day-of-week-in-month number 3
*
* a am-pm-of-day text PM
* h clock-hour-of-am-pm (1-12) number 12
* K hour-of-am-pm (0-11) number 0
- * k clock-hour-of-am-pm (1-24) number 0
+ * k clock-hour-of-day (1-24) number 24
*
* H hour-of-day (0-23) number 0
* m minute-of-hour number 30
@@ -1404,11 +1536,12 @@
* N nano-of-day number 1234000000
*
* V time-zone ID zone-id America/Los_Angeles; Z; -08:30
+ * v generic time-zone name zone-name PT, Pacific Time
* z time-zone name zone-name Pacific Standard Time; PST
* O localized zone-offset offset-O GMT+8; GMT+08:00; UTC-08:00;
- * X zone-offset 'Z' for zero offset-X Z; -08; -0830; -08:30; -083015; -08:30:15;
- * x zone-offset offset-x +0000; -08; -0830; -08:30; -083015; -08:30:15;
- * Z zone-offset offset-Z +0000; -0800; -08:00;
+ * X zone-offset 'Z' for zero offset-X Z; -08; -0830; -08:30; -083015; -08:30:15
+ * x zone-offset offset-x +0000; -08; -0830; -08:30; -083015; -08:30:15
+ * Z zone-offset offset-Z +0000; -0800; -08:00
*
* p pad next pad modifier 1
*
@@ -1435,37 +1568,37 @@
* GGGG 4 appendText(ChronoField.ERA, TextStyle.FULL)
* GGGGG 5 appendText(ChronoField.ERA, TextStyle.NARROW)
*
- * u 1 appendValue(ChronoField.YEAR, 1, 19, SignStyle.NORMAL);
- * uu 2 appendValueReduced(ChronoField.YEAR, 2, 2000);
- * uuu 3 appendValue(ChronoField.YEAR, 3, 19, SignStyle.NORMAL);
- * u..u 4..n appendValue(ChronoField.YEAR, n, 19, SignStyle.EXCEEDS_PAD);
- * y 1 appendValue(ChronoField.YEAR_OF_ERA, 1, 19, SignStyle.NORMAL);
- * yy 2 appendValueReduced(ChronoField.YEAR_OF_ERA, 2, 2000);
- * yyy 3 appendValue(ChronoField.YEAR_OF_ERA, 3, 19, SignStyle.NORMAL);
- * y..y 4..n appendValue(ChronoField.YEAR_OF_ERA, n, 19, SignStyle.EXCEEDS_PAD);
+ * u 1 appendValue(ChronoField.YEAR, 1, 19, SignStyle.NORMAL)
+ * uu 2 appendValueReduced(ChronoField.YEAR, 2, 2000)
+ * uuu 3 appendValue(ChronoField.YEAR, 3, 19, SignStyle.NORMAL)
+ * u..u 4..n appendValue(ChronoField.YEAR, n, 19, SignStyle.EXCEEDS_PAD)
+ * y 1 appendValue(ChronoField.YEAR_OF_ERA, 1, 19, SignStyle.NORMAL)
+ * yy 2 appendValueReduced(ChronoField.YEAR_OF_ERA, 2, 2000)
+ * yyy 3 appendValue(ChronoField.YEAR_OF_ERA, 3, 19, SignStyle.NORMAL)
+ * y..y 4..n appendValue(ChronoField.YEAR_OF_ERA, n, 19, SignStyle.EXCEEDS_PAD)
* Y 1 append special localized WeekFields element for numeric week-based-year
- * YY 2 append special localized WeekFields element for reduced numeric week-based-year 2 digits;
- * YYY 3 append special localized WeekFields element for numeric week-based-year (3, 19, SignStyle.NORMAL);
- * Y..Y 4..n append special localized WeekFields element for numeric week-based-year (n, 19, SignStyle.EXCEEDS_PAD);
+ * YY 2 append special localized WeekFields element for reduced numeric week-based-year 2 digits
+ * YYY 3 append special localized WeekFields element for numeric week-based-year (3, 19, SignStyle.NORMAL)
+ * Y..Y 4..n append special localized WeekFields element for numeric week-based-year (n, 19, SignStyle.EXCEEDS_PAD)
*
- * Q 1 appendValue(IsoFields.QUARTER_OF_YEAR);
- * QQ 2 appendValue(IsoFields.QUARTER_OF_YEAR, 2);
+ * Q 1 appendValue(IsoFields.QUARTER_OF_YEAR)
+ * QQ 2 appendValue(IsoFields.QUARTER_OF_YEAR, 2)
* QQQ 3 appendText(IsoFields.QUARTER_OF_YEAR, TextStyle.SHORT)
* QQQQ 4 appendText(IsoFields.QUARTER_OF_YEAR, TextStyle.FULL)
* QQQQQ 5 appendText(IsoFields.QUARTER_OF_YEAR, TextStyle.NARROW)
- * q 1 appendValue(IsoFields.QUARTER_OF_YEAR);
- * qq 2 appendValue(IsoFields.QUARTER_OF_YEAR, 2);
+ * q 1 appendValue(IsoFields.QUARTER_OF_YEAR)
+ * qq 2 appendValue(IsoFields.QUARTER_OF_YEAR, 2)
* qqq 3 appendText(IsoFields.QUARTER_OF_YEAR, TextStyle.SHORT_STANDALONE)
* qqqq 4 appendText(IsoFields.QUARTER_OF_YEAR, TextStyle.FULL_STANDALONE)
* qqqqq 5 appendText(IsoFields.QUARTER_OF_YEAR, TextStyle.NARROW_STANDALONE)
*
- * M 1 appendValue(ChronoField.MONTH_OF_YEAR);
- * MM 2 appendValue(ChronoField.MONTH_OF_YEAR, 2);
+ * M 1 appendValue(ChronoField.MONTH_OF_YEAR)
+ * MM 2 appendValue(ChronoField.MONTH_OF_YEAR, 2)
* MMM 3 appendText(ChronoField.MONTH_OF_YEAR, TextStyle.SHORT)
* MMMM 4 appendText(ChronoField.MONTH_OF_YEAR, TextStyle.FULL)
* MMMMM 5 appendText(ChronoField.MONTH_OF_YEAR, TextStyle.NARROW)
- * L 1 appendValue(ChronoField.MONTH_OF_YEAR);
- * LL 2 appendValue(ChronoField.MONTH_OF_YEAR, 2);
+ * L 1 appendValue(ChronoField.MONTH_OF_YEAR)
+ * LL 2 appendValue(ChronoField.MONTH_OF_YEAR, 2)
* LLL 3 appendText(ChronoField.MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE)
* LLLL 4 appendText(ChronoField.MONTH_OF_YEAR, TextStyle.FULL_STANDALONE)
* LLLLL 5 appendText(ChronoField.MONTH_OF_YEAR, TextStyle.NARROW_STANDALONE)
@@ -1476,9 +1609,10 @@
* d 1 appendValue(ChronoField.DAY_OF_MONTH)
* dd 2 appendValue(ChronoField.DAY_OF_MONTH, 2)
* D 1 appendValue(ChronoField.DAY_OF_YEAR)
- * DD 2 appendValue(ChronoField.DAY_OF_YEAR, 2)
+ * DD 2 appendValue(ChronoField.DAY_OF_YEAR, 2, 3, SignStyle.NOT_NEGATIVE)
* DDD 3 appendValue(ChronoField.DAY_OF_YEAR, 3)
* F 1 appendValue(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH)
+ * g..g 1..n appendValue(JulianFields.MODIFIED_JULIAN_DAY, n, 19, SignStyle.NORMAL)
* E 1 appendText(ChronoField.DAY_OF_WEEK, TextStyle.SHORT)
* EE 2 appendText(ChronoField.DAY_OF_WEEK, TextStyle.SHORT)
* EEE 3 appendText(ChronoField.DAY_OF_WEEK, TextStyle.SHORT)
@@ -1514,12 +1648,9 @@
* ss 2 appendValue(ChronoField.SECOND_OF_MINUTE, 2)
*
* S..S 1..n appendFraction(ChronoField.NANO_OF_SECOND, n, n, false)
- * A 1 appendValue(ChronoField.MILLI_OF_DAY)
- * A..A 2..n appendValue(ChronoField.MILLI_OF_DAY, n)
- * n 1 appendValue(ChronoField.NANO_OF_SECOND)
- * n..n 2..n appendValue(ChronoField.NANO_OF_SECOND, n)
- * N 1 appendValue(ChronoField.NANO_OF_DAY)
- * N..N 2..n appendValue(ChronoField.NANO_OF_DAY, n)
+ * A..A 1..n appendValue(ChronoField.MILLI_OF_DAY, n, 19, SignStyle.NOT_NEGATIVE)
+ * n..n 1..n appendValue(ChronoField.NANO_OF_SECOND, n, 19, SignStyle.NOT_NEGATIVE)
+ * N..N 1..n appendValue(ChronoField.NANO_OF_DAY, n, 19, SignStyle.NOT_NEGATIVE)
* </pre>
* <p>
* <b>Zone ID</b>: Pattern letters to output {@code ZoneId}.
@@ -1527,6 +1658,8 @@
* Pattern Count Equivalent builder methods
* ------- ----- --------------------------
* VV 2 appendZoneId()
+ * v 1 appendGenericZoneText(TextStyle.SHORT)
+ * vvvv 4 appendGenericZoneText(TextStyle.FULL)
* z 1 appendZoneText(TextStyle.SHORT)
* zz 2 appendZoneText(TextStyle.SHORT)
* zzz 3 appendZoneText(TextStyle.SHORT)
@@ -1537,8 +1670,8 @@
* <pre>
* Pattern Count Equivalent builder methods
* ------- ----- --------------------------
- * O 1 appendLocalizedOffsetPrefixed(TextStyle.SHORT);
- * OOOO 4 appendLocalizedOffsetPrefixed(TextStyle.FULL);
+ * O 1 appendLocalizedOffset(TextStyle.SHORT)
+ * OOOO 4 appendLocalizedOffset(TextStyle.FULL)
* X 1 appendOffset("+HHmm","Z")
* XX 2 appendOffset("+HHMM","Z")
* XXX 3 appendOffset("+HH:MM","Z")
@@ -1552,7 +1685,7 @@
* Z 1 appendOffset("+HHMM","+0000")
* ZZ 2 appendOffset("+HHMM","+0000")
* ZZZ 3 appendOffset("+HHMM","+0000")
- * ZZZZ 4 appendLocalizedOffset(TextStyle.FULL);
+ * ZZZZ 4 appendLocalizedOffset(TextStyle.FULL)
* ZZZZZ 5 appendOffset("+HH:MM:ss","Z")
* </pre>
* <p>
@@ -1633,6 +1766,14 @@
throw new IllegalArgumentException("Pattern letter count must be 2: " + cur);
}
appendZoneId();
+ } else if (cur == 'v') {
+ if (count == 1) {
+ appendGenericZoneText(TextStyle.SHORT);
+ } else if (count == 4) {
+ appendGenericZoneText(TextStyle.FULL);
+ } else {
+ throw new IllegalArgumentException("Wrong number of pattern letters: " + cur);
+ }
} else if (cur == 'Z') {
if (count < 4) {
appendOffset("+HHMM", "+0000");
@@ -1667,16 +1808,20 @@
if (count > 1) {
throw new IllegalArgumentException("Too many pattern letters: " + cur);
}
- appendInternal(new WeekBasedFieldPrinterParser(cur, count));
+ appendValue(new WeekBasedFieldPrinterParser(cur, count, count, count));
} else if (cur == 'w') {
// Fields defined by Locale
if (count > 2) {
throw new IllegalArgumentException("Too many pattern letters: " + cur);
}
- appendInternal(new WeekBasedFieldPrinterParser(cur, count));
+ appendValue(new WeekBasedFieldPrinterParser(cur, count, count, 2));
} else if (cur == 'Y') {
// Fields defined by Locale
- appendInternal(new WeekBasedFieldPrinterParser(cur, count));
+ if (count == 2) {
+ appendValue(new WeekBasedFieldPrinterParser(cur, count, count, 2));
+ } else {
+ appendValue(new WeekBasedFieldPrinterParser(cur, count, count, 19));
+ }
} else {
throw new IllegalArgumentException("Unknown pattern letter: " + cur);
}
@@ -1698,7 +1843,7 @@
throw new IllegalArgumentException("Pattern ends with an incomplete string literal: " + pattern);
}
String str = pattern.substring(start + 1, pos);
- if (str.length() == 0) {
+ if (str.isEmpty()) {
appendLiteral('\'');
} else {
appendLiteral(str.replace("''", "'"));
@@ -1736,7 +1881,10 @@
}
break;
case 'c':
- if (count == 2) {
+ if (count == 1) {
+ appendValue(new WeekBasedFieldPrinterParser(cur, count, count, count));
+ break;
+ } else if (count == 2) {
throw new IllegalArgumentException("Invalid pattern \"cc\"");
}
/*fallthrough*/
@@ -1751,8 +1899,8 @@
switch (count) {
case 1:
case 2:
- if (cur == 'c' || cur == 'e') {
- appendInternal(new WeekBasedFieldPrinterParser(cur, count));
+ if (cur == 'e') {
+ appendValue(new WeekBasedFieldPrinterParser(cur, count, count, count));
} else if (cur == 'E') {
appendText(field, TextStyle.SHORT);
} else {
@@ -1828,12 +1976,20 @@
case 'D':
if (count == 1) {
appendValue(field);
- } else if (count <= 3) {
- appendValue(field, count);
+ } else if (count == 2 || count == 3) {
+ appendValue(field, count, 3, SignStyle.NOT_NEGATIVE);
} else {
throw new IllegalArgumentException("Too many pattern letters: " + cur);
}
break;
+ case 'g':
+ appendValue(field, count, 19, SignStyle.NORMAL);
+ break;
+ case 'A':
+ case 'n':
+ case 'N':
+ appendValue(field, count, 19, SignStyle.NOT_NEGATIVE);
+ break;
default:
if (count == 1) {
appendValue(field);
@@ -1872,9 +2028,12 @@
FIELD_MAP.put('A', ChronoField.MILLI_OF_DAY); // LDML
FIELD_MAP.put('n', ChronoField.NANO_OF_SECOND); // 310 (proposed for LDML)
FIELD_MAP.put('N', ChronoField.NANO_OF_DAY); // 310 (proposed for LDML)
+ FIELD_MAP.put('g', JulianFields.MODIFIED_JULIAN_DAY);
// 310 - z - time-zone names, matches LDML and SimpleDateFormat 1 to 4
// 310 - Z - matches SimpleDateFormat and LDML
// 310 - V - time-zone id, matches LDML
+ // 310 - v - general timezone names, not matching exactly with LDML because LDML specify to fall back
+ // to 'VVVV' if general-nonlocation unavailable but here it's not falling back because of lack of data
// 310 - p - prefix for padding
// 310 - X - matches LDML, almost matches SDF for 1, exact match 2&3, extended 4&5
// 310 - x - matches LDML
@@ -1882,8 +2041,6 @@
// LDML - U - cycle year name, not supported by 310 yet
// LDML - l - deprecated
// LDML - j - not relevant
- // LDML - g - modified-julian-day
- // LDML - v,V - extended time-zone names
}
//-----------------------------------------------------------------------
@@ -2908,7 +3065,8 @@
@Override
public String toString() {
- return "ReducedValue(" + field + "," + minWidth + "," + maxWidth + "," + (baseDate != null ? baseDate : baseValue) + ")";
+ return "ReducedValue(" + field + "," + minWidth + "," + maxWidth +
+ "," + Objects.requireNonNullElse(baseDate, baseValue) + ")";
}
}
@@ -2916,10 +3074,7 @@
/**
* Prints and parses a numeric date-time field with optional padding.
*/
- static final class FractionPrinterParser implements DateTimePrinterParser {
- private final TemporalField field;
- private final int minWidth;
- private final int maxWidth;
+ static final class FractionPrinterParser extends NumberPrinterParser {
private final boolean decimalPoint;
/**
@@ -2931,6 +3086,7 @@
* @param decimalPoint whether to output the localized decimal point symbol
*/
FractionPrinterParser(TemporalField field, int minWidth, int maxWidth, boolean decimalPoint) {
+ this(field, minWidth, maxWidth, decimalPoint, 0);
Objects.requireNonNull(field, "field");
if (field.range().isFixed() == false) {
throw new IllegalArgumentException("Field must have a fixed set of values: " + field);
@@ -2945,12 +3101,61 @@
throw new IllegalArgumentException("Maximum width must exceed or equal the minimum width but " +
maxWidth + " < " + minWidth);
}
- this.field = field;
- this.minWidth = minWidth;
- this.maxWidth = maxWidth;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param field the field to output, not null
+ * @param minWidth the minimum width to output, from 0 to 9
+ * @param maxWidth the maximum width to output, from 0 to 9
+ * @param decimalPoint whether to output the localized decimal point symbol
+ * @param subsequentWidth the subsequentWidth for this instance
+ */
+ FractionPrinterParser(TemporalField field, int minWidth, int maxWidth, boolean decimalPoint, int subsequentWidth) {
+ super(field, minWidth, maxWidth, SignStyle.NOT_NEGATIVE, subsequentWidth);
this.decimalPoint = decimalPoint;
}
+ /**
+ * Returns a new instance with fixed width flag set.
+ *
+ * @return a new updated printer-parser, not null
+ */
+ @Override
+ FractionPrinterParser withFixedWidth() {
+ if (subsequentWidth == -1) {
+ return this;
+ }
+ return new FractionPrinterParser(field, minWidth, maxWidth, decimalPoint, -1);
+ }
+
+ /**
+ * Returns a new instance with an updated subsequent width.
+ *
+ * @param subsequentWidth the width of subsequent non-negative numbers, 0 or greater
+ * @return a new updated printer-parser, not null
+ */
+ @Override
+ FractionPrinterParser withSubsequentWidth(int subsequentWidth) {
+ return new FractionPrinterParser(field, minWidth, maxWidth, decimalPoint, this.subsequentWidth + subsequentWidth);
+ }
+
+ /**
+ * For FractionPrinterPrinterParser, the width is fixed if context is sttrict,
+ * minWidth equal to maxWidth and decimalpoint is absent.
+ * @param context the context
+ * @return if the field is fixed width
+ * @see DateTimeFormatterBuilder#appendValueFraction(java.time.temporal.TemporalField, int, int, boolean)
+ */
+ @Override
+ boolean isFixedWidth(DateTimeParseContext context) {
+ if (context.isStrict() && minWidth == maxWidth && decimalPoint == false) {
+ return true;
+ }
+ return false;
+ }
+
@Override
public boolean format(DateTimePrintContext context, StringBuilder buf) {
Long value = context.getValue(field);
@@ -2983,8 +3188,8 @@
@Override
public int parse(DateTimeParseContext context, CharSequence text, int position) {
- int effectiveMin = (context.isStrict() ? minWidth : 0);
- int effectiveMax = (context.isStrict() ? maxWidth : 9);
+ int effectiveMin = (context.isStrict() || isFixedWidth(context) ? minWidth : 0);
+ int effectiveMax = (context.isStrict() || isFixedWidth(context) ? maxWidth : 9);
int length = text.length();
if (position == length) {
// valid if whole field is optional, invalid if minimum width
@@ -3149,6 +3354,16 @@
return context.setParsedField(field, entry.getValue(), position, position + itText.length());
}
}
+ if (field == ERA && !context.isStrict()) {
+ // parse the possible era name from era.toString()
+ List<Era> eras = chrono.eras();
+ for (Era era : eras) {
+ String name = era.toString();
+ if (context.subSequenceEquals(name, 0, parseText, position, name.length())) {
+ return context.setParsedField(field, era.getValue(), position, position + name.length());
+ }
+ }
+ }
if (context.isStrict()) {
return ~position;
}
@@ -3320,13 +3535,15 @@
*/
static final class OffsetIdPrinterParser implements DateTimePrinterParser {
static final String[] PATTERNS = new String[] {
- "+HH", "+HHmm", "+HH:mm", "+HHMM", "+HH:MM", "+HHMMss", "+HH:MM:ss", "+HHMMSS", "+HH:MM:SS",
+ "+HH", "+HHmm", "+HH:mm", "+HHMM", "+HH:MM", "+HHMMss", "+HH:MM:ss", "+HHMMSS", "+HH:MM:SS", "+HHmmss", "+HH:mm:ss",
+ "+H", "+Hmm", "+H:mm", "+HMM", "+H:MM", "+HMMss", "+H:MM:ss", "+HMMSS", "+H:MM:SS", "+Hmmss", "+H:mm:ss",
}; // order used in pattern builder
static final OffsetIdPrinterParser INSTANCE_ID_Z = new OffsetIdPrinterParser("+HH:MM:ss", "Z");
static final OffsetIdPrinterParser INSTANCE_ID_ZERO = new OffsetIdPrinterParser("+HH:MM:ss", "0");
private final String noOffsetText;
private final int type;
+ private final int style;
/**
* Constructor.
@@ -3338,6 +3555,7 @@
Objects.requireNonNull(pattern, "pattern");
Objects.requireNonNull(noOffsetText, "noOffsetText");
this.type = checkPattern(pattern);
+ this.style = type % 11;
this.noOffsetText = noOffsetText;
}
@@ -3350,6 +3568,14 @@
throw new IllegalArgumentException("Invalid zone offset pattern: " + pattern);
}
+ private boolean isPaddedHour() {
+ return type < 11;
+ }
+
+ private boolean isColon() {
+ return style > 0 && (style % 2) == 0;
+ }
+
@Override
public boolean format(DateTimePrintContext context, StringBuilder buf) {
Long offsetSecs = context.getValue(OFFSET_SECONDS);
@@ -3365,15 +3591,17 @@
int absSeconds = Math.abs(totalSecs % 60);
int bufPos = buf.length();
int output = absHours;
- buf.append(totalSecs < 0 ? "-" : "+")
- .append((char) (absHours / 10 + '0')).append((char) (absHours % 10 + '0'));
- if (type >= 3 || (type >= 1 && absMinutes > 0)) {
- buf.append((type % 2) == 0 ? ":" : "")
- .append((char) (absMinutes / 10 + '0')).append((char) (absMinutes % 10 + '0'));
+ buf.append(totalSecs < 0 ? "-" : "+");
+ if (isPaddedHour() || absHours >= 10) {
+ formatZeroPad(false, absHours, buf);
+ } else {
+ buf.append((char) (absHours + '0'));
+ }
+ if ((style >= 3 && style <= 8) || (style >= 9 && absSeconds > 0) || (style >= 1 && absMinutes > 0)) {
+ formatZeroPad(isColon(), absMinutes, buf);
output += absMinutes;
- if (type >= 7 || (type >= 5 && absSeconds > 0)) {
- buf.append((type % 2) == 0 ? ":" : "")
- .append((char) (absSeconds / 10 + '0')).append((char) (absSeconds % 10 + '0'));
+ if (style == 7 || style == 8 || (style >= 5 && absSeconds > 0)) {
+ formatZeroPad(isColon(), absSeconds, buf);
output += absSeconds;
}
}
@@ -3385,6 +3613,12 @@
return true;
}
+ private void formatZeroPad(boolean colon, int value, StringBuilder buf) {
+ buf.append(colon ? ":" : "")
+ .append((char) (value / 10 + '0'))
+ .append((char) (value % 10 + '0'));
+ }
+
@Override
public int parse(DateTimeParseContext context, CharSequence text, int position) {
int length = text.length();
@@ -3407,58 +3641,210 @@
if (sign == '+' || sign == '-') {
// starts
int negative = (sign == '-' ? -1 : 1);
+ boolean isColon = isColon();
+ boolean paddedHour = isPaddedHour();
int[] array = new int[4];
array[0] = position + 1;
- if ((parseNumber(array, 1, text, true) ||
- parseNumber(array, 2, text, type >=3) ||
- parseNumber(array, 3, text, false)) == false) {
- // success
+ int parseType = type;
+ // select parse type when lenient
+ if (!context.isStrict()) {
+ if (paddedHour) {
+ if (isColon || (parseType == 0 && length > position + 3 && text.charAt(position + 3) == ':')) {
+ isColon = true; // needed in cases like ("+HH", "+01:01")
+ parseType = 10;
+ } else {
+ parseType = 9;
+ }
+ } else {
+ if (isColon || (parseType == 11 && length > position + 3 && (text.charAt(position + 2) == ':' || text.charAt(position + 3) == ':'))) {
+ isColon = true;
+ parseType = 21; // needed in cases like ("+H", "+1:01")
+ } else {
+ parseType = 20;
+ }
+ }
+ }
+ // parse according to the selected pattern
+ switch (parseType) {
+ case 0: // +HH
+ case 11: // +H
+ parseHour(text, paddedHour, array);
+ break;
+ case 1: // +HHmm
+ case 2: // +HH:mm
+ case 13: // +H:mm
+ parseHour(text, paddedHour, array);
+ parseMinute(text, isColon, false, array);
+ break;
+ case 3: // +HHMM
+ case 4: // +HH:MM
+ case 15: // +H:MM
+ parseHour(text, paddedHour, array);
+ parseMinute(text, isColon, true, array);
+ break;
+ case 5: // +HHMMss
+ case 6: // +HH:MM:ss
+ case 17: // +H:MM:ss
+ parseHour(text, paddedHour, array);
+ parseMinute(text, isColon, true, array);
+ parseSecond(text, isColon, false, array);
+ break;
+ case 7: // +HHMMSS
+ case 8: // +HH:MM:SS
+ case 19: // +H:MM:SS
+ parseHour(text, paddedHour, array);
+ parseMinute(text, isColon, true, array);
+ parseSecond(text, isColon, true, array);
+ break;
+ case 9: // +HHmmss
+ case 10: // +HH:mm:ss
+ case 21: // +H:mm:ss
+ parseHour(text, paddedHour, array);
+ parseOptionalMinuteSecond(text, isColon, array);
+ break;
+ case 12: // +Hmm
+ parseVariableWidthDigits(text, 1, 4, array);
+ break;
+ case 14: // +HMM
+ parseVariableWidthDigits(text, 3, 4, array);
+ break;
+ case 16: // +HMMss
+ parseVariableWidthDigits(text, 3, 6, array);
+ break;
+ case 18: // +HMMSS
+ parseVariableWidthDigits(text, 5, 6, array);
+ break;
+ case 20: // +Hmmss
+ parseVariableWidthDigits(text, 1, 6, array);
+ break;
+ }
+ if (array[0] > 0) {
+ if (array[1] > 23 || array[2] > 59 || array[3] > 59) {
+ throw new DateTimeException("Value out of range: Hour[0-23], Minute[0-59], Second[0-59]");
+ }
long offsetSecs = negative * (array[1] * 3600L + array[2] * 60L + array[3]);
return context.setParsedField(OFFSET_SECONDS, offsetSecs, position, array[0]);
}
}
// handle special case of empty no offset text
if (noOffsetLen == 0) {
- return context.setParsedField(OFFSET_SECONDS, 0, position, position + noOffsetLen);
+ return context.setParsedField(OFFSET_SECONDS, 0, position, position);
}
return ~position;
}
- /**
- * Parse a two digit zero-prefixed number.
- *
- * @param array the array of parsed data, 0=pos,1=hours,2=mins,3=secs, not null
- * @param arrayIndex the index to parse the value into
- * @param parseText the offset ID, not null
- * @param required whether this number is required
- * @return true if an error occurred
- */
- private boolean parseNumber(int[] array, int arrayIndex, CharSequence parseText, boolean required) {
- if ((type + 3) / 2 < arrayIndex) {
- return false; // ignore seconds/minutes
+ private void parseHour(CharSequence parseText, boolean paddedHour, int[] array) {
+ if (paddedHour) {
+ // parse two digits
+ if (!parseDigits(parseText, false, 1, array)) {
+ array[0] = ~array[0];
+ }
+ } else {
+ // parse one or two digits
+ parseVariableWidthDigits(parseText, 1, 2, array);
}
+ }
+
+ private void parseMinute(CharSequence parseText, boolean isColon, boolean mandatory, int[] array) {
+ if (!parseDigits(parseText, isColon, 2, array)) {
+ if (mandatory) {
+ array[0] = ~array[0];
+ }
+ }
+ }
+
+ private void parseSecond(CharSequence parseText, boolean isColon, boolean mandatory, int[] array) {
+ if (!parseDigits(parseText, isColon, 3, array)) {
+ if (mandatory) {
+ array[0] = ~array[0];
+ }
+ }
+ }
+
+ private void parseOptionalMinuteSecond(CharSequence parseText, boolean isColon, int[] array) {
+ if (parseDigits(parseText, isColon, 2, array)) {
+ parseDigits(parseText, isColon, 3, array);
+ }
+ }
+
+ private boolean parseDigits(CharSequence parseText, boolean isColon, int arrayIndex, int[] array) {
int pos = array[0];
- if ((type % 2) == 0 && arrayIndex > 1) {
+ if (pos < 0) {
+ return true;
+ }
+ if (isColon && arrayIndex != 1) { // ':' will precede only in case of minute/second
if (pos + 1 > parseText.length() || parseText.charAt(pos) != ':') {
- return required;
+ return false;
}
pos++;
}
if (pos + 2 > parseText.length()) {
- return required;
+ return false;
}
char ch1 = parseText.charAt(pos++);
char ch2 = parseText.charAt(pos++);
if (ch1 < '0' || ch1 > '9' || ch2 < '0' || ch2 > '9') {
- return required;
+ return false;
}
int value = (ch1 - 48) * 10 + (ch2 - 48);
if (value < 0 || value > 59) {
- return required;
+ return false;
}
array[arrayIndex] = value;
array[0] = pos;
- return false;
+ return true;
+ }
+
+ private void parseVariableWidthDigits(CharSequence parseText, int minDigits, int maxDigits, int[] array) {
+ // scan the text to find the available number of digits up to maxDigits
+ // so long as the number available is minDigits or more, the input is valid
+ // then parse the number of available digits
+ int pos = array[0];
+ int available = 0;
+ char[] chars = new char[maxDigits];
+ for (int i = 0; i < maxDigits; i++) {
+ if (pos + 1 > parseText.length()) {
+ break;
+ }
+ char ch = parseText.charAt(pos++);
+ if (ch < '0' || ch > '9') {
+ pos--;
+ break;
+ }
+ chars[i] = ch;
+ available++;
+ }
+ if (available < minDigits) {
+ array[0] = ~array[0];
+ return;
+ }
+ switch (available) {
+ case 1:
+ array[1] = (chars[0] - 48);
+ break;
+ case 2:
+ array[1] = ((chars[0] - 48) * 10 + (chars[1] - 48));
+ break;
+ case 3:
+ array[1] = (chars[0] - 48);
+ array[2] = ((chars[1] - 48) * 10 + (chars[2] - 48));
+ break;
+ case 4:
+ array[1] = ((chars[0] - 48) * 10 + (chars[1] - 48));
+ array[2] = ((chars[2] - 48) * 10 + (chars[3] - 48));
+ break;
+ case 5:
+ array[1] = (chars[0] - 48);
+ array[2] = ((chars[1] - 48) * 10 + (chars[2] - 48));
+ array[3] = ((chars[3] - 48) * 10 + (chars[4] - 48));
+ break;
+ case 6:
+ array[1] = ((chars[0] - 48) * 10 + (chars[1] - 48));
+ array[2] = ((chars[2] - 48) * 10 + (chars[3] - 48));
+ array[3] = ((chars[4] - 48) * 10 + (chars[5] - 48));
+ break;
+ }
+ array[0] = pos;
}
@Override
@@ -3496,9 +3882,7 @@
return false;
}
String gmtText = "GMT"; // TODO: get localized version of 'GMT'
- if (gmtText != null) {
- buf.append(gmtText);
- }
+ buf.append(gmtText);
int totalSecs = Math.toIntExact(offsetSecs);
if (totalSecs != 0) {
int absHours = Math.abs((totalSecs / 3600) % 100); // anything larger than 99 silently dropped
@@ -3542,14 +3926,12 @@
@Override
public int parse(DateTimeParseContext context, CharSequence text, int position) {
int pos = position;
- int end = pos + text.length();
+ int end = text.length();
String gmtText = "GMT"; // TODO: get localized version of 'GMT'
- if (gmtText != null) {
- if (!context.subSequenceEquals(text, pos, gmtText, 0, gmtText.length())) {
+ if (!context.subSequenceEquals(text, pos, gmtText, 0, gmtText.length())) {
return ~position;
}
- pos += gmtText.length();
- }
+ pos += gmtText.length();
// parse normal plus/minus offset
int negative = 0;
if (pos == end) {
@@ -3641,9 +4023,12 @@
/** The preferred zoneid map */
private Set<String> preferredZones;
- ZoneTextPrinterParser(TextStyle textStyle, Set<ZoneId> preferredZones) {
+ /** Display in generic time-zone format. True in case of pattern letter 'v' */
+ private final boolean isGeneric;
+ ZoneTextPrinterParser(TextStyle textStyle, Set<ZoneId> preferredZones, boolean isGeneric) {
super(TemporalQueries.zone(), "ZoneText(" + textStyle + ")");
this.textStyle = Objects.requireNonNull(textStyle, "textStyle");
+ this.isGeneric = isGeneric;
if (preferredZones != null && preferredZones.size() != 0) {
this.preferredZones = new HashSet<>();
for (ZoneId id : preferredZones) {
@@ -3761,11 +4146,21 @@
String zname = zone.getId();
if (!(zone instanceof ZoneOffset)) {
TemporalAccessor dt = context.getTemporal();
- String name = getDisplayName(zname,
- dt.isSupported(ChronoField.INSTANT_SECONDS)
- ? (zone.getRules().isDaylightSavings(Instant.from(dt)) ? DST : STD)
- : GENERIC,
- context.getLocale());
+ int type = GENERIC;
+ if (!isGeneric) {
+ if (dt.isSupported(ChronoField.INSTANT_SECONDS)) {
+ type = zone.getRules().isDaylightSavings(Instant.from(dt)) ? DST : STD;
+ } else if (dt.isSupported(ChronoField.EPOCH_DAY) &&
+ dt.isSupported(ChronoField.NANO_OF_DAY)) {
+ LocalDate date = LocalDate.ofEpochDay(dt.getLong(ChronoField.EPOCH_DAY));
+ LocalTime time = LocalTime.ofNanoOfDay(dt.getLong(ChronoField.NANO_OF_DAY));
+ LocalDateTime ldt = date.atTime(time);
+ if (zone.getRules().getTransition(ldt) == null) {
+ type = zone.getRules().isDaylightSavings(ldt.atZone(zone).toInstant()) ? DST : STD;
+ }
+ }
+ }
+ String name = getDisplayName(zname, type, context.getLocale());
if (name != null) {
zname = name;
}
@@ -3944,11 +4339,21 @@
char nextNextChar = text.charAt(position + 1);
if (context.charEquals(nextChar, 'U') && context.charEquals(nextNextChar, 'T')) {
if (length >= position + 3 && context.charEquals(text.charAt(position + 2), 'C')) {
- return parseOffsetBased(context, text, position, position + 3, OffsetIdPrinterParser.INSTANCE_ID_ZERO);
+ // There are localized zone texts that start with "UTC", e.g.
+ // "UTC\u221210:00" (MINUS SIGN instead of HYPHEN-MINUS) in French.
+ // Exclude those ZoneText cases.
+ if (!(this instanceof ZoneTextPrinterParser)) {
+ return parseOffsetBased(context, text, position, position + 3, OffsetIdPrinterParser.INSTANCE_ID_ZERO);
+ }
+ } else {
+ return parseOffsetBased(context, text, position, position + 2, OffsetIdPrinterParser.INSTANCE_ID_ZERO);
}
- return parseOffsetBased(context, text, position, position + 2, OffsetIdPrinterParser.INSTANCE_ID_ZERO);
} else if (context.charEquals(nextChar, 'G') && length >= position + 3 &&
context.charEquals(nextNextChar, 'M') && context.charEquals(text.charAt(position + 2), 'T')) {
+ if (length >= position + 4 && context.charEquals(text.charAt(position + 3), '0')) {
+ context.setParsed(ZoneId.of("GMT0"));
+ return position + 4;
+ }
return parseOffsetBased(context, text, position, position + 3, OffsetIdPrinterParser.INSTANCE_ID_ZERO);
}
}
@@ -3981,7 +4386,7 @@
* @return the position after the parse
*/
private int parseOffsetBased(DateTimeParseContext context, CharSequence text, int prefixPos, int position, OffsetIdPrinterParser parser) {
- String prefix = text.toString().substring(prefixPos, position).toUpperCase();
+ String prefix = text.subSequence(prefixPos, position).toString().toUpperCase();
if (position >= text.length()) {
context.setParsed(ZoneId.of(prefix));
return position;
@@ -4041,7 +4446,7 @@
this.key = k;
this.value = v;
this.child = child;
- if (k.length() == 0){
+ if (k.isEmpty()) {
c0 = 0xffff;
} else {
c0 = key.charAt(0);
@@ -4435,7 +4840,7 @@
// String name = DateTimeTextProvider.getLocalizedResource(key, locale);
LocaleDisplayNames displayNames = LocaleDisplayNames.getInstance(ULocale.forLocale(locale));
String name = displayNames.keyValueDisplayName("calendar", chrono.getCalendarType());
- return name != null ? name : chrono.getId();
+ return Objects.requireNonNullElseGet(name, () -> chrono.getId());
}
}
@@ -4509,12 +4914,13 @@
//-----------------------------------------------------------------------
/**
* Prints or parses a localized pattern from a localized field.
- * The specific formatter and parameters is not selected until the
+ * The specific formatter and parameters is not selected until
* the field is to be printed or parsed.
* The locale is needed to select the proper WeekFields from which
* the field for day-of-week, week-of-month, or week-of-year is selected.
+ * Hence the inherited field NumberPrinterParser.field is unused.
*/
- static final class WeekBasedFieldPrinterParser implements DateTimePrinterParser {
+ static final class WeekBasedFieldPrinterParser extends NumberPrinterParser {
private char chr;
private int count;
@@ -4523,12 +4929,55 @@
*
* @param chr the pattern format letter that added this PrinterParser.
* @param count the repeat count of the format letter
+ * @param minWidth the minimum field width, from 1 to 19
+ * @param maxWidth the maximum field width, from minWidth to 19
*/
- WeekBasedFieldPrinterParser(char chr, int count) {
+ WeekBasedFieldPrinterParser(char chr, int count, int minWidth, int maxWidth) {
+ this(chr, count, minWidth, maxWidth, 0);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param chr the pattern format letter that added this PrinterParser.
+ * @param count the repeat count of the format letter
+ * @param minWidth the minimum field width, from 1 to 19
+ * @param maxWidth the maximum field width, from minWidth to 19
+ * @param subsequentWidth the width of subsequent non-negative numbers, 0 or greater,
+ * -1 if fixed width due to active adjacent parsing
+ */
+ WeekBasedFieldPrinterParser(char chr, int count, int minWidth, int maxWidth,
+ int subsequentWidth) {
+ super(null, minWidth, maxWidth, SignStyle.NOT_NEGATIVE, subsequentWidth);
this.chr = chr;
this.count = count;
}
+ /**
+ * Returns a new instance with fixed width flag set.
+ *
+ * @return a new updated printer-parser, not null
+ */
+ @Override
+ WeekBasedFieldPrinterParser withFixedWidth() {
+ if (subsequentWidth == -1) {
+ return this;
+ }
+ return new WeekBasedFieldPrinterParser(chr, count, minWidth, maxWidth, -1);
+ }
+
+ /**
+ * Returns a new instance with an updated subsequent width.
+ *
+ * @param subsequentWidth the width of subsequent non-negative numbers, 0 or greater
+ * @return a new updated printer-parser, not null
+ */
+ @Override
+ WeekBasedFieldPrinterParser withSubsequentWidth(int subsequentWidth) {
+ return new WeekBasedFieldPrinterParser(chr, count, minWidth, maxWidth,
+ this.subsequentWidth + subsequentWidth);
+ }
+
@Override
public boolean format(DateTimePrintContext context, StringBuilder buf) {
return printerParser(context.getLocale()).format(context, buf);
@@ -4553,10 +5002,12 @@
case 'Y':
field = weekDef.weekBasedYear();
if (count == 2) {
- return new ReducedPrinterParser(field, 2, 2, 0, ReducedPrinterParser.BASE_DATE, 0);
+ return new ReducedPrinterParser(field, 2, 2, 0, ReducedPrinterParser.BASE_DATE,
+ this.subsequentWidth);
} else {
return new NumberPrinterParser(field, count, 19,
- (count < 4) ? SignStyle.NORMAL : SignStyle.EXCEEDS_PAD, -1);
+ (count < 4) ? SignStyle.NORMAL : SignStyle.EXCEEDS_PAD,
+ this.subsequentWidth);
}
case 'e':
case 'c':
@@ -4571,7 +5022,8 @@
default:
throw new IllegalStateException("unreachable");
}
- return new NumberPrinterParser(field, (count == 2 ? 2 : 1), 2, SignStyle.NOT_NEGATIVE);
+ return new NumberPrinterParser(field, minWidth, maxWidth, SignStyle.NOT_NEGATIVE,
+ this.subsequentWidth);
}
@Override
diff --git a/ojluni/src/main/java/java/time/format/DateTimeParseContext.java b/ojluni/src/main/java/java/time/format/DateTimeParseContext.java
index e3ca5e9..6b8dd98 100644
--- a/ojluni/src/main/java/java/time/format/DateTimeParseContext.java
+++ b/ojluni/src/main/java/java/time/format/DateTimeParseContext.java
@@ -399,7 +399,7 @@
*/
void addChronoChangedListener(Consumer<Chronology> listener) {
if (chronoListeners == null) {
- chronoListeners = new ArrayList<Consumer<Chronology>>();
+ chronoListeners = new ArrayList<>();
}
chronoListeners.add(listener);
}
diff --git a/ojluni/src/main/java/java/time/format/DateTimePrintContext.java b/ojluni/src/main/java/java/time/format/DateTimePrintContext.java
index 543a317..0faec56 100644
--- a/ojluni/src/main/java/java/time/format/DateTimePrintContext.java
+++ b/ojluni/src/main/java/java/time/format/DateTimePrintContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -146,7 +146,7 @@
if (overrideZone != null) {
// if have zone and instant, calculation is simple, defaulting chrono if necessary
if (temporal.isSupported(INSTANT_SECONDS)) {
- Chronology chrono = (effectiveChrono != null ? effectiveChrono : IsoChronology.INSTANCE);
+ Chronology chrono = Objects.requireNonNullElse(effectiveChrono, IsoChronology.INSTANCE);
return chrono.zonedDateTime(Instant.from(temporal), overrideZone);
}
// block changing zone on OffsetTime, and similar problem cases
@@ -218,6 +218,13 @@
}
return query.queryFrom(this);
}
+
+ @Override
+ public String toString() {
+ return temporal +
+ (effectiveChrono != null ? " with chronology " + effectiveChrono : "") +
+ (effectiveZone != null ? " with zone " + effectiveZone : "");
+ }
};
}
@@ -279,7 +286,8 @@
<R> R getValue(TemporalQuery<R> query) {
R result = temporal.query(query);
if (result == null && optional == 0) {
- throw new DateTimeException("Unable to extract value: " + temporal.getClass());
+ throw new DateTimeException("Unable to extract " +
+ query + " from temporal " + temporal);
}
return result;
}
@@ -294,14 +302,10 @@
* @throws DateTimeException if the field is not available and the section is not optional
*/
Long getValue(TemporalField field) {
- try {
- return temporal.getLong(field);
- } catch (DateTimeException ex) {
- if (optional > 0) {
- return null;
- }
- throw ex;
+ if (optional > 0 && !temporal.isSupported(field)) {
+ return null;
}
+ return temporal.getLong(field);
}
//-----------------------------------------------------------------------
diff --git a/ojluni/src/main/java/java/time/format/DateTimeTextProvider.java b/ojluni/src/main/java/java/time/format/DateTimeTextProvider.java
index 490d91f..d11da68 100644
--- a/ojluni/src/main/java/java/time/format/DateTimeTextProvider.java
+++ b/ojluni/src/main/java/java/time/format/DateTimeTextProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -114,6 +114,9 @@
}
};
+ // Singleton instance
+ private static final DateTimeTextProvider INSTANCE = new DateTimeTextProvider();
+
DateTimeTextProvider() {}
/**
@@ -122,7 +125,7 @@
* @return the provider, not null
*/
static DateTimeTextProvider getInstance() {
- return new DateTimeTextProvider();
+ return INSTANCE;
}
/**
@@ -351,25 +354,40 @@
if (field == MONTH_OF_YEAR) {
for (TextStyle textStyle : TextStyle.values()) {
- Map<String, Integer> displayNames = CalendarDataUtility.retrieveJavaTimeFieldValueNames(
- "gregory", Calendar.MONTH, textStyle.toCalendarStyle(), locale);
Map<Long, String> map = new HashMap<>();
- if (displayNames != null) {
- for (Entry<String, Integer> entry : displayNames.entrySet()) {
- map.put((long) (entry.getValue() + 1), entry.getKey());
- }
-
- } else {
- // Narrow names may have duplicated names, such as "J" for January, Jun, July.
- // Get names one by one in that case.
+ // Narrow names may have duplicated names, such as "J" for January, June, July.
+ // Get names one by one in that case.
+ if ((textStyle.equals(TextStyle.NARROW) ||
+ textStyle.equals(TextStyle.NARROW_STANDALONE))) {
for (int month = Calendar.JANUARY; month <= Calendar.DECEMBER; month++) {
String name;
name = CalendarDataUtility.retrieveJavaTimeFieldValueName(
- "gregory", Calendar.MONTH, month, textStyle.toCalendarStyle(), locale);
+ "gregory", Calendar.MONTH,
+ month, textStyle.toCalendarStyle(), locale);
if (name == null) {
break;
}
- map.put((long) (month + 1), name);
+ map.put((month + 1L), name);
+ }
+ } else {
+ Map<String, Integer> displayNames = CalendarDataUtility.retrieveJavaTimeFieldValueNames(
+ "gregory", Calendar.MONTH, textStyle.toCalendarStyle(), locale);
+ if (displayNames != null) {
+ for (Entry<String, Integer> entry : displayNames.entrySet()) {
+ map.put((long)(entry.getValue() + 1), entry.getKey());
+ }
+ } else {
+ // Although probability is very less, but if other styles have duplicate names.
+ // Get names one by one in that case.
+ for (int month = Calendar.JANUARY; month <= Calendar.DECEMBER; month++) {
+ String name;
+ name = CalendarDataUtility.retrieveJavaTimeFieldValueName(
+ "gregory", Calendar.MONTH, month, textStyle.toCalendarStyle(), locale);
+ if (name == null) {
+ break;
+ }
+ map.put((month + 1L), name);
+ }
}
}
if (!map.isEmpty()) {
@@ -381,26 +399,41 @@
if (field == DAY_OF_WEEK) {
for (TextStyle textStyle : TextStyle.values()) {
- Map<String, Integer> displayNames = CalendarDataUtility.retrieveJavaTimeFieldValueNames(
- "gregory", Calendar.DAY_OF_WEEK, textStyle.toCalendarStyle(), locale);
Map<Long, String> map = new HashMap<>();
- if (displayNames != null) {
- for (Entry<String, Integer> entry : displayNames.entrySet()) {
- map.put((long)toWeekDay(entry.getValue()), entry.getKey());
- }
-
- } else {
- // Narrow names may have duplicated names, such as "S" for Sunday and Saturday.
- // Get names one by one in that case.
+ // Narrow names may have duplicated names, such as "S" for Sunday and Saturday.
+ // Get names one by one in that case.
+ if ((textStyle.equals(TextStyle.NARROW) ||
+ textStyle.equals(TextStyle.NARROW_STANDALONE))) {
for (int wday = Calendar.SUNDAY; wday <= Calendar.SATURDAY; wday++) {
String name;
name = CalendarDataUtility.retrieveJavaTimeFieldValueName(
- "gregory", Calendar.DAY_OF_WEEK, wday, textStyle.toCalendarStyle(), locale);
+ "gregory", Calendar.DAY_OF_WEEK,
+ wday, textStyle.toCalendarStyle(), locale);
if (name == null) {
break;
}
map.put((long)toWeekDay(wday), name);
}
+ } else {
+ Map<String, Integer> displayNames = CalendarDataUtility.retrieveJavaTimeFieldValueNames(
+ "gregory", Calendar.DAY_OF_WEEK, textStyle.toCalendarStyle(), locale);
+ if (displayNames != null) {
+ for (Entry<String, Integer> entry : displayNames.entrySet()) {
+ map.put((long)toWeekDay(entry.getValue()), entry.getKey());
+ }
+ } else {
+ // Although probability is very less, but if other styles have duplicate names.
+ // Get names one by one in that case.
+ for (int wday = Calendar.SUNDAY; wday <= Calendar.SATURDAY; wday++) {
+ String name;
+ name = CalendarDataUtility.retrieveJavaTimeFieldValueName(
+ "gregory", Calendar.DAY_OF_WEEK, wday, textStyle.toCalendarStyle(), locale);
+ if (name == null) {
+ break;
+ }
+ map.put((long)toWeekDay(wday), name);
+ }
+ }
}
if (!map.isEmpty()) {
styleMap.put(textStyle, map);
@@ -513,7 +546,8 @@
// @SuppressWarnings("unchecked")
// static <T> T getLocalizedResource(String key, Locale locale) {
// LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased()
- // .getLocaleResources(locale);
+ // .getLocaleResources(
+ // CalendarDataUtility.findRegionOverride(locale));
// ResourceBundle rb = lr.getJavaTimeFormatData();
// return rb.containsKey(key) ? (T) rb.getObject(key) : null;
// }
diff --git a/ojluni/src/main/java/java/time/format/DecimalStyle.java b/ojluni/src/main/java/java/time/format/DecimalStyle.java
index 484f2f2..632eac5 100644
--- a/ojluni/src/main/java/java/time/format/DecimalStyle.java
+++ b/ojluni/src/main/java/java/time/format/DecimalStyle.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -143,10 +143,15 @@
return of(Locale.getDefault(Locale.Category.FORMAT));
}
+ // Android-changed: Remove "rg" extension support in the javadoc. See http://b/228322300.
/**
* Obtains the DecimalStyle for the specified locale.
* <p>
* This method provides access to locale sensitive decimal style symbols.
+ * If the locale contains "nu" (Numbering System)
+ * <a href="../../util/Locale.html#def_locale_extension">
+ * Unicode extensions</a>, returned instance will reflect the values specified with
+ * those extensions.
*
* @param locale the locale, not null
* @return the decimal style, not null
@@ -211,7 +216,6 @@
*
* @param zeroDigit the character for zero
* @return a copy with a new character that represents zero, not null
-
*/
public DecimalStyle withZeroDigit(char zeroDigit) {
if (zeroDigit == this.zeroDigit) {
diff --git a/ojluni/src/main/java/java/time/format/Parsed.java b/ojluni/src/main/java/java/time/format/Parsed.java
index 1eb8845..a2a75fa 100644
--- a/ojluni/src/main/java/java/time/format/Parsed.java
+++ b/ojluni/src/main/java/java/time/format/Parsed.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -216,7 +216,16 @@
return (R) (date != null ? LocalDate.from(date) : null);
} else if (query == TemporalQueries.localTime()) {
return (R) time;
- } else if (query == TemporalQueries.zone() || query == TemporalQueries.offset()) {
+ } else if (query == TemporalQueries.offset()) {
+ Long offsetSecs = fieldValues.get(OFFSET_SECONDS);
+ if (offsetSecs != null) {
+ return (R) ZoneOffset.ofTotalSeconds(offsetSecs.intValue());
+ }
+ if (zone instanceof ZoneOffset) {
+ return (R)zone;
+ }
+ return query.queryFrom(this);
+ } else if (query == TemporalQueries.zone()) {
return query.queryFrom(this);
} else if (query == TemporalQueries.precision()) {
return null; // not a complete date/time
@@ -585,15 +594,16 @@
private void resolveInstant() {
// add instant seconds if we have date, time and zone
+ // Offset (if present) will be given priority over the zone.
if (date != null && time != null) {
- if (zone != null) {
- long instant = date.atTime(time).atZone(zone).getLong(ChronoField.INSTANT_SECONDS);
+ Long offsetSecs = fieldValues.get(OFFSET_SECONDS);
+ if (offsetSecs != null) {
+ ZoneOffset offset = ZoneOffset.ofTotalSeconds(offsetSecs.intValue());
+ long instant = date.atTime(time).atZone(offset).toEpochSecond();
fieldValues.put(INSTANT_SECONDS, instant);
} else {
- Long offsetSecs = fieldValues.get(OFFSET_SECONDS);
- if (offsetSecs != null) {
- ZoneOffset offset = ZoneOffset.ofTotalSeconds(offsetSecs.intValue());
- long instant = date.atTime(time).atZone(offset).getLong(ChronoField.INSTANT_SECONDS);
+ if (zone != null) {
+ long instant = date.atTime(time).atZone(zone).toEpochSecond();
fieldValues.put(INSTANT_SECONDS, instant);
}
}
diff --git a/ojluni/src/main/java/java/time/format/ZoneName.java b/ojluni/src/main/java/java/time/format/ZoneName.java
index daecb6e..df0b8af 100644
--- a/ojluni/src/main/java/java/time/format/ZoneName.java
+++ b/ojluni/src/main/java/java/time/format/ZoneName.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,8 @@
* appropriate zone id for the particular locale.
* <p>
* The zid<->metazone mappings are based on CLDR metaZones.xml.
- * The alias mappings are based on Link entries in tzdb data files.
+ * The alias mappings are based on Link entries in tzdb data files and
+ * CLDR's supplementalMetadata.xml.
*/
class ZoneName {
diff --git a/ojluni/src/main/java/java/time/temporal/ChronoField.java b/ojluni/src/main/java/java/time/temporal/ChronoField.java
index e1e8250..3438c41 100644
--- a/ojluni/src/main/java/java/time/temporal/ChronoField.java
+++ b/ojluni/src/main/java/java/time/temporal/ChronoField.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -81,6 +81,17 @@
import static java.time.temporal.ChronoUnit.WEEKS;
import static java.time.temporal.ChronoUnit.YEARS;
+import java.time.DayOfWeek;
+import java.time.Instant;
+import java.time.Year;
+import java.time.ZoneOffset;
+import java.time.chrono.ChronoLocalDate;
+import java.time.chrono.Chronology;
+import java.util.Locale;
+import java.util.Objects;
+import java.util.ResourceBundle;
+import sun.util.locale.provider.CalendarDataUtility;
+
/**
* A standard set of fields.
* <p>
@@ -269,6 +280,8 @@
* In lenient mode the value is not validated. It is combined with
* {@code AMPM_OF_DAY} to form {@code HOUR_OF_DAY} by multiplying
* the {AMPM_OF_DAY} value by 12.
+ * <p>
+ * See {@link #CLOCK_HOUR_OF_AMPM} for the related field that counts hours from 1 to 12.
*/
HOUR_OF_AMPM("HourOfAmPm", HOURS, HALF_DAYS, ValueRange.of(0, 11)),
/**
@@ -283,6 +296,8 @@
* 0 to 12 in smart mode. In lenient mode the value is not validated.
* The field is converted to an {@code HOUR_OF_AMPM} with the same value,
* unless the value is 12, in which case it is converted to 0.
+ * <p>
+ * See {@link #HOUR_OF_AMPM} for the related field that counts hours from 0 to 11.
*/
CLOCK_HOUR_OF_AMPM("ClockHourOfAmPm", HOURS, HALF_DAYS, ValueRange.of(1, 12)),
/**
@@ -298,12 +313,14 @@
* {@code NANO_OF_SECOND} to produce a {@code LocalTime}.
* In lenient mode, any excess days are added to the parsed date, or
* made available via {@link java.time.format.DateTimeFormatter#parsedExcessDays()}.
+ * <p>
+ * See {@link #CLOCK_HOUR_OF_DAY} for the related field that counts hours from 1 to 24.
*/
HOUR_OF_DAY("HourOfDay", HOURS, DAYS, ValueRange.of(0, 23), "hour"),
/**
* The clock-hour-of-day.
* <p>
- * This counts the hour within the AM/PM, from 1 to 24.
+ * This counts the hour within the day, from 1 to 24.
* This is the hour that would be observed on a 24-hour analog wall clock.
* This field has the same meaning for all calendar systems.
* <p>
@@ -312,6 +329,8 @@
* 0 to 24 in smart mode. In lenient mode the value is not validated.
* The field is converted to an {@code HOUR_OF_DAY} with the same value,
* unless the value is 24, in which case it is converted to 0.
+ * <p>
+ * See {@link #HOUR_OF_DAY} for the related field that counts hours from 0 to 23.
*/
CLOCK_HOUR_OF_DAY("ClockHourOfDay", HOURS, DAYS, ValueRange.of(1, 24)),
/**
@@ -418,8 +437,11 @@
* <p>
* This field is strictly defined to have the same meaning in all calendar systems.
* This is necessary to ensure interoperation between calendars.
+ * <p>
+ * Range of EpochDay is between (LocalDate.MIN.toEpochDay(), LocalDate.MAX.toEpochDay())
+ * both inclusive.
*/
- EPOCH_DAY("EpochDay", DAYS, FOREVER, ValueRange.of((long) (Year.MIN_VALUE * 365.25), (long) (Year.MAX_VALUE * 365.25))),
+ EPOCH_DAY("EpochDay", DAYS, FOREVER, ValueRange.of(-365243219162L, 365241780471L)),
/**
* The aligned week within a month.
* <p>
@@ -619,7 +641,16 @@
return name;
}
- // Android-changed: use ICU names.
+ // BEGIN Android-changed: use ICU names.
+ /*
+ LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased()
+ .getLocaleResources(
+ CalendarDataUtility
+ .findRegionOverride(locale));
+ ResourceBundle rb = lr.getJavaTimeFormatData();
+ String key = "field." + displayNameKey;
+ return rb.containsKey(key) ? rb.getString(key) : name;
+ */
DateTimePatternGenerator generator = DateTimePatternGenerator
.getInstance(ULocale.forLocale(locale));
String icuName = generator.getAppendItemName(getIcuFieldNumber(this));
@@ -652,6 +683,7 @@
default:
throw new IllegalArgumentException("Unexpected ChronoField " + field.name());
}
+ // END Android-changed: use ICU names.
}
@Override
diff --git a/ojluni/src/main/java/java/time/temporal/IsoFields.java b/ojluni/src/main/java/java/time/temporal/IsoFields.java
index 20b2cfd..1457617 100644
--- a/ojluni/src/main/java/java/time/temporal/IsoFields.java
+++ b/ojluni/src/main/java/java/time/temporal/IsoFields.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -82,6 +82,9 @@
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
+import java.util.ResourceBundle;
+
+import sun.util.locale.provider.CalendarDataUtility;
/**
* Fields and units specific to the ISO-8601 calendar system,
@@ -101,7 +104,7 @@
* The complete date is expressed using three fields:
* <ul>
* <li>{@link #DAY_OF_QUARTER DAY_OF_QUARTER} - the day within the quarter, from 1 to 90, 91 or 92
- * <li>{@link #QUARTER_OF_YEAR QUARTER_OF_YEAR} - the week within the week-based-year
+ * <li>{@link #QUARTER_OF_YEAR QUARTER_OF_YEAR} - the quarter within the year, from 1 to 4
* <li>{@link ChronoField#YEAR YEAR} - the standard ISO year
* </ul>
*
@@ -135,15 +138,19 @@
* <p>
* For example:
*
- * <table cellpadding="0" cellspacing="3" border="0" style="text-align: left; width: 50%;">
+ * <table class=striped style="text-align: left">
* <caption>Examples of Week based Years</caption>
- * <tr><th>Date</th><th>Day-of-week</th><th>Field values</th></tr>
- * <tr><th>2008-12-28</th><td>Sunday</td><td>Week 52 of week-based-year 2008</td></tr>
- * <tr><th>2008-12-29</th><td>Monday</td><td>Week 1 of week-based-year 2009</td></tr>
- * <tr><th>2008-12-31</th><td>Wednesday</td><td>Week 1 of week-based-year 2009</td></tr>
- * <tr><th>2009-01-01</th><td>Thursday</td><td>Week 1 of week-based-year 2009</td></tr>
- * <tr><th>2009-01-04</th><td>Sunday</td><td>Week 1 of week-based-year 2009</td></tr>
- * <tr><th>2009-01-05</th><td>Monday</td><td>Week 2 of week-based-year 2009</td></tr>
+ * <thead>
+ * <tr><th scope="col">Date</th><th scope="col">Day-of-week</th><th scope="col">Field values</th></tr>
+ * </thead>
+ * <tbody>
+ * <tr><th scope="row">2008-12-28</th><td>Sunday</td><td>Week 52 of week-based-year 2008</td></tr>
+ * <tr><th scope="row">2008-12-29</th><td>Monday</td><td>Week 1 of week-based-year 2009</td></tr>
+ * <tr><th scope="row">2008-12-31</th><td>Wednesday</td><td>Week 1 of week-based-year 2009</td></tr>
+ * <tr><th scope="row">2009-01-01</th><td>Thursday</td><td>Week 1 of week-based-year 2009</td></tr>
+ * <tr><th scope="row">2009-01-04</th><td>Sunday</td><td>Week 1 of week-based-year 2009</td></tr>
+ * <tr><th scope="row">2009-01-05</th><td>Monday</td><td>Week 2 of week-based-year 2009</td></tr>
+ * </tbody>
* </table>
*
* @implSpec
@@ -401,6 +408,12 @@
long moy = temporal.getLong(MONTH_OF_YEAR);
return ((moy + 2) / 3);
}
+ public ValueRange rangeRefinedBy(TemporalAccessor temporal) {
+ if (isSupportedBy(temporal) == false) {
+ throw new UnsupportedTemporalTypeException("Unsupported field: QuarterOfYear");
+ }
+ return super.rangeRefinedBy(temporal);
+ }
@SuppressWarnings("unchecked")
@Override
public <R extends Temporal> R adjustInto(R temporal, long newValue) {
@@ -418,12 +431,21 @@
@Override
public String getDisplayName(Locale locale) {
Objects.requireNonNull(locale, "locale");
- // Android-changed: Use ICU name values.
+ // BEGIN Android-changed: Use ICU name values.
+ /*
+ LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased()
+ .getLocaleResources(
+ CalendarDataUtility
+ .findRegionOverride(locale));
+ ResourceBundle rb = lr.getJavaTimeFormatData();
+ return rb.containsKey("field.week") ? rb.getString("field.week") : toString();
+ */
DateTimePatternGenerator dateTimePatternGenerator = DateTimePatternGenerator
.getInstance(ULocale.forLocale(locale));
String icuName = dateTimePatternGenerator
.getAppendItemName(DateTimePatternGenerator.WEEK_OF_YEAR);
return icuName != null && !icuName.isEmpty() ? icuName : toString();
+ // END Android-changed: Use ICU name values.
}
@Override
@@ -530,6 +552,12 @@
}
return getWeekBasedYear(LocalDate.from(temporal));
}
+ public ValueRange rangeRefinedBy(TemporalAccessor temporal) {
+ if (isSupportedBy(temporal) == false) {
+ throw new UnsupportedTemporalTypeException("Unsupported field: WeekBasedYear");
+ }
+ return super.rangeRefinedBy(temporal);
+ }
@SuppressWarnings("unchecked")
@Override
public <R extends Temporal> R adjustInto(R temporal, long newValue) {
@@ -572,9 +600,6 @@
//-------------------------------------------------------------------------
private static final int[] QUARTER_DAYS = {0, 90, 181, 273, 0, 91, 182, 274};
- private static boolean isIso(TemporalAccessor temporal) {
- return Chronology.from(temporal).equals(IsoChronology.INSTANCE);
- }
private static void ensureIso(TemporalAccessor temporal) {
if (isIso(temporal) == false) {
@@ -682,7 +707,7 @@
@Override
public boolean isSupportedBy(Temporal temporal) {
- return temporal.isSupported(EPOCH_DAY);
+ return temporal.isSupported(EPOCH_DAY) && isIso(temporal);
}
@SuppressWarnings("unchecked")
@@ -693,9 +718,8 @@
return (R) temporal.with(WEEK_BASED_YEAR,
Math.addExact(temporal.get(WEEK_BASED_YEAR), amount));
case QUARTER_YEARS:
- // no overflow (256 is multiple of 4)
- return (R) temporal.plus(amount / 256, YEARS)
- .plus((amount % 256) * 3, MONTHS);
+ return (R) temporal.plus(amount / 4, YEARS)
+ .plus((amount % 4) * 3, MONTHS);
default:
throw new IllegalStateException("Unreachable");
}
@@ -722,4 +746,8 @@
return name;
}
}
+
+ static boolean isIso(TemporalAccessor temporal) {
+ return Chronology.from(temporal).equals(IsoChronology.INSTANCE);
+ }
}
diff --git a/ojluni/src/main/java/java/time/temporal/TemporalQueries.java b/ojluni/src/main/java/java/time/temporal/TemporalQueries.java
index 6b1777a..9df66bb 100644
--- a/ojluni/src/main/java/java/time/temporal/TemporalQueries.java
+++ b/ojluni/src/main/java/java/time/temporal/TemporalQueries.java
@@ -341,58 +341,118 @@
/**
* A strict query for the {@code ZoneId}.
*/
- static final TemporalQuery<ZoneId> ZONE_ID = (temporal) ->
- temporal.query(TemporalQueries.ZONE_ID);
+ static final TemporalQuery<ZoneId> ZONE_ID = new TemporalQuery<>() {
+ @Override
+ public ZoneId queryFrom(TemporalAccessor temporal) {
+ return temporal.query(TemporalQueries.ZONE_ID);
+ }
+
+ @Override
+ public String toString() {
+ return "ZoneId";
+ }
+ };
/**
* A query for the {@code Chronology}.
*/
- static final TemporalQuery<Chronology> CHRONO = (temporal) ->
- temporal.query(TemporalQueries.CHRONO);
+ static final TemporalQuery<Chronology> CHRONO = new TemporalQuery<>() {
+ @Override
+ public Chronology queryFrom(TemporalAccessor temporal) {
+ return temporal.query(TemporalQueries.CHRONO);
+ }
+
+ @Override
+ public String toString() {
+ return "Chronology";
+ }
+ };
+
/**
* A query for the smallest supported unit.
*/
- static final TemporalQuery<TemporalUnit> PRECISION = (temporal) ->
- temporal.query(TemporalQueries.PRECISION);
+ static final TemporalQuery<TemporalUnit> PRECISION = new TemporalQuery<>() {
+ @Override
+ public TemporalUnit queryFrom(TemporalAccessor temporal) {
+ return temporal.query(TemporalQueries.PRECISION);
+ }
+
+ @Override
+ public String toString() {
+ return "Precision";
+ }
+ };
//-----------------------------------------------------------------------
/**
* A query for {@code ZoneOffset} returning null if not found.
*/
- static final TemporalQuery<ZoneOffset> OFFSET = (temporal) -> {
- if (temporal.isSupported(OFFSET_SECONDS)) {
- return ZoneOffset.ofTotalSeconds(temporal.get(OFFSET_SECONDS));
+ static final TemporalQuery<ZoneOffset> OFFSET = new TemporalQuery<>() {
+ @Override
+ public ZoneOffset queryFrom(TemporalAccessor temporal) {
+ if (temporal.isSupported(OFFSET_SECONDS)) {
+ return ZoneOffset.ofTotalSeconds(temporal.get(OFFSET_SECONDS));
+ }
+ return null;
}
- return null;
+
+ @Override
+ public String toString() {
+ return "ZoneOffset";
+ }
};
/**
* A lenient query for the {@code ZoneId}, falling back to the {@code ZoneOffset}.
*/
- static final TemporalQuery<ZoneId> ZONE = (temporal) -> {
- ZoneId zone = temporal.query(ZONE_ID);
- return (zone != null ? zone : temporal.query(OFFSET));
+ static final TemporalQuery<ZoneId> ZONE = new TemporalQuery<>() {
+ @Override
+ public ZoneId queryFrom(TemporalAccessor temporal) {
+ ZoneId zone = temporal.query(ZONE_ID);
+ return (zone != null ? zone : temporal.query(OFFSET));
+ }
+
+ @Override
+ public String toString() {
+ return "Zone";
+ }
};
/**
* A query for {@code LocalDate} returning null if not found.
*/
- static final TemporalQuery<LocalDate> LOCAL_DATE = (temporal) -> {
- if (temporal.isSupported(EPOCH_DAY)) {
- return LocalDate.ofEpochDay(temporal.getLong(EPOCH_DAY));
+ static final TemporalQuery<LocalDate> LOCAL_DATE = new TemporalQuery<>() {
+ @Override
+ public LocalDate queryFrom(TemporalAccessor temporal) {
+ if (temporal.isSupported(EPOCH_DAY)) {
+ return LocalDate.ofEpochDay(temporal.getLong(EPOCH_DAY));
+ }
+ return null;
}
- return null;
+
+ @Override
+ public String toString() {
+ return "LocalDate";
+ }
};
/**
* A query for {@code LocalTime} returning null if not found.
*/
- static final TemporalQuery<LocalTime> LOCAL_TIME = (temporal) -> {
- if (temporal.isSupported(NANO_OF_DAY)) {
- return LocalTime.ofNanoOfDay(temporal.getLong(NANO_OF_DAY));
+ static final TemporalQuery<LocalTime> LOCAL_TIME = new TemporalQuery<>() {
+ @Override
+ public LocalTime queryFrom(TemporalAccessor temporal) {
+ if (temporal.isSupported(NANO_OF_DAY)) {
+ return LocalTime.ofNanoOfDay(temporal.getLong(NANO_OF_DAY));
+ }
+ return null;
}
- return null;
+
+ @Override
+ public String toString() {
+ return "LocalTime";
+ }
};
}
diff --git a/ojluni/src/main/java/java/time/temporal/WeekFields.java b/ojluni/src/main/java/java/time/temporal/WeekFields.java
index b2f85ae..fc92343 100644
--- a/ojluni/src/main/java/java/time/temporal/WeekFields.java
+++ b/ojluni/src/main/java/java/time/temporal/WeekFields.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -127,18 +127,22 @@
* The earliest period is referred to as week 0 if it has less than the minimal number of days
* and week 1 if it has at least the minimal number of days.
*
- * <table cellpadding="0" cellspacing="3" border="0" style="text-align: left; width: 50%;">
+ * <table class=striped style="text-align: left">
* <caption>Examples of WeekFields</caption>
- * <tr><th>Date</th><td>Day-of-week</td>
- * <td>First day: Monday<br>Minimal days: 4</td><td>First day: Monday<br>Minimal days: 5</td></tr>
- * <tr><th>2008-12-31</th><td>Wednesday</td>
+ * <thead>
+ * <tr><th scope="col">Date</th><th scope="col">Day-of-week</th>
+ * <th scope="col">First day: Monday<br>Minimal days: 4</th><th scope="col">First day: Monday<br>Minimal days: 5</th></tr>
+ * </thead>
+ * <tbody>
+ * <tr><th scope="row">2008-12-31</th><td>Wednesday</td>
* <td>Week 5 of December 2008</td><td>Week 5 of December 2008</td></tr>
- * <tr><th>2009-01-01</th><td>Thursday</td>
+ * <tr><th scope="row">2009-01-01</th><td>Thursday</td>
* <td>Week 1 of January 2009</td><td>Week 0 of January 2009</td></tr>
- * <tr><th>2009-01-04</th><td>Sunday</td>
+ * <tr><th scope="row">2009-01-04</th><td>Sunday</td>
* <td>Week 1 of January 2009</td><td>Week 0 of January 2009</td></tr>
- * <tr><th>2009-01-05</th><td>Monday</td>
+ * <tr><th scope="row">2009-01-05</th><td>Monday</td>
* <td>Week 2 of January 2009</td><td>Week 1 of January 2009</td></tr>
+ * </tbody>
* </table>
*
* <h3>Week of Year</h3>
@@ -157,18 +161,22 @@
* The first and last weeks of a year may contain days from the
* previous calendar year or next calendar year respectively.
*
- * <table cellpadding="0" cellspacing="3" border="0" style="text-align: left; width: 50%;">
+ * <table class=striped style="text-align: left;">
* <caption>Examples of WeekFields for week-based-year</caption>
- * <tr><th>Date</th><td>Day-of-week</td>
- * <td>First day: Monday<br>Minimal days: 4</td><td>First day: Monday<br>Minimal days: 5</td></tr>
- * <tr><th>2008-12-31</th><td>Wednesday</td>
+ * <thead>
+ * <tr><th scope="col">Date</th><th scope="col">Day-of-week</th>
+ * <th scope="col">First day: Monday<br>Minimal days: 4</th><th scope="col">First day: Monday<br>Minimal days: 5</th></tr>
+ * </thead>
+ * <tbody>
+ * <tr><th scope="row">2008-12-31</th><td>Wednesday</td>
* <td>Week 1 of 2009</td><td>Week 53 of 2008</td></tr>
- * <tr><th>2009-01-01</th><td>Thursday</td>
+ * <tr><th scope="row">2009-01-01</th><td>Thursday</td>
* <td>Week 1 of 2009</td><td>Week 53 of 2008</td></tr>
- * <tr><th>2009-01-04</th><td>Sunday</td>
+ * <tr><th scope="row">2009-01-04</th><td>Sunday</td>
* <td>Week 1 of 2009</td><td>Week 53 of 2008</td></tr>
- * <tr><th>2009-01-05</th><td>Monday</td>
+ * <tr><th scope="row">2009-01-05</th><td>Monday</td>
* <td>Week 2 of 2009</td><td>Week 1 of 2009</td></tr>
+ * </tbody>
* </table>
*
* @implSpec
@@ -274,23 +282,66 @@
private final transient TemporalField weekBasedYear = ComputedDayOfField.ofWeekBasedYearField(this);
//-----------------------------------------------------------------------
+ // Android-changed: Remove "rg" support in the javadoc. See http://b/228322300.
+ // Android-changed: Support the "fw" extension since Android 13. See http://b/228322300.
/**
* Obtains an instance of {@code WeekFields} appropriate for a locale.
* <p>
* This will look up appropriate values from the provider of localization data.
+ * Since Android 13, if the locale contains "fw" (First day of week)
+ * <a href="../../util/Locale.html#def_locale_extension">
+ * Unicode extensions</a>, returned instance will reflect the values specified with
+ * those extensions.
*
* @param locale the locale to use, not null
* @return the week-definition, not null
*/
public static WeekFields of(Locale locale) {
Objects.requireNonNull(locale, "locale");
- // Android-changed: get Week data from ICU4J
+
+ // Android-changed: Obtain week data from ICU4J.
+ // int calDow = CalendarDataUtility.retrieveFirstDayOfWeek(locale);
Calendar calendar = Calendar.getInstance(locale);
Calendar.WeekData weekData = calendar.getWeekData();
- DayOfWeek dow = DayOfWeek.SUNDAY.plus(weekData.firstDayOfWeek - 1);
- return WeekFields.of(dow, weekData.minimalDaysInFirstWeek);
+ int calDow = retrieveFirstDayOfWeek(locale, weekData);
+ DayOfWeek dow = DayOfWeek.SUNDAY.plus(calDow - 1);
+ // Android-changed: Obtain minimal days from ICU4J.
+ // int minDays = CalendarDataUtility.retrieveMinimalDaysInFirstWeek(locale);
+ int minDays = weekData.minimalDaysInFirstWeek;
+ return WeekFields.of(dow, minDays);
}
+ // BEGIN Android-added: Extra method needed to support "fw" the Unicode extension.
+ // A modified version of the upstream CalendarDataUtility.retrieveFirstDayOfWeek() but with
+ // ICU provider.
+ private static int retrieveFirstDayOfWeek(Locale locale, Calendar.WeekData icuWeekData) {
+ // Look for the Unicode Extension in the locale parameter
+ if (locale.hasExtensions()) {
+ String fw = locale.getUnicodeLocaleType("fw");
+ if (fw != null) {
+ switch (fw.toLowerCase(Locale.ROOT)) {
+ case "mon":
+ return Calendar.MONDAY;
+ case "tue":
+ return Calendar.TUESDAY;
+ case "wed":
+ return Calendar.WEDNESDAY;
+ case "thu":
+ return Calendar.THURSDAY;
+ case "fri":
+ return Calendar.FRIDAY;
+ case "sat":
+ return Calendar.SATURDAY;
+ case "sun":
+ return Calendar.SUNDAY;
+ }
+ }
+ }
+
+ return icuWeekData.firstDayOfWeek;
+ }
+ // END Android-added: Extra method needed to support "fw" the Unicode extension.
+
/**
* Obtains an instance of {@code WeekFields} from the first day-of-week and minimal days.
* <p>
@@ -302,7 +353,7 @@
* the new month or year.
* <p>
* WeekFields instances are singletons; for each unique combination
- * of {@code firstDayOfWeek} and {@code minimalDaysInFirstWeek} the
+ * of {@code firstDayOfWeek} and {@code minimalDaysInFirstWeek}
* the same instance will be returned.
*
* @param firstDayOfWeek the first day of the week, not null
@@ -1032,6 +1083,13 @@
Objects.requireNonNull(locale, "locale");
if (rangeUnit == YEARS) { // only have values for week-of-year
// Android-changed: Use ICU name values.
+ /*
+ LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased()
+ .getLocaleResources(
+ CalendarDataUtility.findRegionOverride(locale));
+ ResourceBundle rb = lr.getJavaTimeFormatData();
+ return rb.containsKey("field.week") ? rb.getString("field.week") : name;
+ */
DateTimePatternGenerator dateTimePatternGenerator = DateTimePatternGenerator
.getInstance(ULocale.forLocale(locale));
String icuName = dateTimePatternGenerator
diff --git a/ojluni/src/main/java/java/time/zone/ZoneOffsetTransition.java b/ojluni/src/main/java/java/time/zone/ZoneOffsetTransition.java
index bc9cafe..94264f3 100644
--- a/ojluni/src/main/java/java/time/zone/ZoneOffsetTransition.java
+++ b/ojluni/src/main/java/java/time/zone/ZoneOffsetTransition.java
@@ -104,6 +104,10 @@
*/
private static final long serialVersionUID = -6946044323557704546L;
/**
+ * The transition epoch-second.
+ */
+ private final long epochSecond;
+ /**
* The local transition date-time at the transition.
*/
private final LocalDateTime transition;
@@ -152,6 +156,8 @@
* @param offsetAfter the offset at and after the transition, not null
*/
ZoneOffsetTransition(LocalDateTime transition, ZoneOffset offsetBefore, ZoneOffset offsetAfter) {
+ assert transition.getNano() == 0;
+ this.epochSecond = transition.toEpochSecond(offsetBefore);
this.transition = transition;
this.offsetBefore = offsetBefore;
this.offsetAfter = offsetAfter;
@@ -165,6 +171,7 @@
* @param offsetAfter the offset at and after the transition, not null
*/
ZoneOffsetTransition(long epochSecond, ZoneOffset offsetBefore, ZoneOffset offsetAfter) {
+ this.epochSecond = epochSecond;
this.transition = LocalDateTime.ofEpochSecond(epochSecond, 0, offsetBefore);
this.offsetBefore = offsetBefore;
this.offsetAfter = offsetAfter;
@@ -209,7 +216,7 @@
* @throws IOException if an error occurs
*/
void writeExternal(DataOutput out) throws IOException {
- Ser.writeEpochSec(toEpochSecond(), out);
+ Ser.writeEpochSec(epochSecond, out);
Ser.writeOffset(offsetBefore, out);
Ser.writeOffset(offsetAfter, out);
}
@@ -244,7 +251,7 @@
* @return the transition instant, not null
*/
public Instant getInstant() {
- return transition.toInstant(offsetBefore);
+ return Instant.ofEpochSecond(epochSecond);
}
/**
@@ -253,7 +260,7 @@
* @return the transition epoch second
*/
public long toEpochSecond() {
- return transition.toEpochSecond(offsetBefore);
+ return epochSecond;
}
//-------------------------------------------------------------------------
@@ -380,9 +387,9 @@
*/
List<ZoneOffset> getValidOffsets() {
if (isGap()) {
- return Collections.emptyList();
+ return List.of();
}
- return Arrays.asList(getOffsetBefore(), getOffsetAfter());
+ return List.of(getOffsetBefore(), getOffsetAfter());
}
//-----------------------------------------------------------------------
@@ -397,7 +404,7 @@
*/
@Override
public int compareTo(ZoneOffsetTransition transition) {
- return this.getInstant().compareTo(transition.getInstant());
+ return Long.compare(epochSecond, transition.epochSecond);
}
//-----------------------------------------------------------------------
@@ -416,7 +423,7 @@
}
if (other instanceof ZoneOffsetTransition) {
ZoneOffsetTransition d = (ZoneOffsetTransition) other;
- return transition.equals(d.transition) &&
+ return epochSecond == d.epochSecond &&
offsetBefore.equals(d.offsetBefore) && offsetAfter.equals(d.offsetAfter);
}
return false;
diff --git a/ojluni/src/main/java/java/time/zone/ZoneOffsetTransitionRule.java b/ojluni/src/main/java/java/time/zone/ZoneOffsetTransitionRule.java
index db1a055..68d3469 100644
--- a/ojluni/src/main/java/java/time/zone/ZoneOffsetTransitionRule.java
+++ b/ojluni/src/main/java/java/time/zone/ZoneOffsetTransitionRule.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -167,6 +167,7 @@
* @return the rule, not null
* @throws IllegalArgumentException if the day of month indicator is invalid
* @throws IllegalArgumentException if the end of day flag is true when the time is not midnight
+ * @throws IllegalArgumentException if {@code time.getNano()} returns non-zero value
*/
public static ZoneOffsetTransitionRule of(
Month month,
@@ -190,6 +191,9 @@
if (timeEndOfDay && time.equals(LocalTime.MIDNIGHT) == false) {
throw new IllegalArgumentException("Time must be midnight when end of day flag is true");
}
+ if (time.getNano() != 0) {
+ throw new IllegalArgumentException("Time's nano-of-second must be zero");
+ }
return new ZoneOffsetTransitionRule(month, dayOfMonthIndicator, dayOfWeek, time, timeEndOfDay, timeDefnition, standardOffset, offsetBefore, offsetAfter);
}
@@ -220,6 +224,7 @@
ZoneOffset standardOffset,
ZoneOffset offsetBefore,
ZoneOffset offsetAfter) {
+ assert time.getNano() == 0;
this.month = month;
this.dom = (byte) dayOfMonthIndicator;
this.dow = dayOfWeek;
@@ -251,7 +256,7 @@
* for the encoding of epoch seconds and offsets.
* <pre style="font-size:1.0em">{@code
*
- * out.writeByte(3); // identifies a ZoneOffsetTransition
+ * out.writeByte(3); // identifies a ZoneOffsetTransitionRule
* final int timeSecs = (timeEndOfDay ? 86400 : time.toSecondOfDay());
* final int stdOffset = standardOffset.getTotalSeconds();
* final int beforeDiff = offsetBefore.getTotalSeconds() - stdOffset;
diff --git a/ojluni/src/main/java/java/time/zone/ZoneRules.java b/ojluni/src/main/java/java/time/zone/ZoneRules.java
index c3b5bba..6eaba2e 100644
--- a/ojluni/src/main/java/java/time/zone/ZoneRules.java
+++ b/ojluni/src/main/java/java/time/zone/ZoneRules.java
@@ -303,7 +303,6 @@
* Creates an instance of ZoneRules that has fixed zone rules.
*
* @param offset the offset this fixed zone rules is based on, not null
- * @return the zone rules, not null
* @see #isFixedOffset()
*/
private ZoneRules(ZoneOffset offset) {
@@ -420,7 +419,10 @@
}
/**
- * Reads the state from the stream.
+ * Reads the state from the stream. The 1,024 limit to the lengths
+ * of stdTrans and savSize is intended to be the size well enough
+ * to accommodate the max number of transitions in current tzdb data
+ * (203 for Asia/Tehran).
*
* @param in the input stream, not null
* @return the created object, not null
@@ -428,6 +430,9 @@
*/
static ZoneRules readExternal(DataInput in) throws IOException, ClassNotFoundException {
int stdSize = in.readInt();
+ if (stdSize > 1024) {
+ throw new InvalidObjectException("Too many transitions");
+ }
long[] stdTrans = (stdSize == 0) ? EMPTY_LONG_ARRAY
: new long[stdSize];
for (int i = 0; i < stdSize; i++) {
@@ -438,6 +443,9 @@
stdOffsets[i] = Ser.readOffset(in);
}
int savSize = in.readInt();
+ if (savSize > 1024) {
+ throw new InvalidObjectException("Too many saving offsets");
+ }
long[] savTrans = (savSize == 0) ? EMPTY_LONG_ARRAY
: new long[savSize];
for (int i = 0; i < savSize; i++) {
@@ -448,6 +456,9 @@
savOffsets[i] = Ser.readOffset(in);
}
int ruleSize = in.readByte();
+ if (ruleSize > 16) {
+ throw new InvalidObjectException("Too many transition rules");
+ }
ZoneOffsetTransitionRule[] rules = (ruleSize == 0) ?
EMPTY_LASTRULES : new ZoneOffsetTransitionRule[ruleSize];
for (int i = 0; i < ruleSize; i++) {
@@ -614,7 +625,7 @@
* One technique, using this method, would be:
* <pre>
* ZoneOffsetTransition trans = rules.getTransition(localDT);
- * if (trans == null) {
+ * if (trans != null) {
* // Gap or Overlap: determine what to do from transition
* } else {
* // Normal case: only one valid offset
@@ -872,13 +883,13 @@
/**
* Gets the previous transition before the specified instant.
* <p>
- * This returns details of the previous transition after the specified instant.
+ * This returns details of the previous transition before the specified instant.
* For example, if the instant represents a point where "summer" daylight saving time
* applies, then the method will return the transition from the previous "winter" time.
*
* @param instant the instant to get the previous transition after, not null, but null
* may be ignored if the rules have a single offset for all instants
- * @return the previous transition after the specified instant, null if this is before the first transition
+ * @return the previous transition before the specified instant, null if this is before the first transition
*/
public ZoneOffsetTransition previousTransition(Instant instant) {
if (savingsInstantTransitions.length == 0) {
@@ -970,7 +981,7 @@
* @return an immutable list of transition rules, not null
*/
public List<ZoneOffsetTransitionRule> getTransitionRules() {
- return Collections.unmodifiableList(Arrays.asList(lastRules));
+ return List.of(lastRules);
}
/**
diff --git a/ojluni/src/main/java/java/time/zone/ZoneRulesProvider.java b/ojluni/src/main/java/java/time/zone/ZoneRulesProvider.java
index a90727a..acc04fc 100644
--- a/ojluni/src/main/java/java/time/zone/ZoneRulesProvider.java
+++ b/ojluni/src/main/java/java/time/zone/ZoneRulesProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -77,6 +77,7 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.Collections;
/**
* Provider of time-zone rules to the system.
@@ -118,7 +119,7 @@
* Providers must ensure that once a rule has been seen by the application, the
* rule must continue to be available.
* <p>
-* Providers are encouraged to implement a meaningful {@code toString} method.
+ * Providers are encouraged to implement a meaningful {@code toString} method.
* <p>
* Many systems would like to update time-zone rules dynamically without stopping the JVM.
* When examined in detail, this is a complex problem.
@@ -137,10 +138,66 @@
*/
private static final ConcurrentMap<String, ZoneRulesProvider> ZONES = new ConcurrentHashMap<>(512, 0.75f, 2);
+ /**
+ * The zone ID data
+ */
+ private static volatile Set<String> ZONE_IDS;
+
static {
- // Android-changed: use a single hard-coded provider.
+ // BEGIN Android-changed: use a single hard-coded provider.
+ /*
+ // if the property java.time.zone.DefaultZoneRulesProvider is
+ // set then its value is the class name of the default provider
+ final List<ZoneRulesProvider> loaded = new ArrayList<>();
+ AccessController.doPrivileged(new PrivilegedAction<>() {
+ public Object run() {
+ String prop = System.getProperty("java.time.zone.DefaultZoneRulesProvider");
+ if (prop != null) {
+ try {
+ Class<?> c = Class.forName(prop, true, ClassLoader.getSystemClassLoader());
+ @SuppressWarnings("deprecation")
+ ZoneRulesProvider provider = ZoneRulesProvider.class.cast(c.newInstance());
+ registerProvider(provider);
+ loaded.add(provider);
+ } catch (Exception x) {
+ throw new Error(x);
+ }
+ } else {
+ registerProvider(new TzdbZoneRulesProvider());
+ }
+ return null;
+ }
+ });
+
+ ServiceLoader<ZoneRulesProvider> sl = ServiceLoader.load(ZoneRulesProvider.class, ClassLoader.getSystemClassLoader());
+ Iterator<ZoneRulesProvider> it = sl.iterator();
+ while (it.hasNext()) {
+ ZoneRulesProvider provider;
+ try {
+ provider = it.next();
+ } catch (ServiceConfigurationError ex) {
+ if (ex.getCause() instanceof SecurityException) {
+ continue; // ignore the security exception, try the next provider
+ }
+ throw ex;
+ }
+ boolean found = false;
+ for (ZoneRulesProvider p : loaded) {
+ if (p.getClass() == provider.getClass()) {
+ found = true;
+ }
+ }
+ if (!found) {
+ registerProvider0(provider);
+ loaded.add(provider);
+ }
+ }
+ // CopyOnWriteList could be slow if lots of providers and each added individually
+ PROVIDERS.addAll(loaded);
+ */
ZoneRulesProvider provider = new IcuZoneRulesProvider();
registerProvider(provider);
+ // END Android-changed: use a single hard-coded provider.
}
//-------------------------------------------------------------------------
@@ -149,10 +206,10 @@
* <p>
* These IDs are the string form of a {@link ZoneId}.
*
- * @return a modifiable copy of the set of zone IDs, not null
+ * @return the unmodifiable set of zone IDs, not null
*/
public static Set<String> getAvailableZoneIds() {
- return new HashSet<>(ZONES.keySet());
+ return ZONE_IDS;
}
/**
@@ -258,7 +315,7 @@
* @param provider the provider to register, not null
* @throws ZoneRulesException if unable to complete the registration
*/
- private static void registerProvider0(ZoneRulesProvider provider) {
+ private static synchronized void registerProvider0(ZoneRulesProvider provider) {
for (String zoneId : provider.provideZoneIds()) {
Objects.requireNonNull(zoneId, "zoneId");
ZoneRulesProvider old = ZONES.putIfAbsent(zoneId, provider);
@@ -268,6 +325,8 @@
", currently loading from provider: " + provider);
}
}
+ Set<String> combinedSet = new HashSet<String>(ZONES.keySet());
+ ZONE_IDS = Collections.unmodifiableSet(combinedSet);
}
/**
diff --git a/ojluni/src/main/java/java/time/zone/package-info.java b/ojluni/src/main/java/java/time/zone/package-info.java
index f50b3de..e5c6a75 100644
--- a/ojluni/src/main/java/java/time/zone/package-info.java
+++ b/ojluni/src/main/java/java/time/zone/package-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -70,7 +70,7 @@
* gaps and overlaps in the local time-line typically caused by Daylight Saving Time.
* </p>
*
- * <h3>Package specification</h3>
+ * <h2>Package specification</h2>
* <p>
* Unless otherwise noted, passing a null argument to a constructor or method in any class or interface
* in this package will cause a {@link java.lang.NullPointerException NullPointerException} to be thrown.
@@ -81,6 +81,6 @@
* All calculations should check for numeric overflow and throw either an {@link java.lang.ArithmeticException}
* or a {@link java.time.DateTimeException}.
* </p>
- * @since JDK1.8
+ * @since 1.8
*/
package java.time.zone;
diff --git a/ojluni/src/main/java/java/util/EnumSet.java b/ojluni/src/main/java/java/util/EnumSet.java
index bde3a3a..cef74b7 100644
--- a/ojluni/src/main/java/java/util/EnumSet.java
+++ b/ojluni/src/main/java/java/util/EnumSet.java
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -75,20 +75,26 @@
* @since 1.5
* @see EnumMap
*/
-@SuppressWarnings("serial") // No serialVersionUID due to usage of
- // serial proxy pattern
+@SuppressWarnings("serial") // No serialVersionUID declared
public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
implements Cloneable, java.io.Serializable
{
+ // The following must be present in order to preserve the same computed
+ // serialVersionUID value as JDK 8, and to prevent the appearance of
+ // the fields in the Serialized Form documentation. See JDK-8227368.
+ static Enum<?>[] access$000() { return null; }
+ private static final java.io.ObjectStreamField[] serialPersistentFields
+ = new java.io.ObjectStreamField[0];
+
/**
* The class of all the elements of this set.
*/
- final transient Class<E> elementType;
+ final Class<E> elementType;
/**
* All of the values comprising E. (Cached for performance.)
*/
- final transient Enum<?>[] universe;
+ final Enum<?>[] universe;
EnumSet(Class<E>elementType, Enum<?>[] universe) {
this.elementType = elementType;
diff --git a/ojluni/src/main/java/java/util/ImmutableCollections.java b/ojluni/src/main/java/java/util/ImmutableCollections.java
index e42538c..a756669 100644
--- a/ojluni/src/main/java/java/util/ImmutableCollections.java
+++ b/ojluni/src/main/java/java/util/ImmutableCollections.java
@@ -35,6 +35,8 @@
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.UnaryOperator;
+import jdk.internal.misc.SharedSecrets;
+import jdk.internal.misc.VM;
import jdk.internal.vm.annotation.Stable;
/**
@@ -409,7 +411,16 @@
static final class ListN<E> extends AbstractImmutableList<E>
implements Serializable {
- static final List<?> EMPTY_LIST = new ListN<>();
+ // EMPTY_LIST may be initialized from the CDS archive.
+ static @Stable List<?> EMPTY_LIST;
+
+ static {
+ // Android-removed: VM.initializeFromArchive() isn't supported on Android.
+ // VM.initializeFromArchive(ListN.class);
+ if (EMPTY_LIST == null) {
+ EMPTY_LIST = new ListN<>();
+ }
+ }
@Stable
private final E[] elements;
@@ -618,7 +629,20 @@
* least one null is always present.
* @param <E> the element type
*/
- static final class SetN<E> extends AbstractImmutableSet<E> {
+ static final class SetN<E> extends AbstractImmutableSet<E>
+ implements Serializable {
+
+ // EMPTY_SET may be initialized from the CDS archive.
+ static @Stable Set<?> EMPTY_SET;
+
+ static {
+ // Android-removed: VM.initializeFromArchive isn't supported on Android.
+ // VM.initializeFromArchive(SetN.class);
+ if (EMPTY_SET == null) {
+ EMPTY_SET = new SetN<>();
+ }
+ }
+
@Stable
final E[] elements;
@Stable
@@ -797,6 +821,11 @@
}
@Override
+ public V get(Object o) {
+ return o.equals(k0) ? v0 : null; // implicit nullcheck of o
+ }
+
+ @Override
public boolean containsKey(Object o) {
return o.equals(k0); // implicit nullcheck of o
}
@@ -830,6 +859,18 @@
* @param <V> the value type
*/
static final class MapN<K,V> extends AbstractImmutableMap<K,V> {
+
+ // EMPTY_MAP may be initialized from the CDS archive.
+ static @Stable Map<?,?> EMPTY_MAP;
+
+ static {
+ // Android-removed: VM.initializeFromArchive() isn't supported on Android.
+ // VM.initializeFromArchive(MapN.class);
+ if (EMPTY_MAP == null) {
+ EMPTY_MAP = new MapN<>();
+ }
+ }
+
@Stable
final Object[] table; // pairs of key, value
@Stable
diff --git a/ojluni/src/main/java/java/util/JapaneseImperialCalendar.java b/ojluni/src/main/java/java/util/JapaneseImperialCalendar.java
index 2cc8b01..a652b1f 100644
--- a/ojluni/src/main/java/java/util/JapaneseImperialCalendar.java
+++ b/ojluni/src/main/java/java/util/JapaneseImperialCalendar.java
@@ -45,11 +45,11 @@
* ERA value Era name Since (in Gregorian)
* ------------------------------------------------------
* 0 N/A N/A
- * 1 Meiji 1868-01-01 midnight local time
- * 2 Taisho 1912-07-30 midnight local time
- * 3 Showa 1926-12-25 midnight local time
- * 4 Heisei 1989-01-08 midnight local time
- * 5 Reiwa 2019-05-01 midnight local time
+ * 1 Meiji 1868-01-01T00:00:00 local time
+ * 2 Taisho 1912-07-30T00:00:00 local time
+ * 3 Showa 1926-12-25T00:00:00 local time
+ * 4 Heisei 1989-01-08T00:00:00 local time
+ * 5 Reiwa 2019-05-01T00:00:00 local time
* ------------------------------------------------------
* }</pre>
*
@@ -1002,9 +1002,11 @@
String name = CalendarDataUtility.retrieveFieldValueName(getCalendarType(), field,
fieldValue, style, locale);
- // If the ERA value is null, then
+ // If the ERA value is null or empty, then
// try to get its name or abbreviation from the Era instance.
- if (name == null && field == ERA && fieldValue < eras.length) {
+ if ((name == null || name.isEmpty()) &&
+ field == ERA &&
+ fieldValue < eras.length) {
Era era = eras[fieldValue];
name = (style == SHORT) ? era.getAbbreviation() : era.getName();
}
diff --git a/ojluni/src/main/java/javax/crypto/Cipher.java b/ojluni/src/main/java/javax/crypto/Cipher.java
index 7968f2f..53e7fb8 100644
--- a/ojluni/src/main/java/javax/crypto/Cipher.java
+++ b/ojluni/src/main/java/javax/crypto/Cipher.java
@@ -46,6 +46,7 @@
import java.nio.ReadOnlyBufferException;
import sun.security.jca.*;
+/* Android-changed: preformatted example updated to work with Dokka (b/209921086). */
/**
* This class provides the functionality of a cryptographic cipher for
* encryption and decryption. It forms the core of the Java Cryptographic
@@ -74,9 +75,9 @@
* provider-specific default values for the mode and padding scheme are used).
* For example, the following is a valid transformation:
*
- * <pre>
- * Cipher c = Cipher.getInstance("<i>DES/CBC/PKCS5Padding</i>");
- * </pre>
+ * <pre>{@code
+ * Cipher c = Cipher.getInstance("DES/CBC/PKCS5Padding");
+ * }</pre>
*
* Using modes such as <code>CFB</code> and <code>OFB</code>, block
* ciphers can encrypt data in units smaller than the cipher's actual
diff --git a/ojluni/src/main/java/javax/crypto/CipherSpi.java b/ojluni/src/main/java/javax/crypto/CipherSpi.java
index ce72581..4b23c38 100644
--- a/ojluni/src/main/java/javax/crypto/CipherSpi.java
+++ b/ojluni/src/main/java/javax/crypto/CipherSpi.java
@@ -40,6 +40,7 @@
import java.nio.ByteBuffer;
+/* Android-changed: preformatted example updated to work with Dokka (b/209921086). */
/**
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
* for the <code>Cipher</code> class.
@@ -74,9 +75,9 @@
* provider-specific default values for the mode and padding scheme are used).
* For example, the following is a valid transformation:
*
- * <pre>
- * Cipher c = Cipher.getInstance("<i>DES/CBC/PKCS5Padding</i>");
- * </pre>
+ * <pre>{@code
+ * Cipher c = Cipher.getInstance("DES/CBC/PKCS5Padding");
+ * }</pre>
*
* <p>A provider may supply a separate class for each combination
* of <i>algorithm/mode/padding</i>, or may decide to provide more generic
diff --git a/ojluni/src/main/java/javax/crypto/spec/GCMParameterSpec.java b/ojluni/src/main/java/javax/crypto/spec/GCMParameterSpec.java
index 403205a..879d729 100644
--- a/ojluni/src/main/java/javax/crypto/spec/GCMParameterSpec.java
+++ b/ojluni/src/main/java/javax/crypto/spec/GCMParameterSpec.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -120,7 +120,7 @@
// Input sanity check
if ((src == null) ||(len < 0) || (offset < 0)
- || ((len + offset) > src.length)) {
+ || (len > (src.length - offset))) {
throw new IllegalArgumentException("Invalid buffer arguments");
}
diff --git a/ojluni/src/main/java/javax/crypto/spec/IvParameterSpec.java b/ojluni/src/main/java/javax/crypto/spec/IvParameterSpec.java
index 243c848..6a3d311 100644
--- a/ojluni/src/main/java/javax/crypto/spec/IvParameterSpec.java
+++ b/ojluni/src/main/java/javax/crypto/spec/IvParameterSpec.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -76,13 +76,16 @@
if (iv == null) {
throw new IllegalArgumentException("IV missing");
}
- if (iv.length - offset < len) {
- throw new IllegalArgumentException
- ("IV buffer too short for given offset/length combination");
+ if (offset < 0) {
+ throw new ArrayIndexOutOfBoundsException("offset is negative");
}
if (len < 0) {
throw new ArrayIndexOutOfBoundsException("len is negative");
}
+ if (iv.length - offset < len) {
+ throw new IllegalArgumentException
+ ("IV buffer too short for given offset/length combination");
+ }
this.iv = new byte[len];
System.arraycopy(iv, offset, this.iv, 0, len);
}
diff --git a/ojluni/src/main/java/javax/crypto/spec/PBEKeySpec.java b/ojluni/src/main/java/javax/crypto/spec/PBEKeySpec.java
index 239231d..8f8d141 100644
--- a/ojluni/src/main/java/javax/crypto/spec/PBEKeySpec.java
+++ b/ojluni/src/main/java/javax/crypto/spec/PBEKeySpec.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
package javax.crypto.spec;
import java.security.spec.KeySpec;
+import java.util.Arrays;
/**
* A user-chosen password that can be used with password-based encryption
@@ -174,9 +175,7 @@
*/
public final void clearPassword() {
if (password != null) {
- for (int i = 0; i < password.length; i++) {
- password[i] = ' ';
- }
+ Arrays.fill(password, ' ');
password = null;
}
}
diff --git a/ojluni/src/main/java/javax/net/ssl/SSLSessionContext.java b/ojluni/src/main/java/javax/net/ssl/SSLSessionContext.java
index b6f6fb6..04a02fb 100644
--- a/ojluni/src/main/java/javax/net/ssl/SSLSessionContext.java
+++ b/ojluni/src/main/java/javax/net/ssl/SSLSessionContext.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -87,10 +87,17 @@
* A check for sessions exceeding the timeout is made immediately whenever
* the timeout limit is changed for this <code>SSLSessionContext</code>.
*
- * @param seconds the new session timeout limit in seconds; zero means
- * there is no limit.
+ * @apiNote Note that the JDK Implementation uses default values for both
+ * the session cache size and timeout. See
+ * {@code getSessionCacheSize} and {@code getSessionTimeout} for
+ * more information. Applications should consider their
+ * performance requirements and override the defaults if necessary.
*
- * @exception IllegalArgumentException if the timeout specified is {@code < 0}.
+ * @param seconds the new session timeout limit in seconds; zero means
+ * there is no limit.
+ *
+ * @throws IllegalArgumentException if the timeout specified is {@code < 0}.
+ *
* @see #getSessionTimeout
*/
public void setSessionTimeout(int seconds)
@@ -109,33 +116,51 @@
* whenever the timeout limit is changed for this
* <code>SSLSessionContext</code>.
*
+ * @implNote The JDK implementation returns the session timeout as set by
+ * the {@code setSessionTimeout} method, or if not set, a default
+ * value of 86400 seconds (24 hours).
+ *
* @return the session timeout limit in seconds; zero means there is no
- * limit.
+ * limit.
+ *
* @see #setSessionTimeout
*/
public int getSessionTimeout();
/**
- * Sets the size of the cache used for storing
- * <code>SSLSession</code> objects grouped under this
- * <code>SSLSessionContext</code>.
+ * Sets the size of the cache used for storing <code>SSLSession</code>
+ * objects grouped under this <code>SSLSessionContext</code>.
+ *
+ * @apiNote Note that the JDK Implementation uses default values for both
+ * the session cache size and timeout. See
+ * {@code getSessionCacheSize} and {@code getSessionTimeout} for
+ * more information. Applications should consider their
+ * performance requirements and override the defaults if necessary.
*
* @param size the new session cache size limit; zero means there is no
- * limit.
- * @exception IllegalArgumentException if the specified size is {@code < 0}.
+ * limit.
+ *
+ * @throws IllegalArgumentException if the specified size is {@code < 0}.
+ *
* @see #getSessionCacheSize
*/
public void setSessionCacheSize(int size)
throws IllegalArgumentException;
+ // Android-changed: Modified unsupported @systemProperty javadoc tag.
/**
- * Returns the size of the cache used for storing
- * <code>SSLSession</code> objects grouped under this
- * <code>SSLSessionContext</code>.
+ * Returns the size of the cache used for storing <code>SSLSession</code>
+ * objects grouped under this <code>SSLSessionContext</code>.
+ *
+ * @implNote The JDK implementation returns the cache size as set by
+ * the {@code setSessionCacheSize} method, or if not set, the
+ * value of the {@code javax.net.ssl.sessionCacheSize}
+ * system property. If neither is set, it returns a default
+ * value of 20480.
*
* @return size of the session cache; zero means there is no size limit.
+ *
* @see #setSessionCacheSize
*/
public int getSessionCacheSize();
-
}
diff --git a/ojluni/src/main/java/jdk/internal/misc/SharedSecrets.java b/ojluni/src/main/java/jdk/internal/misc/SharedSecrets.java
index 0bec488..aa2255b 100644
--- a/ojluni/src/main/java/jdk/internal/misc/SharedSecrets.java
+++ b/ojluni/src/main/java/jdk/internal/misc/SharedSecrets.java
@@ -57,11 +57,13 @@
private static JavaUtilZipFileAccess javaUtilZipFileAccess;
private static JavaAWTAccess javaAWTAccess;
private static JavaOISAccess javaOISAccess;
+ private static JavaObjectInputStreamReadString javaObjectInputStreamReadString;
*/
// END Android-removed: Pruned unused access interfaces.
private static JavaObjectInputStreamAccess javaObjectInputStreamAccess;
// BEGIN Android-removed: Pruned unused access interfaces.
/*
+ private static JavaSecuritySignatureAccess javaSecuritySignatureAccess;
public static JavaUtilJarAccess javaUtilJarAccess() {
if (javaUtilJarAccess == null) {
@@ -215,6 +217,17 @@
}
return javaAWTAccess;
}
+
+ public static JavaObjectInputStreamReadString getJavaObjectInputStreamReadString() {
+ if (javaObjectInputStreamReadString == null) {
+ unsafe.ensureClassInitialized(ObjectInputStream.class);
+ }
+ return javaObjectInputStreamReadString;
+ }
+
+ public static void setJavaObjectInputStreamReadString(JavaObjectInputStreamReadString access) {
+ javaObjectInputStreamReadString = access;
+ }
*/
// END Android-removed: Pruned unused access interfaces.
@@ -228,4 +241,19 @@
public static void setJavaObjectInputStreamAccess(JavaObjectInputStreamAccess access) {
javaObjectInputStreamAccess = access;
}
+
+ // BEGIN Android-removed: Pruned unused access interfaces.
+ /*
+ public static void setJavaSecuritySignatureAccess(JavaSecuritySignatureAccess jssa) {
+ javaSecuritySignatureAccess = jssa;
+ }
+
+ public static JavaSecuritySignatureAccess getJavaSecuritySignatureAccess() {
+ if (javaSecuritySignatureAccess == null) {
+ unsafe.ensureClassInitialized(Signature.class);
+ }
+ return javaSecuritySignatureAccess;
+ }
+ */
+ // END Android-removed: Pruned unused access interfaces.
}
diff --git a/ojluni/src/main/java/jdk/internal/misc/Unsafe.java b/ojluni/src/main/java/jdk/internal/misc/Unsafe.java
index 12b4166..320cb27 100644
--- a/ojluni/src/main/java/jdk/internal/misc/Unsafe.java
+++ b/ojluni/src/main/java/jdk/internal/misc/Unsafe.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
diff --git a/ojluni/src/main/java/jdk/internal/misc/VM.java b/ojluni/src/main/java/jdk/internal/misc/VM.java
index a532637..3c799bc 100644
--- a/ojluni/src/main/java/jdk/internal/misc/VM.java
+++ b/ojluni/src/main/java/jdk/internal/misc/VM.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
package jdk.internal.misc;
import static java.lang.Thread.State.*;
+
+import dalvik.annotation.optimization.CriticalNative;
import java.util.Properties;
import java.util.HashMap;
import java.util.Map;
@@ -403,6 +405,38 @@
private final static int JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010;
private final static int JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020;
+ // Android-changed: Add @CriticalNative for performance to be consistent with System.currentTimeMillis().
+ /**
+ * Get a nanosecond time stamp adjustment in the form of a single long.
+ *
+ * This value can be used to create an instant using
+ * {@link java.time.Instant#ofEpochSecond(long, long)
+ * java.time.Instant.ofEpochSecond(offsetInSeconds,
+ * getNanoTimeAdjustment(offsetInSeconds))}.
+ * <p>
+ * The value returned has the best resolution available to the JVM on
+ * the current system.
+ * This is usually down to microseconds - or tenth of microseconds -
+ * depending on the OS/Hardware and the JVM implementation.
+ *
+ * @param offsetInSeconds The offset in seconds from which the nanosecond
+ * time stamp should be computed.
+ *
+ * @apiNote The offset should be recent enough - so that
+ * {@code offsetInSeconds} is within {@code +/- 2^32} seconds of the
+ * current UTC time. If the offset is too far off, {@code -1} will be
+ * returned. As such, {@code -1} must not be considered as a valid
+ * nano time adjustment, but as an exception value indicating
+ * that an offset closer to the current time should be used.
+ *
+ * @return A nanosecond time stamp adjustment in the form of a single long.
+ * If the offset is too far off the current time, this method returns -1.
+ * In that case, the caller should call this method again, passing a
+ * more accurate offset.
+ */
+ @CriticalNative
+ public static native long getNanoTimeAdjustment(long offsetInSeconds);
+
// BEGIN Android-removed: latestUserDefinedLoader()/initialize() not supported.
// /*
// * Returns the first non-null class loader up the execution stack,
@@ -415,4 +449,18 @@
// }
// private native static void initialize();
// END Android-removed: latestUserDefinedLoader()/initialize() not supported.
+
+ // BEGIN Android-removed: initializeFromArchive() not supported.
+ /*
+ * Initialize archived static fields in the given Class using archived
+ * values from CDS dump time. Also initialize the classes of objects in
+ * the archived graph referenced by those fields.
+ *
+ * Those static fields remain as uninitialized if there is no mapped CDS
+ * java heap data or there is any error during initialization of the
+ * object class in the archived graph.
+ *
+ public static native void initializeFromArchive(Class<?> c);
+ */
+ // END Android-removed: initializeFromArchive() not supported.
}
diff --git a/ojluni/src/main/java/jdk/internal/util/ArraysSupport.java b/ojluni/src/main/java/jdk/internal/util/ArraysSupport.java
index 50ea4f0..90cb1a3 100644
--- a/ojluni/src/main/java/jdk/internal/util/ArraysSupport.java
+++ b/ojluni/src/main/java/jdk/internal/util/ArraysSupport.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
diff --git a/ojluni/src/main/java/jdk/internal/util/Preconditions.java b/ojluni/src/main/java/jdk/internal/util/Preconditions.java
index cb1b748..d275b15 100644
--- a/ojluni/src/main/java/jdk/internal/util/Preconditions.java
+++ b/ojluni/src/main/java/jdk/internal/util/Preconditions.java
@@ -185,13 +185,13 @@
// Switch to default if fewer or more arguments than required are supplied
switch ((args.size() != argSize) ? "" : checkKind) {
case "checkIndex":
- return String.format("Index %d out-of-bounds for length %d",
+ return String.format("Index %s out of bounds for length %s",
args.get(0), args.get(1));
case "checkFromToIndex":
- return String.format("Range [%d, %d) out-of-bounds for length %d",
+ return String.format("Range [%s, %s) out of bounds for length %s",
args.get(0), args.get(1), args.get(2));
case "checkFromIndexSize":
- return String.format("Range [%d, %<d + %d) out-of-bounds for length %d",
+ return String.format("Range [%s, %<s + %s) out of bounds for length %s",
args.get(0), args.get(1), args.get(2));
default:
return String.format("Range check failed: %s %s", checkKind, args);
diff --git a/ojluni/src/main/java/sun/nio/ch/ChannelInputStream.java b/ojluni/src/main/java/sun/nio/ch/ChannelInputStream.java
index e2f8092..4237365 100644
--- a/ojluni/src/main/java/sun/nio/ch/ChannelInputStream.java
+++ b/ojluni/src/main/java/sun/nio/ch/ChannelInputStream.java
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
import java.nio.*;
import java.nio.channels.*;
import java.nio.channels.spi.*;
-
+import java.util.Objects;
/**
* This class is defined here rather than in java.nio.channels.Channels
@@ -88,10 +88,8 @@
public synchronized int read(byte[] bs, int off, int len)
throws IOException
{
- if ((off < 0) || (off > bs.length) || (len < 0) ||
- ((off + len) > bs.length) || ((off + len) < 0)) {
- throw new IndexOutOfBoundsException();
- } else if (len == 0)
+ Objects.checkFromIndexSize(off, len, bs.length);
+ if (len == 0)
return 0;
ByteBuffer bb = ((this.bs == bs)
@@ -120,6 +118,27 @@
return 0;
}
+ public synchronized long skip(long n) throws IOException {
+ // special case where the channel is to a file
+ if (ch instanceof SeekableByteChannel) {
+ SeekableByteChannel sbc = (SeekableByteChannel)ch;
+ long pos = sbc.position();
+ long newPos;
+ if (n > 0) {
+ newPos = pos + n;
+ long size = sbc.size();
+ if (newPos < 0 || newPos > size) {
+ newPos = size;
+ }
+ } else {
+ newPos = Long.max(pos + n, 0);
+ }
+ sbc.position(newPos);
+ return newPos - pos;
+ }
+ return super.skip(n);
+ }
+
public void close() throws IOException {
ch.close();
}
diff --git a/ojluni/src/main/java/sun/nio/fs/AbstractUserDefinedFileAttributeView.java b/ojluni/src/main/java/sun/nio/fs/AbstractUserDefinedFileAttributeView.java
index 3886aa1..a349b08 100644
--- a/ojluni/src/main/java/sun/nio/fs/AbstractUserDefinedFileAttributeView.java
+++ b/ojluni/src/main/java/sun/nio/fs/AbstractUserDefinedFileAttributeView.java
@@ -83,7 +83,7 @@
names = list();
break;
} else {
- if (name.length() == 0)
+ if (name.isEmpty())
throw new IllegalArgumentException();
names.add(name);
}
diff --git a/ojluni/src/main/java/sun/security/x509/OCSPNoCheckExtension.java b/ojluni/src/main/java/sun/security/x509/OCSPNoCheckExtension.java
index 35e4cc5..9afa740 100644
--- a/ojluni/src/main/java/sun/security/x509/OCSPNoCheckExtension.java
+++ b/ojluni/src/main/java/sun/security/x509/OCSPNoCheckExtension.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,8 +38,8 @@
* lifetime of the responder's certificate. The CA does so by including
* the extension id-pkix-ocsp-nocheck. This SHOULD be a non-critical
* extension. The value of the extension should be NULL. CAs issuing
- * such a certificate should realized that a compromise of the
- * responder's key, is as serious as the compromise of a CA key used to
+ * such a certificate should realize that a compromise of the
+ * responder's key is as serious as the compromise of a CA key used to
* sign CRLs, at least for the validity period of this certificate. CA's
* may choose to issue this type of certificate with a very short
* lifetime and renew it frequently.
diff --git a/ojluni/src/main/java/sun/util/locale/InternalLocaleBuilder.java b/ojluni/src/main/java/sun/util/locale/InternalLocaleBuilder.java
index 81fa86e..cd42ca0 100644
--- a/ojluni/src/main/java/sun/util/locale/InternalLocaleBuilder.java
+++ b/ojluni/src/main/java/sun/util/locale/InternalLocaleBuilder.java
@@ -331,7 +331,7 @@
done.add(key);
}
}
- if (privateuse != null && privateuse.length() > 0) {
+ if (privateuse != null && !privateuse.isEmpty()) {
// privateuse string contains prefix, e.g. "x-abc-def"
if (extensions == null) {
extensions = new HashMap<>(1);
@@ -406,19 +406,19 @@
// Validate base locale fields before updating internal state.
// LocaleExtensions always store validated/canonicalized values,
// so no checks are necessary.
- if (language.length() > 0 && !LanguageTag.isLanguage(language)) {
+ if (!language.isEmpty() && !LanguageTag.isLanguage(language)) {
throw new LocaleSyntaxException("Ill-formed language: " + language);
}
- if (script.length() > 0 && !LanguageTag.isScript(script)) {
+ if (!script.isEmpty() && !LanguageTag.isScript(script)) {
throw new LocaleSyntaxException("Ill-formed script: " + script);
}
- if (region.length() > 0 && !LanguageTag.isRegion(region)) {
+ if (!region.isEmpty() && !LanguageTag.isRegion(region)) {
throw new LocaleSyntaxException("Ill-formed region: " + region);
}
- if (variant.length() > 0) {
+ if (!variant.isEmpty()) {
// BEGIN Android-added: normalize separators to "_"
variant = variant.replaceAll(LanguageTag.SEP, BaseLocale.SEP);
// END Android-added: normalize separators to "_"
diff --git a/ojluni/src/main/java/sun/util/locale/LocaleUtils.java b/ojluni/src/main/java/sun/util/locale/LocaleUtils.java
index ead48fc..264c500 100644
--- a/ojluni/src/main/java/sun/util/locale/LocaleUtils.java
+++ b/ojluni/src/main/java/sun/util/locale/LocaleUtils.java
@@ -207,7 +207,7 @@
}
static boolean isEmpty(String str) {
- return str == null || str.length() == 0;
+ return str == null || str.isEmpty();
}
static boolean isEmpty(Set<?> set) {
diff --git a/ojluni/src/main/native/Android.bp b/ojluni/src/main/native/Android.bp
index 162a73c..5edf48a 100644
--- a/ojluni/src/main/native/Android.bp
+++ b/ojluni/src/main/native/Android.bp
@@ -85,5 +85,6 @@
"socket_tagger_util.cpp",
"OnLoad.cpp",
"JniConstants.cpp",
+ "jdk_internal_misc_VM.cpp",
],
}
diff --git a/ojluni/src/main/native/OnLoad.cpp b/ojluni/src/main/native/OnLoad.cpp
index f0b8566..3424402 100644
--- a/ojluni/src/main/native/OnLoad.cpp
+++ b/ojluni/src/main/native/OnLoad.cpp
@@ -61,6 +61,7 @@
extern "C" void register_java_lang_Runtime(JNIEnv* env);
extern "C" void register_java_lang_UNIXProcess(JNIEnv* env);
void register_java_lang_Character(JNIEnv* env);
+void register_jdk_internal_misc_VM(JNIEnv* env);
extern "C" JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void*) {
jint version = JNI_VERSION_1_6;
@@ -131,6 +132,7 @@
register_java_lang_Runtime(env);
register_java_lang_UNIXProcess(env);
register_java_lang_Character(env);
+ register_jdk_internal_misc_VM(env);
env->PopLocalFrame(/* result */ nullptr); // Pop the local frame.
return version;
diff --git a/ojluni/src/main/native/jdk_internal_misc_VM.cpp b/ojluni/src/main/native/jdk_internal_misc_VM.cpp
new file mode 100644
index 0000000..8e41328
--- /dev/null
+++ b/ojluni/src/main/native/jdk_internal_misc_VM.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. The Android Open Source
+ * Project designates this particular file as subject to the "Classpath"
+ * exception as provided by The Android Open Source Project in the LICENSE
+ * file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "jni.h"
+#include "jvm.h"
+
+#include <nativehelper/JNIHelp.h>
+#include <nativehelper/jni_macros.h>
+
+JNIEXPORT jlong JNICALL VM_getNanoTimeAdjustment(jlong offsetInSeconds) {
+ return JVM_GetNanoTimeAdjustment(nullptr, nullptr, offsetInSeconds);
+}
+
+static JNINativeMethod gMethods[] = {
+ CRITICAL_NATIVE_METHOD(VM, getNanoTimeAdjustment, "(J)J"),
+};
+
+void register_jdk_internal_misc_VM(JNIEnv* env) {
+ jniRegisterNativeMethods(env, "jdk/internal/misc/VM", gMethods, NELEM(gMethods));
+}
\ No newline at end of file
diff --git a/ojluni/src/main/native/jvm.h b/ojluni/src/main/native/jvm.h
index fd15abf..5421419 100644
--- a/ojluni/src/main/native/jvm.h
+++ b/ojluni/src/main/native/jvm.h
@@ -105,6 +105,9 @@
JNIEXPORT jlong JNICALL
JVM_NanoTime(JNIEnv *env, jclass ignored);
+JNIEXPORT jlong JNICALL
+JVM_GetNanoTimeAdjustment(JNIEnv *env, jclass ignored, jlong offset_secs);
+
JNIEXPORT void JNICALL
JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos,
jobject dst, jint dst_pos, jint length);
diff --git a/ojluni/src/main/resources/hijrah-config-umalqura.properties b/ojluni/src/main/resources/java/time/chrono/hijrah-config-islamic-umalqura.properties
similarity index 100%
rename from ojluni/src/main/resources/hijrah-config-umalqura.properties
rename to ojluni/src/main/resources/java/time/chrono/hijrah-config-islamic-umalqura.properties
diff --git a/ojluni/src/test/java/io/Reader/TransferTo.java b/ojluni/src/test/java/io/Reader/TransferTo.java
index de1102d..f3dd40a 100644
--- a/ojluni/src/test/java/io/Reader/TransferTo.java
+++ b/ojluni/src/test/java/io/Reader/TransferTo.java
@@ -6,15 +6,15 @@
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
- * This code is distributed source the hope that it will be useful, but WITHOUT
+ * This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included source the LICENSE file that
+ * version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklsource St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
diff --git a/ojluni/src/test/java/io/Writer/NullWriter.java b/ojluni/src/test/java/io/Writer/NullWriter.java
index e80b8a0..f33ecaa 100644
--- a/ojluni/src/test/java/io/Writer/NullWriter.java
+++ b/ojluni/src/test/java/io/Writer/NullWriter.java
@@ -20,6 +20,8 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+// Android-added: Test package.
+package test.java.io.Writer;
import java.io.IOException;
import java.io.Writer;
@@ -164,4 +166,4 @@
public static void testWriteBIIClosed() throws IOException {
closedWriter.write(new char[]{(char) 6}, 0, 1);
}
-}
\ No newline at end of file
+}
diff --git a/ojluni/src/test/java/lang/Math/FusedMultiplyAddTests.java b/ojluni/src/test/java/lang/Math/FusedMultiplyAddTests.java
index 132ecb1..30d6889 100644
--- a/ojluni/src/test/java/lang/Math/FusedMultiplyAddTests.java
+++ b/ojluni/src/test/java/lang/Math/FusedMultiplyAddTests.java
@@ -329,9 +329,7 @@
Math.ulp(1.0f) * Math.ulp(1.0f)},
// Double-rounding if done in double precision
- // Android-changed: updated result test expectation
- // {0x1.fffffep23f, 0x1.000004p28f, 0x1.fep5f, 0x1.000002p52f}
- {0x1.fffffep23f, 0x1.000004p28f, 0x1.fep5f, 0x1.000004p52f}
+ {0x1.fffffep23f, 0x1.000004p28f, 0x1.fep5f, 0x1.000002p52f}
};
for (float[] testCase : testCases) {
diff --git a/ojluni/src/test/java/lang/String/concat/ImplicitStringConcatShapes-head.template b/ojluni/src/test/java/lang/String/concat/ImplicitStringConcatShapes-head.template
deleted file mode 100644
index aa937e7..0000000
--- a/ojluni/src/test/java/lang/String/concat/ImplicitStringConcatShapes-head.template
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package test.java.lang.String.concat;
-
-
-/**
- * @test
- * @summary Test implicit String concatenations, multiple shapes.
- *
- * @compile ImplicitStringConcatShapes.java
- * @run main/othervm -Xverify:all ImplicitStringConcatShapes
- *
- * @compile -XDstringConcat=inline ImplicitStringConcatShapes.java
- * @run main/othervm -Xverify:all ImplicitStringConcatShapes
- *
- * @compile -XDstringConcat=indy ImplicitStringConcatShapes.java
- *
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT ImplicitStringConcatShapes
- *
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB -Djava.lang.invoke.stringConcat.debug=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED -Djava.lang.invoke.stringConcat.debug=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED -Djava.lang.invoke.stringConcat.debug=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT -Djava.lang.invoke.stringConcat.debug=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT -Djava.lang.invoke.stringConcat.debug=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT -Djava.lang.invoke.stringConcat.debug=true ImplicitStringConcatShapes
- *
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
-
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB -Djava.lang.invoke.stringConcat.debug=true -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED -Djava.lang.invoke.stringConcat.debug=true -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED -Djava.lang.invoke.stringConcat.debug=true -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT -Djava.lang.invoke.stringConcat.debug=true -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT -Djava.lang.invoke.stringConcat.debug=true -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT -Djava.lang.invoke.stringConcat.debug=true -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
- *
- * @compile -XDstringConcat=indyWithConstants ImplicitStringConcatShapes.java
- *
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT ImplicitStringConcatShapes
- *
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB -Djava.lang.invoke.stringConcat.debug=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED -Djava.lang.invoke.stringConcat.debug=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED -Djava.lang.invoke.stringConcat.debug=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT -Djava.lang.invoke.stringConcat.debug=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT -Djava.lang.invoke.stringConcat.debug=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT -Djava.lang.invoke.stringConcat.debug=true ImplicitStringConcatShapes
- *
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
- *
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB -Djava.lang.invoke.stringConcat.debug=true -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED -Djava.lang.invoke.stringConcat.debug=true -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED -Djava.lang.invoke.stringConcat.debug=true -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT -Djava.lang.invoke.stringConcat.debug=true -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT -Djava.lang.invoke.stringConcat.debug=true -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
- * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT -Djava.lang.invoke.stringConcat.debug=true -Djava.lang.invoke.stringConcat.cache=true ImplicitStringConcatShapes
-*/
-public class ImplicitStringConcatShapes {
- public static void test(String expected, String actual) {
- // Fingers crossed: String concat should work.
- if (!expected.equals(actual)) {
- StringBuilder sb = new StringBuilder();
- sb.append("Expected = ");
- sb.append(expected);
- sb.append(", actual = ");
- sb.append(actual);
- throw new IllegalStateException(sb.toString());
- }
- }
-
- static class MyClass {
- private final int i;
-
- public MyClass(int i) {
- this.i = i;
- }
-
- public String toString() {
- return new StringBuilder("C(").append(i).append(")").toString();
- }
- }
-
- static class MyClassNullToString {
- public String toString() {
- return null;
- }
- }
-
- public static void main(String[] args) throws Exception {
- new ImplicitStringConcatShapes().run();
- }
diff --git a/ojluni/src/test/java/lang/String/concat/ImplicitStringConcatShapesTestGen.java b/ojluni/src/test/java/lang/String/concat/ImplicitStringConcatShapesTestGen.java
deleted file mode 100644
index 30927c6..0000000
--- a/ojluni/src/test/java/lang/String/concat/ImplicitStringConcatShapesTestGen.java
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package test.java.lang.String.concat;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.*;
-
-public class ImplicitStringConcatShapesTestGen {
- public static String escapeToUnicode(String str) {
- StringBuilder b = new StringBuilder();
- for (char c : str.toCharArray()) {
- if (c < 128) {
- b.append(c);
- } else {
- b.append("\\u").append(String.format("%04X", (int) c));
- }
- }
- return b.toString();
- }
-
- public static void main(String... args) throws IOException {
- PrintWriter pw = new PrintWriter(System.out);
-
- String[] types = {
- "boolean",
- "byte",
- "byteMinus",
- "char",
- "short",
- "shortMinus",
- "int",
- "intMinus",
- "integer",
- "integerNull",
- "float",
- "floatMinus",
- "long",
- "longMinus",
- "double",
- "doubleMinus",
- "object",
- "objectNull",
- "objectNullToString",
- "String",
- "StringUTF16",
- "StringU1",
- "StringU2",
- "intArrayNull",
- "objectArrayNull",
- };
-
- for (String t : Files.readAllLines(Paths.get("ImplicitStringConcatShapes-head.template"))) {
- pw.println(t);
- }
-
- Map<String, String> values = new HashMap<>();
-
- Random current = new Random(12345);
- for (int mode = 0; mode <= 2; mode++) {
- for (String type : types) {
- int i = current.nextInt(100);
- boolean isStatic = (mode | 1) == 1;
- boolean isFinal = (mode | 2) == 2;
- String fieldName = (isStatic ? "s" : "") + (isFinal ? "f" : "") + "_" + typeSig(type);
- String value = initValue(type, i);
- String stringValue = stringValue(type, i);
- values.put(fieldName, stringValue);
- pw.printf(" %s %s %s %s = %s;%n", isStatic ? "static" : "", isFinal ? "final" : "", typeValue(type, i), fieldName, value);
- }
- }
-
- pw.println();
-
- List<String> lines = new ArrayList<>();
- List<String> l = new ArrayList<>(values.keySet());
-
- for (String l1 : l) {
- lines.add(String.format("test(\"%s\", \"\" + %s);",
- escapeToUnicode(values.get(l1)),
- l1
- ));
- }
-
- for (String l1 : l) {
- for (String l2 : l) {
- lines.add(String.format("test(\"%s\", \"\" + %s + %s);",
- escapeToUnicode(values.get(l1) + values.get(l2)),
- l1, l2
- ));
- }
- }
-
- final int STRIDE = 1000;
- int strides = lines.size() / STRIDE + 1;
-
- pw.println(" public void run() {");
- for (int c = 0; c < strides; c++) {
- pw.println(" run" + c + "();");
- }
- pw.println(" }");
- pw.println();
-
- for (int c = 0; c < strides; c++) {
- pw.println(" public void run" + c + "() {");
- for (String line : lines.subList(c * STRIDE, Math.min(lines.size(), (c+1) * STRIDE))) {
- pw.println(" " + line);
- }
- pw.println(" }");
- pw.println();
- }
-
- pw.println("}");
-
- pw.flush();
- pw.close();
- }
-
- private static String typeSig(String type) {
- switch (type) {
- case "boolean": return "bl";
- case "byte": return "b";
- case "byteMinus": return "bM";
- case "short": return "s";
- case "shortMinus": return "sM";
- case "char": return "c";
- case "int": return "i";
- case "intMinus": return "iM";
- case "integer": return "I";
- case "integerNull": return "IN";
- case "float": return "f";
- case "floatMinus": return "fM";
- case "long": return "l";
- case "longMinus": return "lM";
- case "double": return "d";
- case "doubleMinus": return "dM";
- case "String": return "str";
- case "StringUTF16": return "strU";
- case "StringU1": return "strU1";
- case "StringU2": return "strU2";
- case "object": return "o";
- case "objectNull": return "oN";
- case "objectNullToString": return "oNtS";
- case "intArrayNull": return "iAN";
- case "objectArrayNull": return "oAN";
- default:
- throw new IllegalStateException();
- }
- }
-
- private static String typeValue(String type, int i) {
- switch (type) {
- case "boolean":
- case "byte":
- case "byteMinus":
- case "char":
- case "short":
- case "shortMinus":
- case "int":
- case "intMinus":
- case "float":
- case "floatMinus":
- case "long":
- case "longMinus":
- case "double":
- case "doubleMinus":
- return type.replace("Minus", "");
- case "String":
- case "StringUTF16":
- case "StringU1":
- case "StringU2":
- return "String";
- case "object":
- case "objectNull":
- case "objectNullToString":
- return "Object";
- case "integer":
- case "integerNull":
- return "Integer";
- case "intArrayNull":
- return "int[]";
- case "objectArrayNull":
- return "Object[]";
- default:
- throw new IllegalStateException();
- }
- }
-
- private static String initValue(String type, int i) {
- switch (type) {
- case "boolean":
- return String.valueOf((i & 1) == 1);
- case "byte":
- return String.valueOf(i);
- case "byteMinus":
- return String.valueOf(-i);
- case "short":
- return String.valueOf(i*100);
- case "shortMinus":
- return String.valueOf(-i*100);
- case "intMinus":
- return String.valueOf(-i*1_000_000);
- case "int":
- case "integer":
- return String.valueOf(i*1_000_000);
- case "long":
- return String.valueOf(i*1_000_000_000) + "L";
- case "longMinus":
- return String.valueOf(-i*1_000_000_000) + "L";
- case "char":
- return "'" + (char)(i % 26 + 65) + "'";
- case "double":
- return String.valueOf(i) + ".0d";
- case "doubleMinus":
- return "-" + String.valueOf(i) + ".0d";
- case "float":
- return String.valueOf(i) + ".0f";
- case "floatMinus":
- return "-" + String.valueOf(i) + ".0f";
- case "object":
- return "new MyClass(" + i + ")";
- case "objectNullToString":
- return "new MyClassNullToString()";
- case "integerNull":
- case "objectNull":
- case "intArrayNull":
- case "objectArrayNull":
- return "null";
- case "String":
- return "\"" + i + "\"";
- case "StringUTF16":
- return "\"\\u0451" + i + "\"";
- case "StringU1":
- return "\"\\u0001" + i + "\"";
- case "StringU2":
- return "\"\\u0002" + i + "\"";
- default:
- throw new IllegalStateException();
- }
- }
-
- private static String stringValue(String type, int i) {
- switch (type) {
- case "boolean":
- return String.valueOf((i & 1) == 1);
- case "byte":
- return String.valueOf(i);
- case "byteMinus":
- return String.valueOf(-i);
- case "short":
- return String.valueOf(i*100);
- case "shortMinus":
- return String.valueOf(-i*100);
- case "intMinus":
- return String.valueOf(-i*1_000_000);
- case "int":
- case "integer":
- return String.valueOf(i*1_000_000);
- case "long":
- return String.valueOf(i*1_000_000_000);
- case "longMinus":
- return String.valueOf(-i*1_000_000_000);
- case "char":
- return String.valueOf((char) (i % 26 + 65));
- case "double":
- case "float":
- return String.valueOf(i) + ".0";
- case "doubleMinus":
- case "floatMinus":
- return "-" + String.valueOf(i) + ".0";
- case "object":
- return "C(" + i + ")";
- case "integerNull":
- case "objectNull":
- case "objectNullToString":
- case "intArrayNull":
- case "objectArrayNull":
- return "null";
- case "String":
- return "" + i;
- case "StringUTF16":
- return "\u0451" + i;
- case "StringU1":
- return "\u0001" + i;
- case "StringU2":
- return "\u0002" + i;
- default:
- throw new IllegalStateException();
- }
- }
-
-}
diff --git a/ojluni/src/test/java/lang/invoke/InvokeWithArgumentsTest.java b/ojluni/src/test/java/lang/invoke/InvokeWithArgumentsTest.java
index 63a2101..df3c247 100644
--- a/ojluni/src/test/java/lang/invoke/InvokeWithArgumentsTest.java
+++ b/ojluni/src/test/java/lang/invoke/InvokeWithArgumentsTest.java
@@ -72,7 +72,9 @@
// Note: the actual array is not preserved, the elements will be
// unpacked and then packed into a new array before invoking the method
- String[] expected = (String[]) mh.invokeWithArguments(actual);
+ // Android-changed: Cast to Object[] to avoid compilation warning.
+ // String[] expected = (String[]) mh.invokeWithArguments(actual);
+ String[] expected = (String[]) mh.invokeWithArguments((Object[]) actual);
Assert.assertTrue(actual != expected, "Array should not pass through");
Assert.assertEquals(actual, expected, "Array contents should be equal");
diff --git a/ojluni/src/test/java/math/BigDecimal/AddTests.java b/ojluni/src/test/java/math/BigDecimal/AddTests.java
index a7f13bd..30d3045 100644
--- a/ojluni/src/test/java/math/BigDecimal/AddTests.java
+++ b/ojluni/src/test/java/math/BigDecimal/AddTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
/*
* @test
- * @bug 6362557
+ * @bug 6362557 8200698
* @summary Some tests of add(BigDecimal, mc)
* @author Joseph D. Darcy
*/
@@ -255,4 +255,30 @@
"Before:\t" + sum1.toString() +
"After:\t" + sum2.toString());
}
+
+ @Test
+ public static void arithmeticExceptionTest() {
+ int failures = 0;
+ BigDecimal x;
+ try {
+ //
+ // The string representation "1e2147483647", which is equivalent
+ // to 10^Integer.MAX_VALUE, is used to create an augend with an
+ // unscaled value of 1 and a scale of -Integer.MAX_VALUE. The
+ // addend "1" has an unscaled value of 1 with a scale of 0. The
+ // addition is performed exactly and is specified to have a
+ // preferred scale of max(-Integer.MAX_VALUE, 0). As the scale
+ // of the result is 0, a value with Integer.MAX_VALUE + 1 digits
+ // would need to be created. Therefore the next statement is
+ // expected to overflow with an ArithmeticException.
+ //
+ x = new BigDecimal("1e2147483647").add(new BigDecimal(1));
+ failures++;
+ // Android-added: Add assert statement.
+ Assert.fail("ArithmeticException is expected.");
+ } catch (ArithmeticException ae) {
+ }
+ // Android-removed: Remove return the statement.
+ // return failures;
+ }
}
diff --git a/ojluni/src/test/java/math/BigDecimal/Constructor.java b/ojluni/src/test/java/math/BigDecimal/Constructor.java
index 25ad7bc..d072496 100644
--- a/ojluni/src/test/java/math/BigDecimal/Constructor.java
+++ b/ojluni/src/test/java/math/BigDecimal/Constructor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,18 +24,48 @@
/*
* @test
- * @bug 4259453
- * @summary Test string constructor of BigDecimal
+ * @bug 4259453 8200698
+ * @summary Test constructors of BigDecimal
+ * @library ..
+ * @run testng Constructor
*/
-import java.math.BigDecimal;
+import java.math.BigDecimal;
import org.testng.annotations.Test;
-// Android-changed: Replace error counting with asserts.
public class Constructor {
-
- @Test(expectedExceptions = NumberFormatException.class)
- public void testConstructor() throws Exception {
+ @Test(expectedExceptions=NumberFormatException.class)
+ public void stringConstructor() {
BigDecimal bd = new BigDecimal("1.2e");
}
+
+ @Test(expectedExceptions=NumberFormatException.class)
+ public void charArrayConstructorNegativeOffset() {
+ BigDecimal bd = new BigDecimal(new char[5], -1, 4, null);
+ }
+
+ @Test(expectedExceptions=NumberFormatException.class)
+ public void charArrayConstructorNegativeLength() {
+ BigDecimal bd = new BigDecimal(new char[5], 0, -1, null);
+ }
+
+ @Test(expectedExceptions=NumberFormatException.class)
+ public void charArrayConstructorIntegerOverflow() {
+ try {
+ BigDecimal bd = new BigDecimal(new char[5], Integer.MAX_VALUE - 5,
+ 6, null);
+ } catch (NumberFormatException nfe) {
+ if (nfe.getCause() instanceof IndexOutOfBoundsException) {
+ throw new RuntimeException
+ ("NumberFormatException should not have a cause");
+ } else {
+ throw nfe;
+ }
+ }
+ }
+
+ @Test(expectedExceptions=NumberFormatException.class)
+ public void charArrayConstructorIndexOutOfBounds() {
+ BigDecimal bd = new BigDecimal(new char[5], 1, 5, null);
+ }
}
diff --git a/ojluni/src/test/java/math/BigDecimal/SquareRootTests.java b/ojluni/src/test/java/math/BigDecimal/SquareRootTests.java
index 27b1013..190ffb8 100644
--- a/ojluni/src/test/java/math/BigDecimal/SquareRootTests.java
+++ b/ojluni/src/test/java/math/BigDecimal/SquareRootTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
/*
* @test
- * @bug 4851777
+ * @bug 4851777 8233452
* @summary Tests of BigDecimal.sqrt().
*/
@@ -34,8 +34,19 @@
import org.testng.Assert;
import org.testng.annotations.Test;
+import static java.math.BigDecimal.ONE;
+import static java.math.BigDecimal.TEN;
+import static java.math.BigDecimal.ZERO;
+import static java.math.BigDecimal.valueOf;
+
// Android-changed: Replace error counting with asserts.
public class SquareRootTests {
+ private static BigDecimal TWO = new BigDecimal(2);
+
+ /**
+ * The value 0.1, with a scale of 1.
+ */
+ private static final BigDecimal ONE_TENTH = valueOf(1L, 1);
@Test
public void negativeTests() {
@@ -67,6 +78,76 @@
}
/**
+ * Probe inputs with one digit of precision, 1 ... 9 and those
+ * values scaled by 10^-1, 0.1, ... 0.9.
+ */
+ @Test
+ public void oneDigitTests() {
+ int failures = 0;
+
+ List<BigDecimal> oneToNine =
+ List.of(ONE, TWO, valueOf(3),
+ valueOf(4), valueOf(5), valueOf(6),
+ valueOf(7), valueOf(8), valueOf(9));
+
+ List<RoundingMode> modes =
+ List.of(RoundingMode.UP, RoundingMode.DOWN,
+ RoundingMode.CEILING, RoundingMode.FLOOR,
+ RoundingMode.HALF_UP, RoundingMode.HALF_DOWN, RoundingMode.HALF_EVEN);
+
+ for (int i = 1; i < 20; i++) {
+ for (RoundingMode rm : modes) {
+ for (BigDecimal bd : oneToNine) {
+ MathContext mc = new MathContext(i, rm);
+
+ compareSqrtImplementations(bd, mc);
+ bd = bd.multiply(ONE_TENTH);
+ compareSqrtImplementations(bd, mc);
+ }
+ }
+ }
+
+ // return failures;
+ }
+
+ /**
+ * Probe inputs with two digits of precision, (10 ... 99) and
+ * those values scaled by 10^-1 (1, ... 9.9) and scaled by 10^-2
+ * (0.1 ... 0.99).
+ */
+ @Test
+ public void twoDigitTests() {
+ int failures = 0;
+
+ List<RoundingMode> modes =
+ List.of(RoundingMode.UP, RoundingMode.DOWN,
+ RoundingMode.CEILING, RoundingMode.FLOOR,
+ RoundingMode.HALF_UP, RoundingMode.HALF_DOWN, RoundingMode.HALF_EVEN);
+
+ for (int i = 10; i < 100; i++) {
+ BigDecimal bd0 = BigDecimal.valueOf(i);
+ BigDecimal bd1 = bd0.multiply(ONE_TENTH);
+ BigDecimal bd2 = bd1.multiply(ONE_TENTH);
+
+ for (BigDecimal bd : List.of(bd0, bd1, bd2)) {
+ for (int precision = 1; i < 20; i++) {
+ for (RoundingMode rm : modes) {
+ MathContext mc = new MathContext(precision, rm);
+ compareSqrtImplementations(bd, mc);
+ }
+ }
+ }
+ }
+
+ // return failures;
+ }
+
+ private static void compareSqrtImplementations(BigDecimal bd, MathContext mc) {
+ equalNumerically(BigSquareRoot.sqrt(bd, mc),
+ bd.sqrt(mc), "sqrt(" + bd + ") under " + mc);
+ }
+
+ /**
* sqrt(10^2N) is 10^N
* Both numerical value and representation should be verified
*/
@@ -75,8 +156,8 @@
MathContext oneDigitExactly = new MathContext(1, RoundingMode.UNNECESSARY);
for (int scale = -100; scale <= 100; scale++) {
- BigDecimal testValue = BigDecimal.valueOf(1, 2*scale);
- BigDecimal expectedNumericalResult = BigDecimal.valueOf(1, scale);
+ BigDecimal testValue = BigDecimal.valueOf(1, 2*scale);
+ BigDecimal expectedNumericalResult = BigDecimal.valueOf(1, scale);
BigDecimal result;
@@ -104,24 +185,26 @@
BigDecimal highPrecisionRoot2 =
new BigDecimal("1.41421356237309504880168872420969807856967187537694807317667973799");
-
RoundingMode[] modes = {
RoundingMode.UP, RoundingMode.DOWN,
RoundingMode.CEILING, RoundingMode.FLOOR,
RoundingMode.HALF_UP, RoundingMode.HALF_DOWN, RoundingMode.HALF_EVEN
};
- // For each interesting rounding mode, for precisions 1 to, say
- // 63 numerically compare TWO.sqrt(mc) to
- // highPrecisionRoot2.round(mc)
+ // For each interesting rounding mode, for precisions 1 to, say,
+ // 63 numerically compare TWO.sqrt(mc) to
+ // highPrecisionRoot2.round(mc) and the alternative internal high-precision
+ // implementation of square root.
for (RoundingMode mode : modes) {
for (int precision = 1; precision < 63; precision++) {
MathContext mc = new MathContext(precision, mode);
BigDecimal expected = highPrecisionRoot2.round(mc);
BigDecimal computed = TWO.sqrt(mc);
+ BigDecimal altComputed = BigSquareRoot.sqrt(TWO, mc);
equalNumerically(expected, computed, "sqrt(2)");
+ equalNumerically(computed, altComputed, "computed & altComputed");
}
}
}
@@ -167,6 +250,140 @@
}
}
+ /**
+ * Test around 3.9999 that the sqrt doesn't improperly round-up to
+ * a numerical value of 2.
+ */
+ @Test
+ public void almostFourRoundingDown() {
+ int failures = 0;
+ BigDecimal nearFour = new BigDecimal("3.999999999999999999999999999999");
+
+ // Sqrt is 1.9999...
+
+ for (int i = 1; i < 64; i++) {
+ MathContext mc = new MathContext(i, RoundingMode.FLOOR);
+ BigDecimal result = nearFour.sqrt(mc);
+ BigDecimal expected = BigSquareRoot.sqrt(nearFour, mc);
+ equalNumerically(expected, result, "near four rounding down");
+ Assert.assertTrue(result.compareTo(TWO) < 0);
+ }
+
+ // return failures;
+ }
+
+ /**
+ * Test around 4.000...1 that the sqrt doesn't improperly
+ * round-down to a numerical value of 2.
+ */
+ @Test
+ public void almostFourRoundingUp() {
+ int failures = 0;
+ BigDecimal nearFour = new BigDecimal("4.000000000000000000000000000001");
+
+ // Sqrt is 2.0000....<non-zero digits>
+
+ for (int i = 1; i < 64; i++) {
+ MathContext mc = new MathContext(i, RoundingMode.CEILING);
+ BigDecimal result = nearFour.sqrt(mc);
+ BigDecimal expected = BigSquareRoot.sqrt(nearFour, mc);
+ equalNumerically(expected, result, "near four rounding up");
+ Assert.assertTrue(result.compareTo(TWO) > 0);
+ }
+
+ // return failures;
+ }
+
+ @Test
+ public void nearTen() {
+ int failures = 0;
+
+ BigDecimal near10 = new BigDecimal("9.99999999999999999999");
+
+ BigDecimal near10sq = near10.multiply(near10);
+
+ BigDecimal near10sq_ulp = near10sq.add(near10sq.ulp());
+
+ for (int i = 10; i < 23; i++) {
+ MathContext mc = new MathContext(i, RoundingMode.HALF_EVEN);
+
+ equalNumerically(BigSquareRoot.sqrt(near10sq_ulp, mc),
+ near10sq_ulp.sqrt(mc),
+ "near 10 rounding half even");
+ }
+
+ // return failures;
+ }
+
+
+ /*
+ * Probe for rounding failures near a power of ten, 1 = 10^0,
+ * where an ulp has a different size above and below the value.
+ */
+ @Test
+ public void nearOne() {
+ int failures = 0;
+
+ BigDecimal near1 = new BigDecimal(".999999999999999999999");
+ BigDecimal near1sq = near1.multiply(near1);
+ BigDecimal near1sq_ulp = near1sq.add(near1sq.ulp());
+
+ for (int i = 10; i < 23; i++) {
+ for (RoundingMode rm : List.of(RoundingMode.HALF_EVEN,
+ RoundingMode.UP,
+ RoundingMode.DOWN )) {
+ MathContext mc = new MathContext(i, rm);
+ equalNumerically(BigSquareRoot.sqrt(near1sq_ulp, mc),
+ near1sq_ulp.sqrt(mc),
+ mc.toString());
+ }
+ }
+
+ // return failures;
+ }
+
+
+
+ @Test
+ public void halfWay() {
+ int failures = 0;
+
+ /*
+ * Use enough digits that the exact result cannot be computed
+ * from the sqrt of a double.
+ */
+ BigDecimal[] halfWayCases = {
+ // Odd next digit, truncate on HALF_EVEN
+ new BigDecimal("123456789123456789.5"),
+
+ // Even next digit, round up on HALF_EVEN
+ new BigDecimal("123456789123456788.5"),
+ };
+
+ for (BigDecimal halfWayCase : halfWayCases) {
+ // Round result to next-to-last place
+ int precision = halfWayCase.precision() - 1;
+ BigDecimal square = halfWayCase.multiply(halfWayCase);
+
+ for (RoundingMode rm : List.of(RoundingMode.HALF_EVEN,
+ RoundingMode.HALF_UP,
+ RoundingMode.HALF_DOWN)) {
+ MathContext mc = new MathContext(precision, rm);
+
+ System.out.println("\nRounding mode " + rm);
+ System.out.println("\t" + halfWayCase.round(mc) + "\t" + halfWayCase);
+ System.out.println("\t" + BigSquareRoot.sqrt(square, mc));
+
+ equalNumerically(/*square.sqrt(mc),*/
+ BigSquareRoot.sqrt(square, mc),
+ halfWayCase.round(mc),
+ "Rounding halway " + rm);
+ }
+ }
+
+ // return failures;
+ }
+
private static void compare(BigDecimal a, BigDecimal b, boolean expected, String prefix) {
boolean result = a.equals(b);
Assert.assertEquals(result, expected, "Testing " + prefix +
@@ -185,4 +402,307 @@
"(" + a + ").compareTo(" + b + ") => " + result +
"\n\tExpected " + expected);
}
+
+ /**
+ * Alternative implementation of BigDecimal square root which uses
+ * higher-precision for a simpler set of termination conditions
+ * for the Newton iteration.
+ */
+ private static class BigSquareRoot {
+
+ /**
+ * The value 0.5, with a scale of 1.
+ */
+ private static final BigDecimal ONE_HALF = valueOf(5L, 1);
+
+ public static boolean isPowerOfTen(BigDecimal bd) {
+ return BigInteger.ONE.equals(bd.unscaledValue());
+ }
+
+ public static BigDecimal square(BigDecimal bd) {
+ return bd.multiply(bd);
+ }
+
+ public static BigDecimal sqrt(BigDecimal bd, MathContext mc) {
+ int signum = bd.signum();
+ if (signum == 1) {
+ /*
+ * The following code draws on the algorithm presented in
+ * "Properly Rounded Variable Precision Square Root," Hull and
+ * Abrham, ACM Transactions on Mathematical Software, Vol 11,
+ * No. 3, September 1985, Pages 229-237.
+ *
+ * The BigDecimal computational model differs from the one
+ * presented in the paper in several ways: first BigDecimal
+ * numbers aren't necessarily normalized, second many more
+ * rounding modes are supported, including UNNECESSARY, and
+ * exact results can be requested.
+ *
+ * The main steps of the algorithm below are as follows,
+ * first argument reduce the value to the numerical range
+ * [1, 10) using the following relations:
+ *
+ * x = y * 10 ^ exp
+ * sqrt(x) = sqrt(y) * 10^(exp / 2) if exp is even
+ * sqrt(x) = sqrt(y/10) * 10 ^((exp+1)/2) is exp is odd
+ *
+ * Then use Newton's iteration on the reduced value to compute
+ * the numerical digits of the desired result.
+ *
+ * Finally, scale back to the desired exponent range and
+ * perform any adjustment to get the preferred scale in the
+ * representation.
+ */
+
+ // The code below favors relative simplicity over checking
+ // for special cases that could run faster.
+
+ int preferredScale = bd.scale()/2;
+ BigDecimal zeroWithFinalPreferredScale =
+ BigDecimal.valueOf(0L, preferredScale);
+
+ // First phase of numerical normalization, strip trailing
+ // zeros and check for even powers of 10.
+ BigDecimal stripped = bd.stripTrailingZeros();
+ int strippedScale = stripped.scale();
+
+ // Numerically sqrt(10^2N) = 10^N
+ if (isPowerOfTen(stripped) &&
+ strippedScale % 2 == 0) {
+ BigDecimal result = BigDecimal.valueOf(1L, strippedScale/2);
+ if (result.scale() != preferredScale) {
+ // Adjust to requested precision and preferred
+ // scale as appropriate.
+ result = result.add(zeroWithFinalPreferredScale, mc);
+ }
+ return result;
+ }
+
+ // After stripTrailingZeros, the representation is normalized as
+ //
+ // unscaledValue * 10^(-scale)
+ //
+ // where unscaledValue is an integer with the mimimum
+ // precision for the cohort of the numerical value. To
+ // allow binary floating-point hardware to be used to get
+ // approximately a 15 digit approximation to the square
+ // root, it is helpful to instead normalize this so that
+ // the significand portion is to right of the decimal
+ // point by roughly (scale() - precision() + 1).
+
+ // Now the precision / scale adjustment
+ int scaleAdjust = 0;
+ int scale = stripped.scale() - stripped.precision() + 1;
+ if (scale % 2 == 0) {
+ scaleAdjust = scale;
+ } else {
+ scaleAdjust = scale - 1;
+ }
+
+ BigDecimal working = stripped.scaleByPowerOfTen(scaleAdjust);
+
+ assert // Verify 0.1 <= working < 10
+ ONE_TENTH.compareTo(working) <= 0 && working.compareTo(TEN) < 0;
+
+ // Use good ole' Math.sqrt to get the initial guess for
+ // the Newton iteration, good to at least 15 decimal
+ // digits. This approach does incur the cost of a
+ //
+ // BigDecimal -> double -> BigDecimal
+ //
+ // conversion cycle, but it avoids the need for several
+ // Newton iterations in BigDecimal arithmetic to get the
+ // working answer to 15 digits of precision. If many fewer
+ // than 15 digits were needed, it might be faster to do
+ // the loop entirely in BigDecimal arithmetic.
+ //
+ // (A double value might have as much many as 17 decimal
+ // digits of precision; it depends on the relative density
+ // of binary and decimal numbers at different regions of
+ // the number line.)
+ //
+ // (It would be possible to check for certain special
+ // cases to avoid doing any Newton iterations. For
+ // example, if the BigDecimal -> double conversion was
+ // known to be exact and the rounding mode had a
+ // low-enough precision, the post-Newton rounding logic
+ // could be applied directly.)
+
+ BigDecimal guess = new BigDecimal(Math.sqrt(working.doubleValue()));
+ int guessPrecision = 15;
+ int originalPrecision = mc.getPrecision();
+ int targetPrecision;
+
+ // If an exact value is requested, it must only need
+ // about half of the input digits to represent since
+ // multiplying an N digit number by itself yield a (2N
+ // - 1) digit or 2N digit result.
+ if (originalPrecision == 0) {
+ targetPrecision = stripped.precision()/2 + 1;
+ } else {
+ targetPrecision = originalPrecision;
+ }
+
+ // When setting the precision to use inside the Newton
+ // iteration loop, take care to avoid the case where the
+ // precision of the input exceeds the requested precision
+ // and rounding the input value too soon.
+ BigDecimal approx = guess;
+ int workingPrecision = working.precision();
+ // Use "2p + 2" property to guarantee enough
+ // intermediate precision so that a double-rounding
+ // error does not occur when rounded to the final
+ // destination precision.
+ int loopPrecision =
+ Math.max(2 * Math.max(targetPrecision, workingPrecision) + 2,
+ 34); // Force at least two Netwon
+ // iterations on the Math.sqrt
+ // result.
+ do {
+ MathContext mcTmp = new MathContext(loopPrecision, RoundingMode.HALF_EVEN);
+ // approx = 0.5 * (approx + fraction / approx)
+ approx = ONE_HALF.multiply(approx.add(working.divide(approx, mcTmp), mcTmp));
+ guessPrecision *= 2;
+ } while (guessPrecision < loopPrecision);
+
+ BigDecimal result;
+ RoundingMode targetRm = mc.getRoundingMode();
+ if (targetRm == RoundingMode.UNNECESSARY || originalPrecision == 0) {
+ RoundingMode tmpRm =
+ (targetRm == RoundingMode.UNNECESSARY) ? RoundingMode.DOWN : targetRm;
+ MathContext mcTmp = new MathContext(targetPrecision, tmpRm);
+ result = approx.scaleByPowerOfTen(-scaleAdjust/2).round(mcTmp);
+
+ // If result*result != this numerically, the square
+ // root isn't exact
+ if (bd.subtract(square(result)).compareTo(ZERO) != 0) {
+ throw new ArithmeticException("Computed square root not exact.");
+ }
+ } else {
+ result = approx.scaleByPowerOfTen(-scaleAdjust/2).round(mc);
+ }
+
+ assert squareRootResultAssertions(bd, result, mc);
+ if (result.scale() != preferredScale) {
+ // The preferred scale of an add is
+ // max(addend.scale(), augend.scale()). Therefore, if
+ // the scale of the result is first minimized using
+ // stripTrailingZeros(), adding a zero of the
+ // preferred scale rounding the correct precision will
+ // perform the proper scale vs precision tradeoffs.
+ result = result.stripTrailingZeros().
+ add(zeroWithFinalPreferredScale,
+ new MathContext(originalPrecision, RoundingMode.UNNECESSARY));
+ }
+ return result;
+ } else {
+ switch (signum) {
+ case -1:
+ throw new ArithmeticException("Attempted square root " +
+ "of negative BigDecimal");
+ case 0:
+ return valueOf(0L, bd.scale()/2);
+
+ default:
+ throw new AssertionError("Bad value from signum");
+ }
+ }
+ }
+
+ /**
+ * For nonzero values, check numerical correctness properties of
+ * the computed result for the chosen rounding mode.
+ *
+ * For the directed roundings, for DOWN and FLOOR, result^2 must
+ * be {@code <=} the input and (result+ulp)^2 must be {@code >} the
+ * input. Conversely, for UP and CEIL, result^2 must be {@code >=} the
+ * input and (result-ulp)^2 must be {@code <} the input.
+ */
+ private static boolean squareRootResultAssertions(BigDecimal input, BigDecimal result, MathContext mc) {
+ if (result.signum() == 0) {
+ return squareRootZeroResultAssertions(input, result, mc);
+ } else {
+ RoundingMode rm = mc.getRoundingMode();
+ BigDecimal ulp = result.ulp();
+ BigDecimal neighborUp = result.add(ulp);
+ // Make neighbor down accurate even for powers of ten
+ if (isPowerOfTen(result)) {
+ ulp = ulp.divide(TEN);
+ }
+ BigDecimal neighborDown = result.subtract(ulp);
+
+ // Both the starting value and result should be nonzero and positive.
+ if (result.signum() != 1 ||
+ input.signum() != 1) {
+ return false;
+ }
+
+ switch (rm) {
+ case DOWN:
+ case FLOOR:
+ assert
+ square(result).compareTo(input) <= 0 &&
+ square(neighborUp).compareTo(input) > 0:
+ "Square of result out for bounds rounding " + rm;
+ return true;
+
+ case UP:
+ case CEILING:
+ assert
+ square(result).compareTo(input) >= 0 :
+ "Square of result too small rounding " + rm;
+
+ assert
+ square(neighborDown).compareTo(input) < 0 :
+ "Square of down neighbor too large rounding " + rm + "\n" +
+ "\t input: " + input + "\t neighborDown: " + neighborDown +"\t sqrt: " + result +
+ "\t" + mc;
+ return true;
+
+
+ case HALF_DOWN:
+ case HALF_EVEN:
+ case HALF_UP:
+ BigDecimal err = square(result).subtract(input).abs();
+ BigDecimal errUp = square(neighborUp).subtract(input);
+ BigDecimal errDown = input.subtract(square(neighborDown));
+ // All error values should be positive so don't need to
+ // compare absolute values.
+
+ int err_comp_errUp = err.compareTo(errUp);
+ int err_comp_errDown = err.compareTo(errDown);
+
+ assert
+ errUp.signum() == 1 &&
+ errDown.signum() == 1 :
+ "Errors of neighbors squared don't have correct signs";
+
+ // At least one of these must be true, but not both
+// assert
+// err_comp_errUp <= 0 : "Upper neighbor is closer than result: " + rm +
+// "\t" + input + "\t result" + result;
+// assert
+// err_comp_errDown <= 0 : "Lower neighbor is closer than result: " + rm +
+// "\t" + input + "\t result " + result + "\t lower neighbor: " + neighborDown;
+
+ assert
+ ((err_comp_errUp == 0 ) ? err_comp_errDown < 0 : true) &&
+ ((err_comp_errDown == 0 ) ? err_comp_errUp < 0 : true) :
+ "Incorrect error relationships";
+ // && could check for digit conditions for ties too
+ return true;
+
+ default: // Definition of UNNECESSARY already verified.
+ return true;
+ }
+ }
+ }
+
+ private static boolean squareRootZeroResultAssertions(BigDecimal input,
+ BigDecimal result,
+ MathContext mc) {
+ return input.compareTo(ZERO) == 0;
+ }
+ }
}
+
diff --git a/ojluni/src/test/java/math/BigInteger/PrimitiveConversionTests.java b/ojluni/src/test/java/math/BigInteger/PrimitiveConversionTests.java
index 834f864..1b101fb 100644
--- a/ojluni/src/test/java/math/BigInteger/PrimitiveConversionTests.java
+++ b/ojluni/src/test/java/math/BigInteger/PrimitiveConversionTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
diff --git a/ojluni/src/test/java/nio/channels/Selector/SelectWithConsumer.java b/ojluni/src/test/java/nio/channels/Selector/SelectWithConsumer.java
index 0d68b38..c027ad8 100644
--- a/ojluni/src/test/java/nio/channels/Selector/SelectWithConsumer.java
+++ b/ojluni/src/test/java/nio/channels/Selector/SelectWithConsumer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
package test.java.nio.channels.Selector;
/* @test
- * @bug 8199433
+ * @bug 8199433 8208780
* @run testng SelectWithConsumer
* @summary Unit test for Selector select(Consumer), select(Consumer,long) and
* selectNow(Consumer)
@@ -63,9 +63,19 @@
int interestOps = key.interestOps();
AtomicInteger notifiedOps = new AtomicInteger();
+ if (expectedOps == 0) {
+ // ensure select(Consumer) does not block indefinitely
+ sel.wakeup();
+ } else {
+ // ensure that the channel is ready for all expected operations
+ sel.select();
+ while ((key.readyOps() & interestOps) != expectedOps) {
+ Thread.sleep(100);
+ sel.select();
+ }
+ }
+
// select(Consumer)
- if (expectedOps == 0)
- sel.wakeup(); // ensure select does not block
notifiedOps.set(0);
int n = sel.select(k -> {
assertTrue(Thread.currentThread() == callerThread);
@@ -188,19 +198,21 @@
// write to sink to ensure that the source is readable
sink.write(messageBuffer());
- AtomicInteger counter = new AtomicInteger();
+ // wait for key1 to be readable
+ sel.select();
+ assertTrue(key2.isWritable());
+ while (!key1.isReadable()) {
+ Thread.sleep(20);
+ sel.select();
+ }
+
+ var counter = new AtomicInteger();
// select(Consumer)
counter.set(0);
int n = sel.select(k -> {
+ assertTrue(k == key1 || k == key2);
counter.incrementAndGet();
- if (k == key1) {
- assertTrue(k.isReadable());
- } else if (k == key2) {
- assertTrue(k.isWritable());
- } else {
- assertTrue(false);
- }
});
assertTrue(n == 2);
assertTrue(counter.get() == 2);
@@ -208,14 +220,8 @@
// select(Consumer, timeout)
counter.set(0);
n = sel.select(k -> {
+ assertTrue(k == key1 || k == key2);
counter.incrementAndGet();
- if (k == key1) {
- assertTrue(k.isReadable());
- } else if (k == key2) {
- assertTrue(k.isWritable());
- } else {
- assertTrue(false);
- }
}, 1000);
assertTrue(n == 2);
assertTrue(counter.get() == 2);
@@ -223,14 +229,8 @@
// selectNow(Consumer)
counter.set(0);
n = sel.selectNow(k -> {
+ assertTrue(k == key1 || k == key2);
counter.incrementAndGet();
- if (k == key1) {
- assertTrue(k.isReadable());
- } else if (k == key2) {
- assertTrue(k.isWritable());
- } else {
- assertTrue(false);
- }
});
assertTrue(n == 2);
assertTrue(counter.get() == 2);
diff --git a/ojluni/src/test/java/security/KeyStore/PBETest.java b/ojluni/src/test/java/security/KeyStore/PBETest.java
deleted file mode 100644
index 9a5c742..0000000
--- a/ojluni/src/test/java/security/KeyStore/PBETest.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 8006591
- * @summary Protect keystore entries using stronger PBE algorithms
- */
-package test.java.security.KeyStore;
-
-import java.io.*;
-import java.security.*;
-import javax.crypto.*;
-import javax.crypto.spec.*;
-
-import org.testng.annotations.Test;
-import static org.junit.Assert.fail;
-
-// Retrieve a keystore entry, protected by the default encryption algorithm.
-// Set the keystore entry, protected by a stronger encryption algorithm.
-
-public class PBETest {
- private final static String DIR = System.getProperty("test.src", ".");
- private final static String KEY_PROTECTION_PROPERTY =
- "keystore.PKCS12.keyProtectionAlgorithm";
- private static final String[] PBE_ALGOS = {
- "PBEWithSHA1AndDESede",
- "PBEWithHmacSHA1AndAES_128",
- "PBEWithHmacSHA224AndAES_128",
- "PBEWithHmacSHA256AndAES_128",
- "PBEWithHmacSHA384AndAES_128",
- "PBEWithHmacSHA512AndAES_128"
- };
- private static final char[] PASSWORD = "passphrase".toCharArray();
- private static final String KEYSTORE_TYPE = "JKS";
- private static final String KEYSTORE = DIR + "/keystore.jks";
- private static final String NEW_KEYSTORE_TYPE = "PKCS12";
- private static final String ALIAS = "vajra";
-
- private static final byte[] IV = {
- 0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,
- 0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20
- };
- private static final byte[] SALT = {
- 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08
- };
- private static final int ITERATION_COUNT = 1024;
-
- @Test
- public static void main(String[] args) throws Exception {
- for (String algo : PBE_ALGOS) {
- String filename = algo + ".p12";
- main0(algo, filename, true);
- main0(algo, filename, false);
- Security.setProperty(KEY_PROTECTION_PROPERTY, algo);
- main0(null, "PBE.p12", false);
- Security.setProperty(KEY_PROTECTION_PROPERTY, "");
- }
- main0(null, "default.p12", false); // default algorithm
- }
-
- private static void main0(String algo, String filename, boolean useParams)
- throws Exception {
-
- KeyStore keystore = load(KEYSTORE_TYPE, KEYSTORE, PASSWORD);
- KeyStore.Entry entry =
- keystore.getEntry(ALIAS,
- new KeyStore.PasswordProtection(PASSWORD));
- Key originalKey = null;
- if (entry instanceof KeyStore.PrivateKeyEntry) {
- originalKey = ((KeyStore.PrivateKeyEntry) entry).getPrivateKey();
- } else if (entry instanceof KeyStore.SecretKeyEntry) {
- originalKey = ((KeyStore.SecretKeyEntry) entry).getSecretKey();
- }
-
- // Set entry
- KeyStore keystore2 = load(NEW_KEYSTORE_TYPE, null, null);
- if (useParams) {
- keystore2.setEntry(ALIAS, entry,
- new KeyStore.PasswordProtection(PASSWORD, algo,
- new PBEParameterSpec(SALT, ITERATION_COUNT,
- new IvParameterSpec(IV))));
- } else if (algo != null) {
- keystore2.setEntry(ALIAS, entry,
- new KeyStore.PasswordProtection(PASSWORD, algo, null));
- } else {
- keystore2.setEntry(ALIAS, entry,
- new KeyStore.PasswordProtection(PASSWORD));
- String prop = Security.getProperty(KEY_PROTECTION_PROPERTY);
- }
-
- try (FileOutputStream outStream = new FileOutputStream(filename)) {
- keystore2.store(outStream, PASSWORD);
- }
-
- try {
- keystore2 = load(NEW_KEYSTORE_TYPE, filename, PASSWORD);
- entry = keystore2.getEntry(ALIAS,
- new KeyStore.PasswordProtection(PASSWORD));
- Key key;
- if (entry instanceof KeyStore.PrivateKeyEntry) {
- key = ((KeyStore.PrivateKeyEntry) entry).getPrivateKey();
- } else if (entry instanceof KeyStore.SecretKeyEntry) {
- key = ((KeyStore.SecretKeyEntry) entry).getSecretKey();
- } else {
- throw new Exception("Failed to retrieve key entry");
- }
- if (!originalKey.equals(key)) {
- fail("Failed: recovered key does not match the original key");
- }
-
- } finally {
- new File(filename).delete();
- }
- }
-
- private static KeyStore load(String type, String path, char[] password)
- throws Exception {
- KeyStore keystore = KeyStore.getInstance(type);
-
- if (path != null) {
-
- try (FileInputStream inStream = new FileInputStream(path)) {
- keystore.load(inStream, password);
- }
- } else {
- keystore.load(null, null);
- }
-
- return keystore;
- }
-}
\ No newline at end of file
diff --git a/ojluni/src/test/java/time/jdk/testlibrary/RandomFactory.java b/ojluni/src/test/java/time/jdk/testlibrary/RandomFactory.java
index 0951d11..8930a38 100644
--- a/ojluni/src/test/java/time/jdk/testlibrary/RandomFactory.java
+++ b/ojluni/src/test/java/time/jdk/testlibrary/RandomFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,7 @@
* questions.
*/
-package jdk.testlibrary;
+package jdk.test.lib;
import java.util.Random;
import java.util.SplittableRandom;
diff --git a/ojluni/src/test/java/time/tck/java/time/AbstractTCKTest.java b/ojluni/src/test/java/time/tck/java/time/AbstractTCKTest.java
index d960114..6272ea7 100644
--- a/ojluni/src/test/java/time/tck/java/time/AbstractTCKTest.java
+++ b/ojluni/src/test/java/time/tck/java/time/AbstractTCKTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -69,14 +69,35 @@
import java.io.ObjectOutputStream;
import java.io.ObjectStreamConstants;
import java.io.Serializable;
-import java.lang.reflect.Field;
import java.util.Formatter;
+import java.util.Map;
/**
* Base test class.
*/
public abstract class AbstractTCKTest {
+ /**
+ * Map from package name to the serialVersionUID of the .Ser class for the package.
+ */
+ private static Map<String, Long> serialVersionUIDs = Map.of(
+ "java.time", -7683839454370182990L,
+ "java.time.chrono", -6103370247208168577L,
+ "java.time.zone", -8885321777449118786L
+ );
+
+ /**
+ * Returns the serialVersionUID for the class.
+ * The SUIDs are defined by the specification for each class.
+ * @param serClass the class to return the SUID of
+ * @return returns the serialVersionUID for the class
+ */
+ public final static long getSUID(Class<?> serClass) {
+ String pkgName = serClass.getPackageName();
+ return serialVersionUIDs.get(pkgName);
+ }
+
+
protected static boolean isIsoLeap(long year) {
if (year % 4 != 0) {
return false;
@@ -111,10 +132,8 @@
protected static void assertSerializedBySer(Object object, byte[] expectedBytes, byte[]... matches) throws Exception {
String serClass = object.getClass().getPackage().getName() + ".Ser";
- Class<?> serCls = Class.forName(serClass);
- Field field = serCls.getDeclaredField("serialVersionUID");
- field.setAccessible(true);
- long serVer = (Long) field.get(null);
+ long serVer = getSUID(object.getClass());
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (ObjectOutputStream oos = new ObjectOutputStream(baos) ) {
oos.writeObject(object);
@@ -172,9 +191,8 @@
* @throws Exception if an unexpected condition occurs
*/
protected static void assertNotSerializable(Class<?> serClass) throws Exception {
- Field field = serClass.getDeclaredField("serialVersionUID");
- field.setAccessible(true);
- long serVer = (Long) field.get(null);
+ long serVer = getSUID(serClass);
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (DataOutputStream out = new DataOutputStream(baos)) {
out.writeShort(ObjectStreamConstants.STREAM_MAGIC);
@@ -201,7 +219,6 @@
fail("Class should not be deserializable " + serClass.getName());
}
-
/**
* Utility method to dump a byte array in a java syntax.
* @param bytes and array of bytes
diff --git a/ojluni/src/test/java/time/tck/java/time/TCKClock_Tick.java b/ojluni/src/test/java/time/tck/java/time/TCKClock_Tick.java
index c221237..08b0a52 100644
--- a/ojluni/src/test/java/time/tck/java/time/TCKClock_Tick.java
+++ b/ojluni/src/test/java/time/tck/java/time/TCKClock_Tick.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -160,6 +160,17 @@
}
//-----------------------------------------------------------------------
+ public void test_tickMillis_ZoneId() throws Exception {
+ Clock test = Clock.tickMillis(PARIS);
+ assertEquals(test.getZone(), PARIS);
+ assertEquals(test.instant().getNano() % 1000_000, 0);
+ }
+
+ @Test(expectedExceptions = NullPointerException.class)
+ public void test_tickMillis_ZoneId_nullZoneId() {
+ Clock.tickMillis(null);
+ }
+ //-----------------------------------------------------------------------
public void test_tickSeconds_ZoneId() throws Exception {
Clock test = Clock.tickSeconds(PARIS);
assertEquals(test.getZone(), PARIS);
diff --git a/ojluni/src/test/java/time/tck/java/time/TCKDuration.java b/ojluni/src/test/java/time/tck/java/time/TCKDuration.java
index fb11a30..d72e4a6 100644
--- a/ojluni/src/test/java/time/tck/java/time/TCKDuration.java
+++ b/ojluni/src/test/java/time/tck/java/time/TCKDuration.java
@@ -523,6 +523,8 @@
{"PT-123456789S", -123456789, 0},
{"PT" + Long.MIN_VALUE + "S", Long.MIN_VALUE, 0},
+
+ {"PT0.1S", 0, 100000000},
{"PT1.1S", 1, 100000000},
{"PT1.12S", 1, 120000000},
{"PT1.123S", 1, 123000000},
@@ -533,6 +535,8 @@
{"PT1.12345678S", 1, 123456780},
{"PT1.123456789S", 1, 123456789},
+ // Android-removed: Disable this OpenJDK 11 test until java.time synced to 11. http://b/180577079
+ // {"PT-0.1S", -1, 1000000000 - 100000000},
{"PT-1.1S", -2, 1000000000 - 100000000},
{"PT-1.12S", -2, 1000000000 - 120000000},
{"PT-1.123S", -2, 1000000000 - 123000000},
@@ -546,6 +550,27 @@
{"PT" + Long.MAX_VALUE + ".123456789S", Long.MAX_VALUE, 123456789},
{"PT" + Long.MIN_VALUE + ".000000000S", Long.MIN_VALUE, 0},
+ // Android-removed: Disable this OpenJDK 11 test until java.time synced to 11. http://b/180577079
+ /*
+ {"PT12M", 12 * 60, 0},
+ {"PT12M0.35S", 12 * 60, 350000000},
+ {"PT12M1.35S", 12 * 60 + 1, 350000000},
+ {"PT12M-0.35S", 12 * 60 - 1, 1000000000 - 350000000},
+ {"PT12M-1.35S", 12 * 60 - 2, 1000000000 - 350000000},
+
+ {"PT12H", 12 * 3600, 0},
+ {"PT12H0.35S", 12 * 3600, 350000000},
+ {"PT12H1.35S", 12 * 3600 + 1, 350000000},
+ {"PT12H-0.35S", 12 * 3600 - 1, 1000000000 - 350000000},
+ {"PT12H-1.35S", 12 * 3600 - 2, 1000000000 - 350000000},
+
+ {"P12D", 12 * 24 * 3600, 0},
+ {"P12DT0.35S", 12 * 24 * 3600, 350000000},
+ {"P12DT1.35S", 12 * 24 * 3600 + 1, 350000000},
+ {"P12DT-0.35S", 12 * 24 * 3600 - 1, 1000000000 - 350000000},
+ {"P12DT-1.35S", 12 * 24 * 3600 - 2, 1000000000 - 350000000},
+ */
+
{"PT01S", 1, 0},
{"PT001S", 1, 0},
{"PT000S", 0, 0},
@@ -2602,10 +2627,12 @@
//-----------------------------------------------------------------------
// toNanos()
//-----------------------------------------------------------------------
- @Test
+ // Android-changed: Disable this OpenJDK 11 test until java.time synced to 11. http://b/180577079
+ @Test(enabled = false)
public void test_toNanos() {
- Duration test = Duration.ofSeconds(321, 123456789);
- assertEquals(test.toNanos(), 321123456789L);
+ assertEquals(Duration.ofSeconds(321, 123456789).toNanos(), 321123456789L);
+ assertEquals(Duration.ofNanos(Long.MAX_VALUE).toNanos(), 9223372036854775807L);
+ assertEquals(Duration.ofNanos(Long.MIN_VALUE).toNanos(), -9223372036854775808L);
}
@Test
@@ -2620,13 +2647,28 @@
test.toNanos();
}
+ // Android-changed: Disable this OpenJDK 11 test until java.time synced to 11. http://b/180577079
+ @Test(enabled = false)
+ public void test_toNanos_min() {
+ Duration test = Duration.ofSeconds(0, Long.MIN_VALUE);
+ assertEquals(test.toNanos(), Long.MIN_VALUE);
+ }
+
+ @Test(expectedExceptions=ArithmeticException.class)
+ public void test_toNanos_tooSmall() {
+ Duration test = Duration.ofSeconds(0, Long.MIN_VALUE).minusNanos(1);
+ test.toNanos();
+ }
+
//-----------------------------------------------------------------------
// toMillis()
//-----------------------------------------------------------------------
- @Test
+ // Android-changed: Disable this OpenJDK 11 test until java.time synced to 11. http://b/180577079
+ @Test(enabled = false)
public void test_toMillis() {
- Duration test = Duration.ofSeconds(321, 123456789);
- assertEquals(test.toMillis(), 321000 + 123);
+ assertEquals(Duration.ofSeconds(321, 123456789).toMillis(), 321000 + 123);
+ assertEquals(Duration.ofMillis(Long.MAX_VALUE).toMillis(), 9223372036854775807L);
+ assertEquals(Duration.ofMillis(Long.MIN_VALUE).toMillis(), -9223372036854775808L);
}
@Test
@@ -2641,6 +2683,19 @@
test.toMillis();
}
+ // Android-changed: Disable this OpenJDK 11 test until java.time synced to 11. http://b/180577079
+ @Test(enabled = false)
+ public void test_toMillis_min() {
+ Duration test = Duration.ofSeconds(Long.MIN_VALUE / 1000, (Long.MIN_VALUE % 1000) * 1000000);
+ assertEquals(test.toMillis(), Long.MIN_VALUE);
+ }
+
+ @Test(expectedExceptions=ArithmeticException.class)
+ public void test_toMillis_tooSmall() {
+ Duration test = Duration.ofSeconds(Long.MIN_VALUE / 1000, ((Long.MIN_VALUE % 1000) - 1) * 1000000);
+ test.toMillis();
+ }
+
//-----------------------------------------------------------------------
// toSeconds()
//-----------------------------------------------------------------------
@@ -3001,6 +3056,10 @@
{-1, 0, "PT-1S"},
{-1, 1000, "PT-0.999999S"},
{-1, 900000000, "PT-0.1S"},
+ // Android-removed: Disable this OpenJDK 11 test until java.time synced to 11. http://b/180577079
+ // {-60, 100_000_000, "PT-59.9S"},
+ // {-59, -900_000_000, "PT-59.9S"},
+ // {-60, -100_000_000, "PT-1M-0.1S"},
{Long.MAX_VALUE, 0, "PT" + (Long.MAX_VALUE / 3600) + "H" +
((Long.MAX_VALUE % 3600) / 60) + "M" + (Long.MAX_VALUE % 60) + "S"},
{Long.MIN_VALUE, 0, "PT" + (Long.MIN_VALUE / 3600) + "H" +
diff --git a/ojluni/src/test/java/time/tck/java/time/TCKInstant.java b/ojluni/src/test/java/time/tck/java/time/TCKInstant.java
index 862f7549..90a79027 100644
--- a/ojluni/src/test/java/time/tck/java/time/TCKInstant.java
+++ b/ojluni/src/test/java/time/tck/java/time/TCKInstant.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -639,6 +639,12 @@
{Instant.ofEpochSecond(86400 + 3600 + 60 + 1, 123_456_789), NINETY_MINS, Instant.ofEpochSecond(86400 + 0, 0)},
{Instant.ofEpochSecond(86400 + 7200 + 60 + 1, 123_456_789), NINETY_MINS, Instant.ofEpochSecond(86400 + 5400, 0)},
{Instant.ofEpochSecond(86400 + 10800 + 60 + 1, 123_456_789), NINETY_MINS, Instant.ofEpochSecond(86400 + 10800, 0)},
+
+ {Instant.ofEpochSecond(-86400 - 3600 - 60 - 1, 123_456_789), MINUTES, Instant.ofEpochSecond(-86400 - 3600 - 120, 0 )},
+ {Instant.ofEpochSecond(-86400 - 3600 - 60 - 1, 123_456_789), MICROS, Instant.ofEpochSecond(-86400 - 3600 - 60 - 1, 123_456_000)},
+
+ {Instant.ofEpochSecond(86400 + 3600 + 60 + 1, 0), SECONDS, Instant.ofEpochSecond(86400 + 3600 + 60 + 1, 0)},
+ {Instant.ofEpochSecond(-86400 - 3600 - 120, 0), MINUTES, Instant.ofEpochSecond(-86400 - 3600 - 120, 0)},
};
}
@Test(dataProvider="truncatedToValid")
diff --git a/ojluni/src/test/java/time/tck/java/time/TCKLocalDate.java b/ojluni/src/test/java/time/tck/java/time/TCKLocalDate.java
index 7de2e02..faf81d1 100644
--- a/ojluni/src/test/java/time/tck/java/time/TCKLocalDate.java
+++ b/ojluni/src/test/java/time/tck/java/time/TCKLocalDate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -86,8 +86,6 @@
import static org.testng.Assert.assertSame;
import static org.testng.Assert.assertTrue;
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
import java.time.Clock;
import java.time.DateTimeException;
import java.time.DayOfWeek;
@@ -103,7 +101,9 @@
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
+import java.time.chrono.Era;
import java.time.chrono.IsoChronology;
+import java.time.chrono.IsoEra;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.time.temporal.ChronoField;
@@ -120,6 +120,8 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
@@ -135,6 +137,7 @@
private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1);
private static final ZoneOffset OFFSET_PTWO = ZoneOffset.ofHours(2);
+ private static final ZoneOffset OFFSET_MTWO = ZoneOffset.ofHours(-2);
private static final ZoneId ZONE_PARIS = ZoneId.of("Europe/Paris");
private static final ZoneId ZONE_GAZA = ZoneId.of("Asia/Gaza");
@@ -478,6 +481,48 @@
return date.withDayOfMonth(date.getMonth().length(isIsoLeap(date.getYear())));
}
+ //-----------------------------------------------------------------------
+ // ofInstant()
+ //-----------------------------------------------------------------------
+ @DataProvider(name="instantFactory")
+ Object[][] data_instantFactory() {
+ return new Object[][] {
+ {Instant.ofEpochSecond(86400 + 3600 + 120 + 4, 500), ZONE_PARIS, LocalDate.of(1970, 1, 2)},
+ {Instant.ofEpochSecond(86400 + 3600 + 120 + 4, 500), OFFSET_MTWO, LocalDate.of(1970, 1, 1)},
+ {Instant.ofEpochSecond(-86400 + 4, 500), OFFSET_PTWO, LocalDate.of(1969, 12, 31)},
+ {OffsetDateTime.of(LocalDateTime.of(Year.MIN_VALUE, 1, 1, 0, 0), ZoneOffset.UTC).toInstant(),
+ ZoneOffset.UTC, LocalDate.MIN},
+ {OffsetDateTime.of(LocalDateTime.of(Year.MAX_VALUE, 12, 31, 23, 59, 59, 999_999_999), ZoneOffset.UTC).toInstant(),
+ ZoneOffset.UTC, LocalDate.MAX},
+ };
+ }
+
+ @Test(dataProvider="instantFactory")
+ public void factory_ofInstant(Instant instant, ZoneId zone, LocalDate expected) {
+ LocalDate test = LocalDate.ofInstant(instant, zone);
+ assertEquals(test, expected);
+ }
+
+ @Test(expectedExceptions=DateTimeException.class)
+ public void factory_ofInstant_instantTooBig() {
+ LocalDate.ofInstant(Instant.MAX, OFFSET_PONE);
+ }
+
+ @Test(expectedExceptions=DateTimeException.class)
+ public void factory_ofInstant_instantTooSmall() {
+ LocalDate.ofInstant(Instant.MIN, OFFSET_PONE);
+ }
+
+ @Test(expectedExceptions=NullPointerException.class)
+ public void factory_ofInstant_nullInstant() {
+ LocalDate.ofInstant((Instant) null, ZONE_GAZA);
+ }
+
+ @Test(expectedExceptions=NullPointerException.class)
+ public void factory_ofInstant_nullZone() {
+ LocalDate.ofInstant(Instant.EPOCH, (ZoneId) null);
+ }
+
//-----------------------------------------------------------------------
// ofEpochDay()
//-----------------------------------------------------------------------
@@ -1246,13 +1291,37 @@
public void test_plusWeeks_invalidMaxMinusMin() {
LocalDate.of(Year.MAX_VALUE, 12, 25).plusWeeks(Long.MIN_VALUE);
}
-
- @Test
- public void test_plusDays_normal() {
- LocalDate t = TEST_2007_07_15.plusDays(1);
- assertEquals(t, LocalDate.of(2007, 7, 16));
+ //-----------------------------------------------------------------------
+ @DataProvider(name="PlusDays")
+ Object[][] provider_plusDays() {
+ return new Object[][] {
+ {LocalDate.of(2007, 7, 15), 1, LocalDate.of(2007, 7, 16)},
+ {LocalDate.of(2007, 7, 15), 17, LocalDate.of(2007, 8, 1)},
+ {LocalDate.of(2007, 12, 31), 1, LocalDate.of(2008, 1, 1)},
+ {LocalDate.of(2007, 1, 1), 58, LocalDate.of(2007, 2, 28)},
+ {LocalDate.of(2007, 1, 1), 59, LocalDate.of(2007, 3, 1)},
+ {LocalDate.of(2008, 1, 1), 60, LocalDate.of(2008, 3, 1)},
+ {LocalDate.of(2007, 2, 1), 27, LocalDate.of(2007, 2, 28)},
+ {LocalDate.of(2007, 2, 1), 28, LocalDate.of(2007, 3, 1)},
+ {LocalDate.of(2007, 1, 1), 29, LocalDate.of(2007, 1, 30)},
+ {LocalDate.of(2007, 1, 1), 30, LocalDate.of(2007, 1, 31)},
+ {LocalDate.of(2007, 1, 15), 13, LocalDate.of(2007, 1, 28)},
+ {LocalDate.of(2007, 1, 15), 14, LocalDate.of(2007, 1, 29)},
+ {LocalDate.of(2007, 1, 15), 15, LocalDate.of(2007, 1, 30)},
+ {LocalDate.of(2007, 1, 15), 16, LocalDate.of(2007, 1, 31)},
+ {LocalDate.of(2007, 2, 15), 13, LocalDate.of(2007, 2, 28)},
+ {LocalDate.of(2007, 2, 15), 14, LocalDate.of(2007, 3, 1)},
+ {LocalDate.of(2007, 2, 15), 15, LocalDate.of(2007, 3, 2)},
+ {LocalDate.of(2007, 2, 15), 16, LocalDate.of(2007, 3, 3)},
+ };
}
+ @Test(dataProvider="PlusDays")
+ public void test_plusDays_normal(LocalDate input, int amountsToAdd, LocalDate expected) {
+ LocalDate actual = input.plusDays(amountsToAdd);
+ assertEquals(actual, expected);
+ }
+
@Test
public void test_plusDays_overMonths() {
LocalDate t = TEST_2007_07_15.plusDays(62);
@@ -2118,6 +2187,31 @@
}
//-----------------------------------------------------------------------
+ // toEpochSecond
+ //-----------------------------------------------------------------------
+ @DataProvider(name="epochSecond")
+ Object[][] provider_toEpochSecond() {
+ return new Object[][] {
+ {LocalDate.of(1858, 11, 17).toEpochSecond(LocalTime.MIDNIGHT, OFFSET_PONE), -3506720400L},
+ {LocalDate.of(1, 1, 1).toEpochSecond(LocalTime.NOON, OFFSET_PONE), -62135557200L},
+ {LocalDate.of(1995, 9, 27).toEpochSecond(LocalTime.of(5, 30), OFFSET_PTWO), 812172600L},
+ {LocalDate.of(1970, 1, 1).toEpochSecond(LocalTime.MIDNIGHT, OFFSET_MTWO), 7200L},
+ {LocalDate.of(-1, 12, 31).toEpochSecond(LocalTime.NOON, OFFSET_PONE), -62167266000L},
+ {LocalDate.of(1, 1, 1).toEpochSecond(LocalTime.MIDNIGHT, OFFSET_PONE),
+ Instant.ofEpochSecond(-62135600400L).getEpochSecond()},
+ {LocalDate.of(1995, 9, 27).toEpochSecond(LocalTime.NOON, OFFSET_PTWO),
+ Instant.ofEpochSecond(812196000L).getEpochSecond()},
+ {LocalDate.of(1995, 9, 27).toEpochSecond(LocalTime.of(5, 30), OFFSET_MTWO),
+ LocalDateTime.of(1995, 9, 27, 5, 30).toEpochSecond(OFFSET_MTWO)},
+ };
+ }
+
+ @Test(dataProvider="epochSecond")
+ public void test_toEpochSecond(long actual, long expected) {
+ assertEquals(actual, expected);
+ }
+
+ //-----------------------------------------------------------------------
// compareTo()
//-----------------------------------------------------------------------
@Test
@@ -2288,4 +2382,227 @@
return LocalDate.of(year, month, day);
}
+ //-----------------------------------------------------------------
+ // getEra()
+ // ----------------------------------------------------------------
+ @Test
+ public void test_getEra() {
+ // Android-changed: getEra() returns Era for backward compatibility.
+ // IsoEra isoEra = LocalDate.MAX.getEra();
+ Era isoEra = LocalDate.MAX.getEra();
+ assertSame(isoEra,IsoEra.CE);
+ assertSame(LocalDate.MIN.getEra(),IsoEra.BCE);
+ }
+
+ //-----------------------------------------------------------------
+ // datesUntil()
+ // ----------------------------------------------------------------
+ @Test
+ public void test_datesUntil() {
+ assertEquals(
+ date(2015, 9, 29).datesUntil(date(2015, 10, 3)).collect(
+ Collectors.toList()), Arrays.asList(date(2015, 9, 29),
+ date(2015, 9, 30), date(2015, 10, 1), date(2015, 10, 2)));
+ assertEquals(date(2015, 9, 29).datesUntil(date(2015, 10, 3), Period.ofDays(2))
+ .collect(Collectors.toList()), Arrays.asList(date(2015, 9, 29),
+ date(2015, 10, 1)));
+ assertEquals(date(2015, 1, 31).datesUntil(date(2015, 6, 1), Period.ofMonths(1))
+ .collect(Collectors.toList()), Arrays.asList(date(2015, 1, 31),
+ date(2015, 2, 28), date(2015, 3, 31), date(2015, 4, 30),
+ date(2015, 5, 31)));
+ }
+
+ @Test(expectedExceptions=NullPointerException.class)
+ public void test_datesUntil_nullEnd() {
+ LocalDate date = date(2015, 1, 31);
+ date.datesUntil(null);
+ }
+
+ @Test(expectedExceptions=NullPointerException.class)
+ public void test_datesUntil_nullEndStep() {
+ LocalDate date = date(2015, 1, 31);
+ date.datesUntil(null, Period.ofDays(1));
+ }
+
+ @Test(expectedExceptions=NullPointerException.class)
+ public void test_datesUntil_nullStep() {
+ LocalDate date = date(2015, 1, 31);
+ date.datesUntil(date, null);
+ }
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void test_datesUntil_endBeforeStart() {
+ date(2015, 1, 31).datesUntil(date(2015, 1, 30));
+ }
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void test_datesUntil_endBeforeStartPositiveStep() {
+ date(2015, 1, 31).datesUntil(date(2015, 1, 30), Period.of(1, 0, 0));
+ }
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void test_datesUntil_endAfterStartNegativeStep() {
+ date(2015, 1, 30).datesUntil(date(2015, 1, 31), Period.of(0, -1, -1));
+ }
+
+ @Test(expectedExceptions=IllegalArgumentException.class)
+ public void test_datesUntil_zeroStep() {
+ LocalDate date = date(2015, 1, 31);
+ date.datesUntil(date, Period.ZERO);
+ }
+
+ @Test(expectedExceptions=IllegalArgumentException.class)
+ public void test_datesUntil_oppositeSign() {
+ LocalDate date = date(2015, 1, 31);
+ date.datesUntil(date, Period.of(1, 0, -1));
+ }
+
+ @Test(expectedExceptions=IllegalArgumentException.class)
+ public void test_datesUntil_oppositeSign2() {
+ LocalDate date = date(2015, 1, 31);
+ date.datesUntil(date, Period.of(0, -1, 1));
+ }
+
+ @DataProvider(name="datesUntil")
+ public Object[][] provider_datesUntil() {
+ return new Object[][] {
+ // Android-removed: The range to max date takes too much memory and time.
+ /*
+ {MIN_DATE, MIN_DATE},
+ {MIN_DATE, MAX_DATE},
+ {MAX_DATE, MAX_DATE},
+ */
+ {date(2015,10,1), date(2015,10,2)},
+ {date(2015,10,1), date(2015,11,1)},
+ {date(2015,10,31), date(2015,11,1)},
+ // Android-removed: The range to max date takes too much memory and time.
+ /*
+ {date(2015,10,1), MAX_DATE},
+ {MIN_DATE, date(2015,10,1)}
+ */
+ };
+ }
+
+ @Test(dataProvider = "datesUntil")
+ public void test_datesUntil_count(LocalDate start, LocalDate end) {
+ assertEquals(start.datesUntil(end).count(), start.until(end, ChronoUnit.DAYS));
+ assertEquals(start.datesUntil(end, Period.ofDays(1)).count(),
+ start.until(end, ChronoUnit.DAYS));
+ }
+
+ @DataProvider(name="datesUntilSteps")
+ public Object[][] provider_datesUntil_steps() {
+ List<Object[]> data = new ArrayList<>(Arrays.asList(new Object[][] {
+ // Android-removed: The range to max date takes too much memory and time.
+ /*
+ {MIN_DATE, MAX_DATE, Period.ofYears(Year.MAX_VALUE)},
+ {MIN_DATE, MAX_DATE, Period.ofDays(2)},
+ {MIN_DATE, MAX_DATE, Period.of(1,2,3)},
+ {MIN_DATE, MAX_DATE, Period.of(1,2,1000000)},
+ {MIN_DATE, MAX_DATE, Period.of(1,1000000,3)},
+ {MIN_DATE, MAX_DATE, Period.of(1000000,2,3)},
+ {MIN_DATE, MIN_DATE.plusMonths(1), Period.ofMonths(1)},
+ {MIN_DATE, date(Year.MIN_VALUE, 2, 2), Period.ofMonths(1)},
+ {MIN_DATE, date(Year.MIN_VALUE, 8, 9), Period.of(0, 1, 1)},
+ {MIN_DATE, MAX_DATE.minusYears(1), Period.ofYears(Year.MAX_VALUE)},
+ {MAX_DATE.minusMonths(1), MAX_DATE, Period.ofMonths(1)},
+ {date(Year.MAX_VALUE, 2, 20), MAX_DATE, Period.of(0, 1, 1)},
+ */
+ {date(2015,1,1), date(2016,1,1), Period.ofYears(1)},
+ {date(2015,1,1), date(2016,1,1), Period.ofDays(365)},
+ {date(2015,1,1), date(2016,1,1), Period.ofDays(366)},
+ {date(2015,1,1), date(2016,1,1), Period.ofDays(4)},
+ {date(2015,1,1), date(2016,1,1), Period.of(0,1,2)},
+ {date(2015,1,1), date(2016,1,1), Period.ofMonths(1)},
+ {date(2015,1,1), date(2016,1,1), Period.ofMonths(12)},
+ {date(2015,1,1), date(2016,1,2), Period.ofMonths(12)},
+ {date(2015,1,1), date(2016,1,1), Period.of(0, 11, 30)},
+ {date(2015,1,1), date(2015,12,31), Period.of(0, 11, 30)},
+ {date(2015,1,31), date(2015,12,31), Period.ofMonths(2)},
+ {date(2015,1,31), date(2015,12,1), Period.ofMonths(2)},
+ {date(2015,1,31), date(2015,11,30), Period.ofMonths(2)},
+ {date(2015,1,31), date(2030,11,30), Period.of(1,30,365)},
+ {date(2015,1,31), date(2043,1,31), Period.of(4,0,0)},
+ {date(2015,1,31), date(2043,2,1), Period.of(4,0,0)},
+ {date(2015,1,31), date(2043,1,31), Period.of(3,11,30)},
+ {date(2015,1,31), date(2043,2,1), Period.of(3,11,30)},
+ {date(2015,1,31), date(2043,1,31), Period.of(0,0,1460)},
+ {date(2015,1,31), date(2043,1,31), Period.of(0,0,1461)},
+ {date(2015,1,31), date(2043,2,1), Period.of(0,0,1461)},
+ // Android-removed: The range to max date takes too much memory and time.
+ /*
+ {date(2015,1,31), MAX_DATE, Period.of(10,100,1000)},
+ {date(2015,1,31), MAX_DATE, Period.of(1000000,10000,100000)},
+ {date(2015,1,31), MAX_DATE, Period.ofDays(10000000)},
+ {date(2015,1,31), MAX_DATE, Period.ofDays(Integer.MAX_VALUE)},
+ {date(2015,1,31), MAX_DATE, Period.ofMonths(Integer.MAX_VALUE)},
+ {date(2015,1,31), MAX_DATE, Period.ofYears(Integer.MAX_VALUE)}
+ */
+ }));
+ LocalDate start = date(2014, 1, 15);
+ LocalDate end = date(2015, 3, 4);
+ for (int months : new int[] { 0, 1, 2, 3, 5, 7, 12, 13 }) {
+ for (int days : new int[] { 0, 1, 2, 3, 5, 10, 17, 27, 28, 29, 30, 31, 32, 57, 58, 59,
+ 60, 61, 62, 70, 80, 90 }) {
+ if (months > 0 || days > 0)
+ data.add(new Object[] { start, end, Period.of(0, months, days) });
+ }
+ }
+ for (int days = 27; days < 100; days++) {
+ data.add(new Object[] { start, start.plusDays(days), Period.ofMonths(1) });
+ }
+ return data.toArray(new Object[data.size()][]);
+ }
+
+ @Test(dataProvider="datesUntilSteps")
+ public void test_datesUntil_step(LocalDate start, LocalDate end, Period step) {
+ assertEquals(start.datesUntil(start, step).count(), 0);
+ long count = start.datesUntil(end, step).count();
+ assertTrue(count > 0);
+ // the last value must be before the end date
+ assertTrue(start.plusMonths(step.toTotalMonths()*(count-1)).plusDays(step.getDays()*(count-1)).isBefore(end));
+ try {
+ // the next after the last value must be either invalid or not before the end date
+ assertFalse(start.plusMonths(step.toTotalMonths()*count).plusDays(step.getDays()*count).isBefore(end));
+ } catch (ArithmeticException | DateTimeException e) {
+ // ignore: possible overflow for the next value is ok
+ }
+ if(count < 1000) {
+ assertTrue(start.datesUntil(end, step).allMatch(date -> !date.isBefore(start) && date.isBefore(end)));
+ List<LocalDate> list = new ArrayList<>();
+ for(long i=0; i<count; i++) {
+ list.add(start.plusMonths(step.toTotalMonths()*i).plusDays(step.getDays()*i));
+ }
+ assertEquals(start.datesUntil(end, step).collect(Collectors.toList()), list);
+ }
+
+ // swap end and start and negate the Period
+ count = end.datesUntil(start, step.negated()).count();
+ assertTrue(count > 0);
+ // the last value must be after the start date
+ assertTrue(end.minusMonths(step.toTotalMonths()*(count-1)).minusDays(step.getDays()*(count-1)).isAfter(start));
+ try {
+ // the next after the last value must be either invalid or not after the start date
+ assertFalse(end.minusMonths(step.toTotalMonths()*count).minusDays(step.getDays()*count).isAfter(start));
+ } catch (ArithmeticException | DateTimeException e) {
+ // ignore: possible overflow for the next value is ok
+ }
+ if(count < 1000) {
+ assertTrue(end.datesUntil(start, step.negated()).allMatch(date -> date.isAfter(start) && !date.isAfter(end)));
+ List<LocalDate> list = new ArrayList<>();
+ for(long i=0; i<count; i++) {
+ list.add(end.minusMonths(step.toTotalMonths()*i).minusDays(step.getDays()*i));
+ }
+ assertEquals(end.datesUntil(start, step.negated()).collect(Collectors.toList()), list);
+ }
+ }
+
+ @Test
+ public void test_datesUntil_staticType() {
+ // Test the types of the Stream and elements of the stream
+ LocalDate date = date(2015, 2, 10);
+ Stream<LocalDate> stream = date.datesUntil(date.plusDays(5));
+ long sum = stream.mapToInt(LocalDate::getDayOfMonth).sum();
+ assertEquals(sum, 60, "sum of 10, 11, 12, 13, 14 is wrong");
+ }
}
diff --git a/ojluni/src/test/java/time/tck/java/time/TCKLocalDateTime.java b/ojluni/src/test/java/time/tck/java/time/TCKLocalDateTime.java
index 40ed534..487cd80 100644
--- a/ojluni/src/test/java/time/tck/java/time/TCKLocalDateTime.java
+++ b/ojluni/src/test/java/time/tck/java/time/TCKLocalDateTime.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -107,11 +107,10 @@
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
import java.time.Clock;
import java.time.DateTimeException;
import java.time.DayOfWeek;
+import java.time.Duration;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
@@ -260,16 +259,17 @@
//-----------------------------------------------------------------------
@Test(timeOut=30000) // TODO: remove when time zone loading is faster
public void now() {
+ final long DELTA = 20_000_000_000L; // 20 seconds of nanos leeway
LocalDateTime expected = LocalDateTime.now(Clock.systemDefaultZone());
LocalDateTime test = LocalDateTime.now();
long diff = Math.abs(test.toLocalTime().toNanoOfDay() - expected.toLocalTime().toNanoOfDay());
- if (diff >= 100000000) {
+ if (diff >= DELTA) {
// may be date change
expected = LocalDateTime.now(Clock.systemDefaultZone());
test = LocalDateTime.now();
diff = Math.abs(test.toLocalTime().toNanoOfDay() - expected.toLocalTime().toNanoOfDay());
}
- assertTrue(diff < 100000000); // less than 0.1 secs
+ assertTrue(diff < DELTA);
}
//-----------------------------------------------------------------------
@@ -285,14 +285,8 @@
ZoneId zone = ZoneId.of("UTC+01:02:03");
LocalDateTime expected = LocalDateTime.now(Clock.system(zone));
LocalDateTime test = LocalDateTime.now(zone);
- for (int i = 0; i < 100; i++) {
- if (expected.equals(test)) {
- return;
- }
- expected = LocalDateTime.now(Clock.system(zone));
- test = LocalDateTime.now(zone);
- }
- assertEquals(test, expected);
+ assertEquals(Duration.between(expected, test).truncatedTo(ChronoUnit.SECONDS),
+ Duration.ZERO);
}
//-----------------------------------------------------------------------
diff --git a/ojluni/src/test/java/time/tck/java/time/TCKLocalTime.java b/ojluni/src/test/java/time/tck/java/time/TCKLocalTime.java
index f669a7c..8477b29 100644
--- a/ojluni/src/test/java/time/tck/java/time/TCKLocalTime.java
+++ b/ojluni/src/test/java/time/tck/java/time/TCKLocalTime.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -244,14 +244,8 @@
ZoneId zone = ZoneId.of("UTC+01:02:03");
LocalTime expected = LocalTime.now(Clock.system(zone));
LocalTime test = LocalTime.now(zone);
- for (int i = 0; i < 100; i++) {
- if (expected.equals(test)) {
- return;
- }
- expected = LocalTime.now(Clock.system(zone));
- test = LocalTime.now(zone);
- }
- assertEquals(test, expected);
+ assertEquals(Duration.between(expected, test).truncatedTo(ChronoUnit.SECONDS),
+ Duration.ZERO);
}
//-----------------------------------------------------------------------
diff --git a/ojluni/src/test/java/time/tck/java/time/TCKOffsetDateTime.java b/ojluni/src/test/java/time/tck/java/time/TCKOffsetDateTime.java
index b2f8024..c940ed6 100644
--- a/ojluni/src/test/java/time/tck/java/time/TCKOffsetDateTime.java
+++ b/ojluni/src/test/java/time/tck/java/time/TCKOffsetDateTime.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -104,10 +104,6 @@
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
import java.time.Clock;
import java.time.DateTimeException;
import java.time.Duration;
@@ -239,16 +235,17 @@
//-----------------------------------------------------------------------
@Test
public void now() {
+ final long DELTA = 20_000_000_000L; // 20 seconds of nanos leeway
OffsetDateTime expected = OffsetDateTime.now(Clock.systemDefaultZone());
OffsetDateTime test = OffsetDateTime.now();
long diff = Math.abs(test.toLocalTime().toNanoOfDay() - expected.toLocalTime().toNanoOfDay());
- if (diff >= 100000000) {
+ if (diff >= DELTA) {
// may be date change
expected = OffsetDateTime.now(Clock.systemDefaultZone());
test = OffsetDateTime.now();
diff = Math.abs(test.toLocalTime().toNanoOfDay() - expected.toLocalTime().toNanoOfDay());
}
- assertTrue(diff < 100000000); // less than 0.1 secs
+ assertTrue(diff < DELTA);
}
//-----------------------------------------------------------------------
@@ -475,24 +472,12 @@
//-----------------------------------------------------------------------
@Test(expectedExceptions=NullPointerException.class)
public void constructor_nullTime() throws Throwable {
- Constructor<OffsetDateTime> con = OffsetDateTime.class.getDeclaredConstructor(LocalDateTime.class, ZoneOffset.class);
- con.setAccessible(true);
- try {
- con.newInstance(null, OFFSET_PONE);
- } catch (InvocationTargetException ex) {
- throw ex.getCause();
- }
+ OffsetDateTime.of(null, OFFSET_PONE);
}
@Test(expectedExceptions=NullPointerException.class)
public void constructor_nullOffset() throws Throwable {
- Constructor<OffsetDateTime> con = OffsetDateTime.class.getDeclaredConstructor(LocalDateTime.class, ZoneOffset.class);
- con.setAccessible(true);
- try {
- con.newInstance(LocalDateTime.of(LocalDate.of(2008, 6, 30), LocalTime.of(11, 30)), null);
- } catch (InvocationTargetException ex) {
- throw ex.getCause();
- }
+ OffsetDateTime.of(LocalDateTime.of(LocalDate.of(2008, 6, 30), LocalTime.of(11, 30)), null);
}
//-----------------------------------------------------------------------
diff --git a/ojluni/src/test/java/time/tck/java/time/TCKOffsetTime.java b/ojluni/src/test/java/time/tck/java/time/TCKOffsetTime.java
index e3bb590..fde9bd0 100644
--- a/ojluni/src/test/java/time/tck/java/time/TCKOffsetTime.java
+++ b/ojluni/src/test/java/time/tck/java/time/TCKOffsetTime.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -89,10 +89,6 @@
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
import java.time.Clock;
import java.time.DateTimeException;
import java.time.Instant;
@@ -136,6 +132,7 @@
private static final ZoneId ZONE_GAZA = ZoneId.of("Asia/Gaza");
private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1);
private static final ZoneOffset OFFSET_PTWO = ZoneOffset.ofHours(2);
+ private static final ZoneOffset OFFSET_MTWO = ZoneOffset.ofHours(-2);
private static final LocalDate DATE = LocalDate.of(2008, 12, 3);
// Android-changed: This was originally non-static and initialized in @BeforeMethod,
@@ -206,12 +203,19 @@
//-----------------------------------------------------------------------
@Test
public void now() {
+ final long DELTA = 20_000_000_000L; // 20 seconds of nanos leeway
ZonedDateTime nowDT = ZonedDateTime.now();
OffsetTime expected = OffsetTime.now(Clock.systemDefaultZone());
OffsetTime test = OffsetTime.now();
long diff = Math.abs(test.toLocalTime().toNanoOfDay() - expected.toLocalTime().toNanoOfDay());
- assertTrue(diff < 100000000); // less than 0.1 secs
+ if (diff >= DELTA) {
+ // may be date change
+ expected = OffsetTime.now(Clock.systemDefaultZone());
+ test = OffsetTime.now();
+ diff = Math.abs(test.toLocalTime().toNanoOfDay() - expected.toLocalTime().toNanoOfDay());
+ }
+ assertTrue(diff < DELTA);
assertEquals(test.getOffset(), nowDT.getOffset());
}
@@ -463,28 +467,16 @@
}
//-----------------------------------------------------------------------
- // constructor
+ // constructor via factory
//-----------------------------------------------------------------------
@Test(expectedExceptions=NullPointerException.class)
public void constructor_nullTime() throws Throwable {
- Constructor<OffsetTime> con = OffsetTime.class.getDeclaredConstructor(LocalTime.class, ZoneOffset.class);
- con.setAccessible(true);
- try {
- con.newInstance(null, OFFSET_PONE);
- } catch (InvocationTargetException ex) {
- throw ex.getCause();
- }
+ OffsetTime.of(null, OFFSET_PONE);
}
@Test(expectedExceptions=NullPointerException.class)
public void constructor_nullOffset() throws Throwable {
- Constructor<OffsetTime> con = OffsetTime.class.getDeclaredConstructor(LocalTime.class, ZoneOffset.class);
- con.setAccessible(true);
- try {
- con.newInstance(LocalTime.of(11, 30, 0, 0), null);
- } catch (InvocationTargetException ex) {
- throw ex.getCause();
- }
+ OffsetTime.of(LocalTime.of(11, 30, 0, 0), null);
}
//-----------------------------------------------------------------------
@@ -1148,6 +1140,29 @@
}
//-----------------------------------------------------------------------
+ // toEpochSecond()
+ //-----------------------------------------------------------------------
+ @DataProvider(name="epochSecond")
+ Object[][] provider_toEpochSecond() {
+ return new Object[][] {
+ {OffsetTime.of(0, 0, 0, 0, OFFSET_PTWO).toEpochSecond(LocalDate.of(1970, 1, 1)), -7200L},
+ {OffsetTime.of(11, 30, 0, 0, OFFSET_MTWO).toEpochSecond(LocalDate.of(1995, 9, 27)), 812208600L},
+ {OffsetTime.of(0, 0, 0, 0, OFFSET_PONE).toEpochSecond(LocalDate.of(1970, 1, 1)),
+ Instant.ofEpochSecond(-3600).getEpochSecond()},
+ {OffsetTime.of(11, 30, 0, 0, OFFSET_PTWO).toEpochSecond(LocalDate.of(1965, 12, 31)),
+ Instant.ofEpochSecond(-126282600L).getEpochSecond()},
+ {OffsetTime.of(11, 30, 0, 0, OFFSET_MTWO).toEpochSecond(LocalDate.of(1970, 1, 1)),
+ OffsetDateTime.of(LocalDate.of(1970, 1, 1), LocalTime.of(11, 30), OFFSET_MTWO)
+ .toEpochSecond()},
+ };
+ }
+
+ @Test(dataProvider="epochSecond")
+ public void test_toEpochSecond(long actual, long expected) {
+ assertEquals(actual, expected);
+ }
+
+ //-----------------------------------------------------------------------
// compareTo()
//-----------------------------------------------------------------------
@Test
diff --git a/ojluni/src/test/java/time/tck/java/time/TCKZoneOffset.java b/ojluni/src/test/java/time/tck/java/time/TCKZoneOffset.java
index c121079..7646643 100644
--- a/ojluni/src/test/java/time/tck/java/time/TCKZoneOffset.java
+++ b/ojluni/src/test/java/time/tck/java/time/TCKZoneOffset.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -419,6 +419,21 @@
ZoneOffset.ofHoursMinutesSeconds(-19, 0, 0);
}
+ @Test(expectedExceptions=DateTimeException.class)
+ public void test_factory_int_hours_minutes_seconds_minutesMinValue() {
+ ZoneOffset.ofHoursMinutesSeconds(0, Integer.MIN_VALUE, -1);
+ }
+
+ @Test(expectedExceptions=DateTimeException.class)
+ public void test_factory_int_hours_minutes_seconds_secondsMinValue() {
+ ZoneOffset.ofHoursMinutesSeconds(0, 0, Integer.MIN_VALUE);
+ }
+
+ @Test(expectedExceptions=DateTimeException.class)
+ public void test_factory_int_hours_minutes_seconds_minutesAndSecondsMinValue() {
+ ZoneOffset.ofHoursMinutesSeconds(0, Integer.MIN_VALUE, Integer.MIN_VALUE);
+ }
+
//-----------------------------------------------------------------------
@Test
public void test_factory_ofTotalSeconds() {
@@ -437,6 +452,11 @@
ZoneOffset.ofTotalSeconds(-18 * 60 * 60 - 1);
}
+ @Test(expectedExceptions=DateTimeException.class)
+ public void test_factory_ofTotalSeconds_minValue() {
+ ZoneOffset.ofTotalSeconds(Integer.MIN_VALUE);
+ }
+
//-----------------------------------------------------------------------
// from()
//-----------------------------------------------------------------------
diff --git a/ojluni/src/test/java/time/tck/java/time/TCKZonedDateTime.java b/ojluni/src/test/java/time/tck/java/time/TCKZonedDateTime.java
index fb743e8..8ca935c 100644
--- a/ojluni/src/test/java/time/tck/java/time/TCKZonedDateTime.java
+++ b/ojluni/src/test/java/time/tck/java/time/TCKZonedDateTime.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -253,14 +253,8 @@
ZoneId zone = ZoneId.of("UTC+01:02:03");
ZonedDateTime expected = ZonedDateTime.now(Clock.system(zone));
ZonedDateTime test = ZonedDateTime.now(zone);
- for (int i = 0; i < 100; i++) {
- if (expected.equals(test)) {
- return;
- }
- expected = ZonedDateTime.now(Clock.system(zone));
- test = ZonedDateTime.now(zone);
- }
- assertEquals(test, expected);
+ assertEquals(Duration.between(expected, test).truncatedTo(ChronoUnit.SECONDS),
+ Duration.ZERO);
}
//-----------------------------------------------------------------------
@@ -750,7 +744,7 @@
{"2012-06-30T12:30:40Z[GMT]", 2012, 6, 30, 12, 30, 40, 0, "GMT"},
{"2012-06-30T12:30:40Z[UT]", 2012, 6, 30, 12, 30, 40, 0, "UT"},
{"2012-06-30T12:30:40Z[UTC]", 2012, 6, 30, 12, 30, 40, 0, "UTC"},
- {"2012-06-30T12:30:40+01:00[Z]", 2012, 6, 30, 12, 30, 40, 0, "Z"},
+ {"2012-06-30T12:30:40+01:00[Z]", 2012, 6, 30, 11, 30, 40, 0, "Z"},
{"2012-06-30T12:30:40+01:00[+01:00]", 2012, 6, 30, 12, 30, 40, 0, "+01:00"},
{"2012-06-30T12:30:40+01:00[GMT+01:00]", 2012, 6, 30, 12, 30, 40, 0, "GMT+01:00"},
{"2012-06-30T12:30:40+01:00[UT+01:00]", 2012, 6, 30, 12, 30, 40, 0, "UT+01:00"},
@@ -760,6 +754,7 @@
{"2012-06-30T12:30:40-01:00[UT-01:00]", 2012, 6, 30, 12, 30, 40, 0, "UT-01:00"},
{"2012-06-30T12:30:40-01:00[UTC-01:00]", 2012, 6, 30, 12, 30, 40, 0, "UTC-01:00"},
{"2012-06-30T12:30:40+01:00[Europe/London]", 2012, 6, 30, 12, 30, 40, 0, "Europe/London"},
+ {"2012-06-30T12:30:40+01", 2012, 6, 30, 12, 30, 40, 0, "+01:00"},
};
}
diff --git a/ojluni/src/test/java/time/tck/java/time/chrono/CopticChronology.java b/ojluni/src/test/java/time/tck/java/time/chrono/CopticChronology.java
index c72b737..626b286 100644
--- a/ojluni/src/test/java/time/tck/java/time/chrono/CopticChronology.java
+++ b/ojluni/src/test/java/time/tck/java/time/chrono/CopticChronology.java
@@ -1,4 +1,5 @@
/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
diff --git a/ojluni/src/test/java/time/tck/java/time/chrono/CopticDate.java b/ojluni/src/test/java/time/tck/java/time/chrono/CopticDate.java
index a296c59..09e2e47 100644
--- a/ojluni/src/test/java/time/tck/java/time/chrono/CopticDate.java
+++ b/ojluni/src/test/java/time/tck/java/time/chrono/CopticDate.java
@@ -1,4 +1,5 @@
/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
diff --git a/ojluni/src/test/java/time/tck/java/time/chrono/CopticEra.java b/ojluni/src/test/java/time/tck/java/time/chrono/CopticEra.java
index c1d7f56..be78ff5 100644
--- a/ojluni/src/test/java/time/tck/java/time/chrono/CopticEra.java
+++ b/ojluni/src/test/java/time/tck/java/time/chrono/CopticEra.java
@@ -1,4 +1,5 @@
/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
diff --git a/ojluni/src/test/java/time/tck/java/time/chrono/TCKChronoPeriod.java b/ojluni/src/test/java/time/tck/java/time/chrono/TCKChronoPeriod.java
index 58a1c35..b8b1bd2 100644
--- a/ojluni/src/test/java/time/tck/java/time/chrono/TCKChronoPeriod.java
+++ b/ojluni/src/test/java/time/tck/java/time/chrono/TCKChronoPeriod.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -83,6 +83,7 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
+@Test
public class TCKChronoPeriod {
//-----------------------------------------------------------------------
diff --git a/ojluni/src/test/java/time/tck/java/time/chrono/TCKChronology.java b/ojluni/src/test/java/time/tck/java/time/chrono/TCKChronology.java
index 5164182..e9b2d37 100644
--- a/ojluni/src/test/java/time/tck/java/time/chrono/TCKChronology.java
+++ b/ojluni/src/test/java/time/tck/java/time/chrono/TCKChronology.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -68,11 +68,16 @@
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import java.time.ZoneId;
import java.time.Clock;
import java.time.DateTimeException;
+import java.time.LocalDate;
+import java.time.LocalTime;
+import java.time.OffsetDateTime;
+import java.time.ZoneId;
+import java.time.ZoneOffset;
import java.time.chrono.ChronoLocalDate;
import java.time.chrono.Chronology;
+import java.time.chrono.Era;
import java.time.chrono.HijrahChronology;
import java.time.chrono.HijrahEra;
import java.time.chrono.IsoChronology;
@@ -97,6 +102,14 @@
@Test
public class TCKChronology {
+ private static final ZoneOffset OFFSET_P0100 = ZoneOffset.ofHours(1);
+ private static final ZoneOffset OFFSET_M0100 = ZoneOffset.ofHours(-1);
+
+ private static final int YDIFF_MEIJI = 1867;
+ private static final int YDIFF_SHOWA = 1925;
+ private static final int YDIFF_HEISEI = 1988;
+ private static final int YDIFF_MINGUO = 1911;
+ private static final int YDIFF_THAIBUDDHIST = 543;
//-----------------------------------------------------------------------
// regular data factory for ID and calendarType of available calendars
//-----------------------------------------------------------------------
@@ -325,7 +338,7 @@
}
}
- @Test(expectedExceptions=DateTimeException.class)
+ @Test(expectedExceptions = DateTimeException.class)
public void test_lookupLocale() {
Locale.Builder builder = new Locale.Builder().setLanguage("en").setRegion("CA");
builder.setUnicodeLocaleKeyword("ca", "xxx");
@@ -339,4 +352,78 @@
Chronology chrono = Chronology.of("FooFoo");
}
+ @DataProvider(name = "epochSecond_dataProvider")
+ Object[][] data_epochSecond() {
+ return new Object[][] {
+ {JapaneseChronology.INSTANCE, 1873, 9, 7, 1, 2, 2, OFFSET_P0100},
+ {JapaneseChronology.INSTANCE, 1928, 2, 28, 1, 2, 2, OFFSET_M0100},
+ {JapaneseChronology.INSTANCE, 1989, 1, 8, 1, 2, 2, OFFSET_P0100},
+ {HijrahChronology.INSTANCE, 1434, 9, 7, 1, 2, 2, OFFSET_P0100},
+ {MinguoChronology.INSTANCE, 1873, 9, 7, 1, 2, 2, OFFSET_P0100},
+ {MinguoChronology.INSTANCE, 1928, 2, 28, 1, 2, 2, OFFSET_M0100},
+ {MinguoChronology.INSTANCE, 1989, 1, 8, 1, 2, 2, OFFSET_P0100},
+ {ThaiBuddhistChronology.INSTANCE, 1873, 9, 7, 1, 2, 2, OFFSET_P0100},
+ {ThaiBuddhistChronology.INSTANCE, 1928, 2, 28, 1, 2, 2, OFFSET_M0100},
+ {ThaiBuddhistChronology.INSTANCE, 1989, 1, 8, 1, 2, 2, OFFSET_P0100},
+ {IsoChronology.INSTANCE, 1873, 9, 7, 1, 2, 2, OFFSET_P0100},
+ {IsoChronology.INSTANCE, 1928, 2, 28, 1, 2, 2, OFFSET_M0100},
+ {IsoChronology.INSTANCE, 1989, 1, 8, 1, 2, 2, OFFSET_P0100},
+
+ };
+ }
+
+ @Test(dataProvider = "epochSecond_dataProvider")
+ public void test_epochSecond(Chronology chrono, int y, int m, int d, int h, int min, int s, ZoneOffset offset) {
+ ChronoLocalDate chronoLd = chrono.date(y, m, d);
+ assertEquals(chrono.epochSecond(y, m, d, h, min, s, offset),
+ OffsetDateTime.of(LocalDate.from(chronoLd), LocalTime.of(h, min, s), offset)
+ .toEpochSecond());
+ }
+
+ @DataProvider(name = "era_epochSecond_dataProvider")
+ Object[][] data_era_epochSecond() {
+ return new Object[][] {
+ {JapaneseChronology.INSTANCE, JapaneseEra.MEIJI, 1873 - YDIFF_MEIJI, 9, 7, 1, 2, 2, OFFSET_P0100},
+ {JapaneseChronology.INSTANCE, JapaneseEra.SHOWA, 1928 - YDIFF_SHOWA, 2, 28, 1, 2, 2, OFFSET_M0100},
+ {JapaneseChronology.INSTANCE, JapaneseEra.HEISEI, 1989 - YDIFF_HEISEI, 1, 8, 1, 2, 2, OFFSET_P0100},
+ {HijrahChronology.INSTANCE, HijrahEra.AH, 1434, 9, 7, 1, 2, 2, OFFSET_P0100},
+ {MinguoChronology.INSTANCE, MinguoEra.BEFORE_ROC, 1873 - YDIFF_MINGUO, 9, 7, 1, 2, 2, OFFSET_P0100},
+ {MinguoChronology.INSTANCE, MinguoEra.ROC, 1928 - YDIFF_MINGUO, 2, 28, 1, 2, 2, OFFSET_M0100},
+ {MinguoChronology.INSTANCE, MinguoEra.ROC, 1989 - YDIFF_MINGUO, 1, 8, 1, 2, 2, OFFSET_P0100},
+ {ThaiBuddhistChronology.INSTANCE, ThaiBuddhistEra.BE, 1873 + YDIFF_THAIBUDDHIST, 9, 7, 1, 2, 2, OFFSET_P0100},
+ {ThaiBuddhistChronology.INSTANCE, ThaiBuddhistEra.BE, 1928 + YDIFF_THAIBUDDHIST, 2, 28, 1, 2, 2, OFFSET_M0100},
+ {ThaiBuddhistChronology.INSTANCE, ThaiBuddhistEra.BE, 1989 + YDIFF_THAIBUDDHIST, 1, 8, 1, 2, 2, OFFSET_P0100},
+ {IsoChronology.INSTANCE, IsoEra.CE, 1873, 9, 7, 1, 2, 2, OFFSET_P0100},
+ {IsoChronology.INSTANCE, IsoEra.CE, 1928, 2, 28, 1, 2, 2, OFFSET_M0100},
+ {IsoChronology.INSTANCE, IsoEra.CE, 1989, 1, 8, 1, 2, 2, OFFSET_P0100},
+
+ };
+ }
+
+ @Test(dataProvider = "era_epochSecond_dataProvider")
+ public void test_epochSecond(Chronology chrono, Era era, int y, int m, int d, int h, int min, int s, ZoneOffset offset) {
+ ChronoLocalDate chronoLd = chrono.date(era, y, m, d);
+ assertEquals(chrono.epochSecond(era, y, m, d, h, min, s, offset),
+ OffsetDateTime.of(LocalDate.from(chronoLd), LocalTime.of(h, min, s), offset)
+ .toEpochSecond());
+ }
+
+ @DataProvider(name = "bad_epochSecond_dataProvider")
+ Object[][] bad_data_epochSecond() {
+ return new Object[][] {
+ {JapaneseChronology.INSTANCE, 1873, 13, 7, 1, 2, 2, OFFSET_P0100},
+ {HijrahChronology.INSTANCE, 1434, 9, 32, 1, 2, 2, OFFSET_P0100},
+ {MinguoChronology.INSTANCE, 1873, 9, 7, 31, 2, 2, OFFSET_P0100},
+ {ThaiBuddhistChronology.INSTANCE, 1928, 2, 28, -1, 2, 2, OFFSET_M0100},
+ {IsoChronology.INSTANCE, 1928, 2, 28, 1, 60, 2, OFFSET_M0100},
+ {IsoChronology.INSTANCE, 1989, 1, 8, 1, 2, -2, OFFSET_P0100},
+
+ };
+ }
+
+ @Test(dataProvider = "bad_epochSecond_dataProvider", expectedExceptions = DateTimeException.class)
+ public void test_bad_epochSecond(Chronology chrono, int y, int m, int d, int h, int min, int s, ZoneOffset offset) {
+ chrono.epochSecond(y, m, d, h, min, s, offset);
+ }
+
}
diff --git a/ojluni/src/test/java/time/tck/java/time/chrono/TCKIsoChronology.java b/ojluni/src/test/java/time/tck/java/time/chrono/TCKIsoChronology.java
index 0cd8eed..d753917 100644
--- a/ojluni/src/test/java/time/tck/java/time/chrono/TCKIsoChronology.java
+++ b/ojluni/src/test/java/time/tck/java/time/chrono/TCKIsoChronology.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -63,10 +63,16 @@
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
-import java.time.ZoneId;
+import java.time.OffsetDateTime;
+import java.time.Year;
import java.time.ZonedDateTime;
+import java.time.ZoneId;
+import java.time.ZoneOffset;
import java.time.chrono.Chronology;
+import java.time.chrono.Era;
+import java.time.chrono.HijrahEra;
import java.time.chrono.IsoChronology;
+import java.time.chrono.IsoEra;
import java.time.format.ResolverStyle;
import java.time.temporal.ChronoField;
import java.time.temporal.TemporalAccessor;
@@ -87,6 +93,8 @@
public class TCKIsoChronology {
// Can only work with IsoChronology here
// others may be in separate module
+ private static final ZoneOffset OFFSET_P0100 = ZoneOffset.ofHours(1);
+ private static final ZoneOffset OFFSET_M0100 = ZoneOffset.ofHours(-1);
@Test
public void factory_from_TemporalAccessor_dateWithChronlogy() {
@@ -675,9 +683,114 @@
}
}
+ @DataProvider(name = "epochSecond_dataProvider")
+ Object[][] data_epochSecond() {
+ return new Object[][] {
+ {2008, 3, 3, 1, 2, 2, OFFSET_P0100},
+ {2008, 3, 3, 1, 2, 2, OFFSET_M0100},
+ {2008, 2, 28, 1, 2, 2, OFFSET_P0100},
+ {2009, 3, 3, 1, 2, 2, OFFSET_P0100},
+ {2009, 3, 3, 1, 2, 2, OFFSET_M0100},
+ {2009, 2, 28, 1, 2, 2, OFFSET_P0100},
+ {1968, 3, 3, 1, 2, 2, OFFSET_P0100},
+ {1968, 3, 3, 1, 2, 2, OFFSET_M0100},
+ {1968, 2, 28, 1, 2, 2, OFFSET_P0100},
+ {1969, 3, 3 , 1, 2, 2, OFFSET_P0100},
+ {1969, 3, 3, 1, 2, 2, OFFSET_M0100},
+ {1969, 2, 28, 1, 2, 2, OFFSET_P0100},
+ {1970, 1, 1, 1, 2, 2, OFFSET_P0100},
+ {1970, 1, 1, 1, 2, 2, OFFSET_M0100},
+ {-4, 3, 3 , 1, 2, 2, OFFSET_P0100},
+ {-1, 3, 3 , 1, 2, 2, OFFSET_P0100},
+ };
+ }
+
+ @Test(dataProvider = "epochSecond_dataProvider")
+ public void test_epochSecond_1(int y, int m, int d, int h , int min, int s, ZoneOffset offset) {
+ assertEquals(IsoChronology.INSTANCE.epochSecond(y, m, d, h, min, s, offset),
+ OffsetDateTime.of(y, m, d, h, min, s, 0, offset).toEpochSecond());
+ }
+
+ @Test
+ public void test_epochSecond_2() {
+ assertEquals(IsoChronology.INSTANCE.epochSecond(2008, 3, 3, 1, 2, 2, OFFSET_P0100),
+ ZonedDateTime.of(2008, 3, 3, 1, 2, 2, 0, ZoneId.of("+01:00")).toEpochSecond());
+ assertEquals(IsoChronology.INSTANCE.epochSecond(1969, 3, 3, 1, 2, 2, OFFSET_P0100),
+ ZonedDateTime.of(1969, 3, 3, 1, 2, 2, 0, ZoneId.of("+01:00")).toEpochSecond());
+ }
+
+ @Test
+ public void test_epochSecond_max() {
+ assertEquals(IsoChronology.INSTANCE.epochSecond(Year.MAX_VALUE, 12, 31, 23, 59, 59, ZoneOffset.MIN),
+ OffsetDateTime.of(Year.MAX_VALUE, 12, 31, 23, 59, 59, 0, ZoneOffset.MIN).toEpochSecond());
+ }
+
+ @Test
+ public void test_epochSecond_min() {
+ assertEquals(IsoChronology.INSTANCE.epochSecond(Year.MIN_VALUE, 1, 1, 0, 0, 0, ZoneOffset.MAX),
+ OffsetDateTime.of(Year.MIN_VALUE, 1, 1, 0, 0, 0, 0, ZoneOffset.MAX).toEpochSecond());
+ }
+
+ @DataProvider(name = "bad_epochSecond_dataProvider")
+ Object[][] bad_data_epochSecond() {
+ return new Object[][] {
+ {2009, 13, 1, 1, 1, 1, OFFSET_P0100},
+ {2009, 2, 29, 1, 1, 1, OFFSET_P0100},
+ {2009, 1, 1, 25, 1, 1, OFFSET_P0100},
+ {2009, 1, 1, 1, 60, 1, OFFSET_P0100},
+ {2009, 1, 1, 1, 1, -11, OFFSET_P0100},
+ };
+ }
+ @Test(dataProvider = "bad_epochSecond_dataProvider", expectedExceptions = DateTimeException.class)
+ public void test_epochSecond_bad(int y, int m, int d, int h , int min, int s, ZoneOffset offset) {
+ IsoChronology.INSTANCE.epochSecond(y, m, d, h, min, s, offset);
+ }
+
+ @DataProvider(name = "era_epochSecond_dataProvider")
+ Object[][] data_era_epochSecond() {
+ return new Object[][] {
+ {IsoEra.CE, 2008, 3, 3, 1, 2, 2, OFFSET_P0100},
+ {IsoEra.CE, 2008, 3, 3, 1, 2, 2, OFFSET_M0100},
+ {IsoEra.CE, 2008, 2, 28, 1, 2, 2, OFFSET_P0100},
+ {IsoEra.CE, 2009, 3, 3, 1, 2, 2, OFFSET_P0100},
+ {IsoEra.CE, 2009, 3, 3, 1, 2, 2, OFFSET_M0100},
+ {IsoEra.CE, 2009, 2, 28, 1, 2, 2, OFFSET_P0100},
+ {IsoEra.CE, 1968, 3, 3, 1, 2, 2, OFFSET_P0100},
+ {IsoEra.CE, 1968, 3, 3, 1, 2, 2, OFFSET_M0100},
+ {IsoEra.CE, 1968, 2, 28, 1, 2, 2, OFFSET_P0100},
+ {IsoEra.CE, 1969, 3, 3 , 1, 2, 2, OFFSET_P0100},
+ {IsoEra.CE, 1969, 3, 3, 1, 2, 2, OFFSET_M0100},
+ {IsoEra.CE, 1969, 2, 28, 1, 2, 2, OFFSET_P0100},
+ {IsoEra.CE, 1970, 1, 1, 1, 2, 2, OFFSET_P0100},
+ {IsoEra.CE, 1970, 1, 1, 1, 2, 2, OFFSET_M0100},
+ {IsoEra.BCE, 5, 3, 3 , 1, 2, 2, OFFSET_P0100},
+ {IsoEra.BCE, 2, 3, 3 , 1, 2, 2, OFFSET_P0100},
+ };
+ }
+
+ @Test(dataProvider = "era_epochSecond_dataProvider")
+ public void test_era_epochSecond_1(Era era, int y, int m, int d, int h , int min, int s, ZoneOffset offset) {
+ assertEquals(IsoChronology.INSTANCE.epochSecond(era, y, m, d, h, min, s, offset),
+ OffsetDateTime.of(IsoChronology.INSTANCE.date(era, y, m, d), LocalTime.of(h, min, s), offset)
+ .toEpochSecond());
+ }
+
+ @Test
+ public void test_era_epochSecond_2() {
+ assertEquals(IsoChronology.INSTANCE.epochSecond(IsoEra.CE, 2008, 3, 3, 1, 2, 2, OFFSET_P0100),
+ ZonedDateTime.of(2008, 3, 3, 1, 2, 2, 0, ZoneId.of("+01:00")).toEpochSecond());
+ assertEquals(IsoChronology.INSTANCE.epochSecond(IsoEra.CE, 1969, 3, 3, 1, 2, 2, OFFSET_P0100),
+ ZonedDateTime.of(1969, 3, 3, 1, 2, 2, 0, ZoneId.of("+01:00")).toEpochSecond());
+ }
+
+ @Test(expectedExceptions = ClassCastException.class)
+ public void test_era_epochSecond_bad() {
+ IsoChronology.INSTANCE.epochSecond(HijrahEra.AH, 2009, 2, 29, 1, 2, 2, OFFSET_P0100);
+ }
+
+
//-----------------------------------------------------------------------
private static LocalDate date(int y, int m, int d) {
return LocalDate.of(y, m, d);
}
-
}
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 c45cd96..b5650ee 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
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
+ o Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
diff --git a/ojluni/src/test/java/time/tck/java/time/chrono/TCKJapaneseEra.java b/ojluni/src/test/java/time/tck/java/time/chrono/TCKJapaneseEra.java
index afe2586..0fbeab3 100644
--- a/ojluni/src/test/java/time/tck/java/time/chrono/TCKJapaneseEra.java
+++ b/ojluni/src/test/java/time/tck/java/time/chrono/TCKJapaneseEra.java
@@ -59,6 +59,7 @@
import static java.time.temporal.ChronoField.ERA;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
import java.time.chrono.Era;
import java.time.chrono.JapaneseChronology;
@@ -69,7 +70,8 @@
import org.testng.annotations.Test;
/**
- * Test.
+ * Tests for JapaneseEra
+ * @bug 8068278
*/
@Test
public class TCKJapaneseEra {
@@ -87,6 +89,20 @@
};
}
+ @DataProvider(name = "InvalidJapaneseEras")
+ Object[][] data_of_invalid_eras() {
+ return new Object[][] {
+ {-2},
+ {-3},
+ {4},
+ {Integer.MIN_VALUE},
+ {Integer.MAX_VALUE},
+ };
+ }
+
+ //-----------------------------------------------------------------------
+ // JapaneseEra value test
+ //-----------------------------------------------------------------------
@Test(dataProvider="JapaneseEras")
public void test_valueOf(JapaneseEra era , String eraName, int eraValue) {
assertEquals(era.getValue(), eraValue);
@@ -121,4 +137,11 @@
}
}
+ //-----------------------------------------------------------------------
+ // JapaneseChronology.INSTANCE.eraOf invalid era test
+ //-----------------------------------------------------------------------
+ @Test(dataProvider="InvalidJapaneseEras", expectedExceptions=java.time.DateTimeException.class)
+ public void test_outofrange(int era) {
+ JapaneseChronology.INSTANCE.eraOf(era);
+ }
}
diff --git a/ojluni/src/test/java/time/tck/java/time/format/TCKDTFParsedInstant.java b/ojluni/src/test/java/time/tck/java/time/format/TCKDTFParsedInstant.java
new file mode 100644
index 0000000..ec60f0f
--- /dev/null
+++ b/ojluni/src/test/java/time/tck/java/time/format/TCKDTFParsedInstant.java
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package tck.java.time.format;
+
+import static org.testng.AssertJUnit.assertEquals;
+
+import java.time.LocalDateTime;
+import java.time.OffsetDateTime;
+import java.time.ZoneId;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.Locale;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * Testing DateTimeFormatter Parsing with 4 different test conditions:
+ * 1. When Zone and Offset not provided
+ * 2. When Zone and Offset provided
+ * 3. When Offset is not provided and Zone is provided
+ * 4. When Zone is not provided and Offset is provided
+ */
+
+@Test
+public class TCKDTFParsedInstant {
+
+ private static final ZoneId EUROPE_BERLIN = ZoneId.of("Europe/Berlin");
+ private static final ZoneId ASIA_ISTANBUL = ZoneId.of("Asia/Istanbul");
+
+ private DateTimeFormatter dtFormatter;
+ private ZonedDateTime zdt1, zdt2;
+ private LocalDateTime ldt1;
+ private OffsetDateTime odt1;
+
+ @BeforeMethod
+ public void setUp() throws Exception {
+ dtFormatter = DateTimeFormatter.ISO_ZONED_DATE_TIME;
+ }
+
+ @DataProvider(name="parseWithoutZoneWithoutOffset")
+ Object[][] data_parse_WithoutOffset_WithoutZone() {
+ return new Object[][] {
+ {"1966-12-31T00:01:10", LocalDateTime.of(1966, 12, 31, 0, 1, 10)},
+ {"1970-01-01T00:00:00", LocalDateTime.of(1970, 1, 1, 0, 0, 0)},
+ {"2004-02-29T00:30:00", LocalDateTime.of(2004, 2, 29, 0, 30, 0)},
+ {"2015-12-31T23:59:59", LocalDateTime.of(2015, 12, 31, 23, 59, 59)}
+ };
+ }
+
+ @Test(dataProvider="parseWithoutZoneWithoutOffset")
+ public void testWithoutZoneWithoutOffset(String ldtString, LocalDateTime expectedLDT) {
+ dtFormatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME;
+ ldt1 = LocalDateTime.parse(ldtString, dtFormatter);
+ assertEquals(expectedLDT, ldt1);
+ }
+
+ @DataProvider(name="parseWithZoneWithOffset")
+ Object[][] data_parse_WithZone_WithOffset() {
+ return new Object[][] {
+ {"2012-10-28T01:45:00-02:30[Europe/Berlin]",
+ LocalDateTime.of(2012, 10, 28, 1, 45, 0, 0), ZoneOffset.of("-02:30"), EUROPE_BERLIN},
+ {"2012-10-28T01:45:00-01:00[Europe/Berlin]",
+ LocalDateTime.of(2012, 10, 28, 1, 45, 0, 0), ZoneOffset.of("-01:00"), EUROPE_BERLIN},
+ {"2012-10-28T01:45:00-00:00[Europe/Berlin]",
+ LocalDateTime.of(2012, 10, 28, 1, 45, 0, 0), ZoneOffset.of("-00:00"), EUROPE_BERLIN},
+ {"2012-10-28T01:45:00+00:00[Europe/Berlin]",
+ LocalDateTime.of(2012, 10, 28, 1, 45, 0, 0), ZoneOffset.of("+00:00"), EUROPE_BERLIN},
+ {"2012-10-28T01:45:00+01:00[Europe/Berlin]",
+ LocalDateTime.of(2012, 10, 28, 1, 45, 0, 0), ZoneOffset.of("+01:00"), EUROPE_BERLIN},
+ {"2012-10-28T01:45:00+02:00[Europe/Berlin]",
+ LocalDateTime.of(2012, 10, 28, 1, 45, 0, 0), ZoneOffset.of("+02:00"), EUROPE_BERLIN},
+ {"2012-10-28T01:45:00+03:00[Europe/Berlin]",
+ LocalDateTime.of(2012, 10, 28, 1, 45, 0, 0), ZoneOffset.of("+03:00"), EUROPE_BERLIN},
+ {"2012-10-28T02:45:00-02:30[Europe/Berlin]",
+ LocalDateTime.of(2012, 10, 28, 2, 45, 0, 0), ZoneOffset.of("-02:30"), EUROPE_BERLIN},
+ {"2012-10-28T02:45:00-01:00[Europe/Berlin]",
+ LocalDateTime.of(2012, 10, 28, 2, 45, 0, 0), ZoneOffset.of("-01:00"), EUROPE_BERLIN},
+ {"2012-10-28T02:45:00-00:00[Europe/Berlin]",
+ LocalDateTime.of(2012, 10, 28, 2, 45, 0, 0), ZoneOffset.of("-00:00"), EUROPE_BERLIN},
+ {"2012-10-28T02:45:00+00:00[Europe/Berlin]",
+ LocalDateTime.of(2012, 10, 28, 2, 45, 0, 0), ZoneOffset.of("+00:00"), EUROPE_BERLIN},
+ {"2012-10-28T02:45:00+01:00[Europe/Berlin]",
+ LocalDateTime.of(2012, 10, 28, 2, 45, 0, 0), ZoneOffset.of("+01:00"), EUROPE_BERLIN},
+ {"2012-10-28T02:45:00+02:00[Europe/Berlin]",
+ LocalDateTime.of(2012, 10, 28, 2, 45, 0, 0), ZoneOffset.of("+02:00"), EUROPE_BERLIN},
+ {"2012-10-28T02:45:00+03:00[Europe/Berlin]",
+ LocalDateTime.of(2012, 10, 28, 2, 45, 0, 0), ZoneOffset.of("+03:00"), EUROPE_BERLIN},
+ {"2012-10-28T03:45:00-02:30[Europe/Berlin]",
+ LocalDateTime.of(2012, 10, 28, 3, 45, 0, 0), ZoneOffset.of("-02:30"), EUROPE_BERLIN},
+ {"2012-10-28T03:45:00-01:00[Europe/Berlin]",
+ LocalDateTime.of(2012, 10, 28, 3, 45, 0, 0), ZoneOffset.of("-01:00"), EUROPE_BERLIN},
+ {"2012-10-28T03:45:00-00:00[Europe/Berlin]",
+ LocalDateTime.of(2012, 10, 28, 3, 45, 0, 0), ZoneOffset.of("-00:00"), EUROPE_BERLIN},
+ {"2012-10-28T03:45:00+00:00[Europe/Berlin]",
+ LocalDateTime.of(2012, 10, 28, 3, 45, 0, 0), ZoneOffset.of("+00:00"), EUROPE_BERLIN},
+ {"2012-10-28T03:45:00+01:00[Europe/Berlin]",
+ LocalDateTime.of(2012, 10, 28, 3, 45, 0, 0), ZoneOffset.of("+01:00"), EUROPE_BERLIN},
+ {"2012-10-28T03:45:00+02:00[Europe/Berlin]",
+ LocalDateTime.of(2012, 10, 28, 3, 45, 0, 0), ZoneOffset.of("+02:00"), EUROPE_BERLIN},
+ {"2012-10-28T03:45:00+03:00[Europe/Berlin]",
+ LocalDateTime.of(2012, 10, 28, 3, 45, 0, 0), ZoneOffset.of("+03:00"), EUROPE_BERLIN},
+
+ {"2012-10-28T02:45:00-02:30[Asia/Istanbul]",
+ LocalDateTime.of(2012, 10, 28, 2, 45, 0, 0), ZoneOffset.of("-02:30"), ASIA_ISTANBUL},
+ {"2012-10-28T02:45:00-01:00[Asia/Istanbul]",
+ LocalDateTime.of(2012, 10, 28, 2, 45, 0, 0), ZoneOffset.of("-01:00"), ASIA_ISTANBUL},
+ {"2012-10-28T02:45:00-00:00[Asia/Istanbul]",
+ LocalDateTime.of(2012, 10, 28, 2, 45, 0, 0), ZoneOffset.of("-00:00"), ASIA_ISTANBUL},
+ {"2012-10-28T02:45:00+00:00[Asia/Istanbul]",
+ LocalDateTime.of(2012, 10, 28, 2, 45, 0, 0), ZoneOffset.of("+00:00"), ASIA_ISTANBUL},
+ {"2012-10-28T02:45:00+01:00[Asia/Istanbul]",
+ LocalDateTime.of(2012, 10, 28, 2, 45, 0, 0), ZoneOffset.of("+01:00"), ASIA_ISTANBUL},
+ {"2012-10-28T02:45:00+02:00[Asia/Istanbul]",
+ LocalDateTime.of(2012, 10, 28, 2, 45, 0, 0), ZoneOffset.of("+02:00"), ASIA_ISTANBUL},
+ {"2012-10-28T02:45:00+03:00[Asia/Istanbul]",
+ LocalDateTime.of(2012, 10, 28, 2, 45, 0, 0), ZoneOffset.of("+03:00"), ASIA_ISTANBUL},
+ {"2012-10-28T03:45:00-02:30[Asia/Istanbul]",
+ LocalDateTime.of(2012, 10, 28, 3, 45, 0, 0), ZoneOffset.of("-02:30"), ASIA_ISTANBUL},
+ {"2012-10-28T03:45:00-01:00[Asia/Istanbul]",
+ LocalDateTime.of(2012, 10, 28, 3, 45, 0, 0), ZoneOffset.of("-01:00"), ASIA_ISTANBUL},
+ {"2012-10-28T03:45:00-00:00[Asia/Istanbul]",
+ LocalDateTime.of(2012, 10, 28, 3, 45, 0, 0), ZoneOffset.of("-00:00"), ASIA_ISTANBUL},
+ {"2012-10-28T03:45:00+00:00[Asia/Istanbul]",
+ LocalDateTime.of(2012, 10, 28, 3, 45, 0, 0), ZoneOffset.of("+00:00"), ASIA_ISTANBUL},
+ {"2012-10-28T03:45:00+01:00[Asia/Istanbul]",
+ LocalDateTime.of(2012, 10, 28, 3, 45, 0, 0), ZoneOffset.of("+01:00"), ASIA_ISTANBUL},
+ {"2012-10-28T03:45:00+02:00[Asia/Istanbul]",
+ LocalDateTime.of(2012, 10, 28, 3, 45, 0, 0), ZoneOffset.of("+02:00"), ASIA_ISTANBUL},
+ {"2012-10-28T03:45:00+03:00[Asia/Istanbul]",
+ LocalDateTime.of(2012, 10, 28, 3, 45, 0, 0), ZoneOffset.of("+03:00"), ASIA_ISTANBUL},
+ {"2012-10-28T04:45:00-02:30[Asia/Istanbul]",
+ LocalDateTime.of(2012, 10, 28, 4, 45, 0, 0), ZoneOffset.of("-02:30"), ASIA_ISTANBUL},
+ {"2012-10-28T04:45:00-01:00[Asia/Istanbul]",
+ LocalDateTime.of(2012, 10, 28, 4, 45, 0, 0), ZoneOffset.of("-01:00"), ASIA_ISTANBUL},
+ {"2012-10-28T04:45:00-00:00[Asia/Istanbul]",
+ LocalDateTime.of(2012, 10, 28, 4, 45, 0, 0), ZoneOffset.of("-00:00"), ASIA_ISTANBUL},
+ {"2012-10-28T04:45:00+00:00[Asia/Istanbul]",
+ LocalDateTime.of(2012, 10, 28, 4, 45, 0, 0), ZoneOffset.of("+00:00"), ASIA_ISTANBUL},
+ {"2012-10-28T04:45:00+01:00[Asia/Istanbul]",
+ LocalDateTime.of(2012, 10, 28, 4, 45, 0, 0), ZoneOffset.of("+01:00"), ASIA_ISTANBUL},
+ {"2012-10-28T04:45:00+02:00[Asia/Istanbul]",
+ LocalDateTime.of(2012, 10, 28, 4, 45, 0, 0), ZoneOffset.of("+02:00"), ASIA_ISTANBUL},
+ {"2012-10-28T04:45:00+03:00[Asia/Istanbul]",
+ LocalDateTime.of(2012, 10, 28, 4, 45, 0, 0), ZoneOffset.of("+03:00"), ASIA_ISTANBUL}
+ };
+ }
+
+ @Test(dataProvider="parseWithZoneWithOffset")
+ public void testWithZoneWithOffset(String zdtString, LocalDateTime ldt, ZoneOffset offset, ZoneId zone) {
+ dtFormatter = DateTimeFormatter.ISO_ZONED_DATE_TIME;
+ zdt1 = ZonedDateTime.ofInstant(ldt, offset, zone);
+ zdt2 = ZonedDateTime.parse(zdtString, dtFormatter);
+ assertEquals(zdt1, zdt2);
+ }
+
+ @DataProvider(name="parseWithZoneWithoutOffset")
+ Object[][] data_parse_WithZone_WithoutOffset() {
+ return new Object[][] {
+ {"28 Oct 00:45:00 2012 Europe/Berlin", ZonedDateTime.of(2012, 10, 28, 0, 45, 0, 0, EUROPE_BERLIN)},
+ {"28 Oct 01:45:00 2012 Europe/Berlin", ZonedDateTime.of(2012, 10, 28, 1, 45, 0, 0, EUROPE_BERLIN)},
+ {"28 Oct 02:45:00 2012 Europe/Berlin", ZonedDateTime.of(2012, 10, 28, 2, 45, 0, 0, EUROPE_BERLIN)},
+ {"28 Oct 03:45:00 2012 Europe/Berlin", ZonedDateTime.of(2012, 10, 28, 3, 45, 0, 0, EUROPE_BERLIN)},
+ {"28 Oct 04:45:00 2012 Europe/Berlin", ZonedDateTime.of(2012, 10, 28, 4, 45, 0, 0, EUROPE_BERLIN)},
+
+ {"28 Oct 01:45:00 2012 Asia/Istanbul", ZonedDateTime.of(2012, 10, 28, 1, 45, 0, 0, ASIA_ISTANBUL)},
+ {"28 Oct 02:45:00 2012 Asia/Istanbul", ZonedDateTime.of(2012, 10, 28, 2, 45, 0, 0, ASIA_ISTANBUL)},
+ {"28 Oct 03:45:00 2012 Asia/Istanbul", ZonedDateTime.of(2012, 10, 28, 3, 45, 0, 0, ASIA_ISTANBUL)},
+ {"28 Oct 04:45:00 2012 Asia/Istanbul", ZonedDateTime.of(2012, 10, 28, 4, 45, 0, 0, ASIA_ISTANBUL)},
+ {"28 Oct 05:45:00 2012 Asia/Istanbul", ZonedDateTime.of(2012, 10, 28, 5, 45, 0, 0, ASIA_ISTANBUL)}
+ };
+ }
+
+ @Test(dataProvider="parseWithZoneWithoutOffset")
+ public void testWithZoneWithoutOffset(String withZoneWithoutOffset, ZonedDateTime expectedZDT) {
+ dtFormatter = DateTimeFormatter.ofPattern("d MMM HH:mm:ss uuuu VV").withLocale(Locale.ENGLISH);
+ zdt1 = ZonedDateTime.parse(withZoneWithoutOffset, dtFormatter);
+ assertEquals(expectedZDT, zdt1);
+ }
+
+ @DataProvider(name="parseWithOffsetWithoutZone")
+ Object[][] data_parse_WithOffset_WithoutZone() {
+ return new Object[][] {
+ {"2015-12-14T00:45:00-11:30", OffsetDateTime.of(2015, 12, 14, 0, 45, 0, 0, ZoneOffset.of("-11:30"))},
+ {"2015-12-14T01:45:00-05:00", OffsetDateTime.of(2015, 12, 14, 1, 45, 0, 0, ZoneOffset.of("-05:00"))},
+ {"2015-12-14T02:45:00-00:00", OffsetDateTime.of(2015, 12, 14, 2, 45, 0, 0, ZoneOffset.of("-00:00"))},
+ {"2015-12-14T03:45:00+00:00", OffsetDateTime.of(2015, 12, 14, 3, 45, 0, 0, ZoneOffset.of("+00:00"))},
+ {"2015-12-14T04:45:00+03:30", OffsetDateTime.of(2015, 12, 14, 4, 45, 0, 0, ZoneOffset.of("+03:30"))},
+ {"2015-12-14T05:45:00+10:00", OffsetDateTime.of(2015, 12, 14, 5, 45, 0, 0, ZoneOffset.of("+10:00"))}
+ };
+ }
+
+ @Test(dataProvider="parseWithOffsetWithoutZone")
+ public void testWithOffsetWithoutZone(String odtString, OffsetDateTime expectedOTD) {
+ dtFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
+ odt1 = OffsetDateTime.parse(odtString, dtFormatter);
+ assertEquals(expectedOTD, odt1);
+ }
+}
diff --git a/ojluni/src/test/java/time/tck/java/time/format/TCKDateTimeFormatterBuilder.java b/ojluni/src/test/java/time/tck/java/time/format/TCKDateTimeFormatterBuilder.java
index c5a017c..7429f01 100644
--- a/ojluni/src/test/java/time/tck/java/time/format/TCKDateTimeFormatterBuilder.java
+++ b/ojluni/src/test/java/time/tck/java/time/format/TCKDateTimeFormatterBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -59,20 +59,28 @@
*/
package tck.java.time.format;
+import static java.time.format.DateTimeFormatter.BASIC_ISO_DATE;
import static java.time.temporal.ChronoField.DAY_OF_MONTH;
import static java.time.temporal.ChronoField.HOUR_OF_DAY;
import static java.time.temporal.ChronoField.MINUTE_OF_HOUR;
import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
import static java.time.temporal.ChronoField.NANO_OF_SECOND;
+import static java.time.temporal.ChronoField.OFFSET_SECONDS;
import static java.time.temporal.ChronoField.YEAR;
import static org.testng.Assert.assertEquals;
import java.text.ParsePosition;
import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.Month;
import java.time.YearMonth;
+import java.time.ZonedDateTime;
+import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.DateTimeParseException;
import java.time.format.SignStyle;
import java.time.format.TextStyle;
import java.time.temporal.Temporal;
@@ -339,6 +347,18 @@
{"+HH", 2, 0, 45, "+02"},
{"+HH", 2, 30, 45, "+02"},
+ {"+HHmm", 2, 0, 0, "+02"},
+ {"+HHmm", -2, 0, 0, "-02"},
+ {"+HHmm", 2, 30, 0, "+0230"},
+ {"+HHmm", 2, 0, 45, "+02"},
+ {"+HHmm", 2, 30, 45, "+0230"},
+
+ {"+HH:mm", 2, 0, 0, "+02"},
+ {"+HH:mm", -2, 0, 0, "-02"},
+ {"+HH:mm", 2, 30, 0, "+02:30"},
+ {"+HH:mm", 2, 0, 45, "+02"},
+ {"+HH:mm", 2, 30, 45, "+02:30"},
+
{"+HHMM", 2, 0, 0, "+0200"},
{"+HHMM", -2, 0, 0, "-0200"},
{"+HHMM", 2, 30, 0, "+0230"},
@@ -374,6 +394,141 @@
{"+HH:MM:SS", 2, 30, 0, "+02:30:00"},
{"+HH:MM:SS", 2, 0, 45, "+02:00:45"},
{"+HH:MM:SS", 2, 30, 45, "+02:30:45"},
+
+ {"+HHmmss", 2, 0, 0, "+02"},
+ {"+HHmmss", -2, 0, 0, "-02"},
+ {"+HHmmss", 2, 30, 0, "+0230"},
+ {"+HHmmss", 2, 0, 45, "+020045"},
+ {"+HHmmss", 2, 30, 45, "+023045"},
+
+ {"+HH:mm:ss", 2, 0, 0, "+02"},
+ {"+HH:mm:ss", -2, 0, 0, "-02"},
+ {"+HH:mm:ss", 2, 30, 0, "+02:30"},
+ {"+HH:mm:ss", 2, 0, 45, "+02:00:45"},
+ {"+HH:mm:ss", 2, 30, 45, "+02:30:45"},
+
+ {"+H", 2, 0, 0, "+2"},
+ {"+H", -2, 0, 0, "-2"},
+ {"+H", 2, 30, 0, "+2"},
+ {"+H", 2, 0, 45, "+2"},
+ {"+H", 2, 30, 45, "+2"},
+ {"+H", 12, 0, 0, "+12"},
+ {"+H", -12, 0, 0, "-12"},
+ {"+H", 12, 30, 0, "+12"},
+ {"+H", 12, 0, 45, "+12"},
+ {"+H", 12, 30, 45, "+12"},
+
+ {"+Hmm", 2, 0, 0, "+2"},
+ {"+Hmm", -2, 0, 0, "-2"},
+ {"+Hmm", 2, 30, 0, "+230"},
+ {"+Hmm", 2, 0, 45, "+2"},
+ {"+Hmm", 2, 30, 45, "+230"},
+ {"+Hmm", 12, 0, 0, "+12"},
+ {"+Hmm", -12, 0, 0, "-12"},
+ {"+Hmm", 12, 30, 0, "+1230"},
+ {"+Hmm", 12, 0, 45, "+12"},
+ {"+Hmm", 12, 30, 45, "+1230"},
+
+ {"+H:mm", 2, 0, 0, "+2"},
+ {"+H:mm", -2, 0, 0, "-2"},
+ {"+H:mm", 2, 30, 0, "+2:30"},
+ {"+H:mm", 2, 0, 45, "+2"},
+ {"+H:mm", 2, 30, 45, "+2:30"},
+ {"+H:mm", 12, 0, 0, "+12"},
+ {"+H:mm", -12, 0, 0, "-12"},
+ {"+H:mm", 12, 30, 0, "+12:30"},
+ {"+H:mm", 12, 0, 45, "+12"},
+ {"+H:mm", 12, 30, 45, "+12:30"},
+
+ {"+HMM", 2, 0, 0, "+200"},
+ {"+HMM", -2, 0, 0, "-200"},
+ {"+HMM", 2, 30, 0, "+230"},
+ {"+HMM", 2, 0, 45, "+200"},
+ {"+HMM", 2, 30, 45, "+230"},
+ {"+HMM", 12, 0, 0, "+1200"},
+ {"+HMM", -12, 0, 0, "-1200"},
+ {"+HMM", 12, 30, 0, "+1230"},
+ {"+HMM", 12, 0, 45, "+1200"},
+ {"+HMM", 12, 30, 45, "+1230"},
+
+ {"+H:MM", 2, 0, 0, "+2:00"},
+ {"+H:MM", -2, 0, 0, "-2:00"},
+ {"+H:MM", 2, 30, 0, "+2:30"},
+ {"+H:MM", 2, 0, 45, "+2:00"},
+ {"+H:MM", 2, 30, 45, "+2:30"},
+ {"+H:MM", 12, 0, 0, "+12:00"},
+ {"+H:MM", -12, 0, 0, "-12:00"},
+ {"+H:MM", 12, 30, 0, "+12:30"},
+ {"+H:MM", 12, 0, 45, "+12:00"},
+ {"+H:MM", 12, 30, 45, "+12:30"},
+
+ {"+HMMss", 2, 0, 0, "+200"},
+ {"+HMMss", -2, 0, 0, "-200"},
+ {"+HMMss", 2, 30, 0, "+230"},
+ {"+HMMss", 2, 0, 45, "+20045"},
+ {"+HMMss", 2, 30, 45, "+23045"},
+ {"+HMMss", 12, 0, 0, "+1200"},
+ {"+HMMss", -12, 0, 0, "-1200"},
+ {"+HMMss", 12, 30, 0, "+1230"},
+ {"+HMMss", 12, 0, 45, "+120045"},
+ {"+HMMss", 12, 30, 45, "+123045"},
+
+ {"+H:MM:ss", 2, 0, 0, "+2:00"},
+ {"+H:MM:ss", -2, 0, 0, "-2:00"},
+ {"+H:MM:ss", 2, 30, 0, "+2:30"},
+ {"+H:MM:ss", 2, 0, 45, "+2:00:45"},
+ {"+H:MM:ss", 2, 30, 45, "+2:30:45"},
+ {"+H:MM:ss", 12, 0, 0, "+12:00"},
+ {"+H:MM:ss", -12, 0, 0, "-12:00"},
+ {"+H:MM:ss", 12, 30, 0, "+12:30"},
+ {"+H:MM:ss", 12, 0, 45, "+12:00:45"},
+ {"+H:MM:ss", 12, 30, 45, "+12:30:45"},
+
+ {"+HMMSS", 2, 0, 0, "+20000"},
+ {"+HMMSS", -2, 0, 0, "-20000"},
+ {"+HMMSS", 2, 30, 0, "+23000"},
+ {"+HMMSS", 2, 0, 45, "+20045"},
+ {"+HMMSS", 2, 30, 45, "+23045"},
+ {"+HMMSS", 12, 0, 0, "+120000"},
+ {"+HMMSS", -12, 0, 0, "-120000"},
+ {"+HMMSS", 12, 30, 0, "+123000"},
+ {"+HMMSS", 12, 0, 45, "+120045"},
+ {"+HMMSS", 12, 30, 45, "+123045"},
+
+ {"+H:MM:SS", 2, 0, 0, "+2:00:00"},
+ {"+H:MM:SS", -2, 0, 0, "-2:00:00"},
+ {"+H:MM:SS", 2, 30, 0, "+2:30:00"},
+ {"+H:MM:SS", 2, 0, 45, "+2:00:45"},
+ {"+H:MM:SS", 2, 30, 45, "+2:30:45"},
+ {"+H:MM:SS", 12, 0, 0, "+12:00:00"},
+ {"+H:MM:SS", -12, 0, 0, "-12:00:00"},
+ {"+H:MM:SS", 12, 30, 0, "+12:30:00"},
+ {"+H:MM:SS", 12, 0, 45, "+12:00:45"},
+ {"+H:MM:SS", 12, 30, 45, "+12:30:45"},
+
+ {"+Hmmss", 2, 0, 0, "+2"},
+ {"+Hmmss", -2, 0, 0, "-2"},
+ {"+Hmmss", 2, 30, 0, "+230"},
+ {"+Hmmss", 2, 0, 45, "+20045"},
+ {"+Hmmss", 2, 30, 45, "+23045"},
+ {"+Hmmss", 12, 0, 0, "+12"},
+ {"+Hmmss", -12, 0, 0, "-12"},
+ {"+Hmmss", 12, 30, 0, "+1230"},
+ {"+Hmmss", 12, 0, 45, "+120045"},
+ {"+Hmmss", 12, 30, 45, "+123045"},
+
+ {"+H:mm:ss", 2, 0, 0, "+2"},
+ {"+H:mm:ss", -2, 0, 0, "-2"},
+ {"+H:mm:ss", 2, 30, 0, "+2:30"},
+ {"+H:mm:ss", 2, 0, 45, "+2:00:45"},
+ {"+H:mm:ss", 2, 30, 45, "+2:30:45"},
+ {"+H:mm:ss", 12, 0, 0, "+12"},
+ {"+H:mm:ss", -12, 0, 0, "-12"},
+ {"+H:mm:ss", 12, 30, 0, "+12:30"},
+ {"+H:mm:ss", 12, 0, 45, "+12:00:45"},
+ {"+H:mm:ss", 12, 30, 45, "+12:30:45"},
+
+
};
}
@@ -403,8 +558,6 @@
{"HH:MM:ss"},
{"HHMMSS"},
{"HH:MM:SS"},
- {"+H"},
- {"+HMM"},
{"+HHM"},
{"+A"},
};
@@ -428,6 +581,98 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
+ @DataProvider(name = "formatGenericTimeZonePatterns")
+ Object[][] data_formatGenericNonLocationPatterns() {
+ return new Object[][] {
+ {"v", "America/Los_Angeles", "PT"},
+ {"vvvv", "America/Los_Angeles", "Pacific Time"},
+ {"v", "America/New_York", "ET"},
+ {"vvvv", "America/New_York", "Eastern Time"},
+ };
+ }
+
+ @Test(dataProvider = "formatGenericTimeZonePatterns")
+ public void test_appendZoneText_formatGenericTimeZonePatterns(String pattern, String input, String expected) {
+ ZonedDateTime zdt = ZonedDateTime.of(LocalDateTime.now(), ZoneId.of(input));
+ DateTimeFormatter df = DateTimeFormatter.ofPattern(pattern, Locale.US);
+ assertEquals(zdt.format(df), expected);
+ }
+
+ @DataProvider(name = "parseGenericTimeZonePatterns")
+ Object[][] data_parseGenericTimeZonePatterns() {
+ return new Object[][] {
+ {"yyyy DDD HH mm v", LocalDateTime.of(2015, Month.MARCH, 10, 12, 13), ZoneId.of("America/Los_Angeles"),
+ "2015 069 12 13 PT"},
+ {"yyyy DDD HH mm vvvv", LocalDateTime.of(2015, Month.MARCH, 10, 12, 13), ZoneId.of("America/Los_Angeles"),
+ "2015 069 12 13 Pacific Time"},
+ {"yyyy DDD HH mm v", LocalDateTime.of(2015, Month.NOVEMBER, 10, 12, 13), ZoneId.of("America/Los_Angeles"),
+ "2015 314 12 13 PT"},
+ {"yyyy DDD HH mm vvvv", LocalDateTime.of(2015, Month.NOVEMBER, 10, 12, 13), ZoneId.of("America/Los_Angeles"),
+ "2015 314 12 13 Pacific Time"},
+ };
+ }
+
+ @Test(dataProvider = "parseGenericTimeZonePatterns")
+ public void test_appendZoneText_parseGenericTimeZonePatterns(String pattern, LocalDateTime ldt, ZoneId zId, String input) {
+ DateTimeFormatter df = new DateTimeFormatterBuilder().appendPattern(pattern).toFormatter();
+ ZonedDateTime expected = ZonedDateTime.parse(input, df);
+ ZonedDateTime actual = ZonedDateTime.of(ldt, zId);
+ assertEquals(actual, expected);
+ }
+
+ @DataProvider(name = "formatNonGenericTimeZonePatterns_1")
+ Object[][] data_formatNonGenericTimeZonePatterns_1() {
+ return new Object[][] {
+ {"yyyy-MM-dd HH:mm:ss z", LocalDateTime.of(2015, Month.NOVEMBER, 1, 0, 30),
+ "2015-11-01 00:30:00 PDT"},
+ {"yyyy-MM-dd HH:mm:ss z", LocalDateTime.of(2015, Month.NOVEMBER, 1, 1, 30),
+ "2015-11-01 01:30:00 PDT"},
+ {"yyyy-MM-dd HH:mm:ss z", LocalDateTime.of(2015, Month.NOVEMBER, 1, 2, 30),
+ "2015-11-01 02:30:00 PST"},
+ {"yyyy-MM-dd HH:mm:ss zzzz", LocalDateTime.of(2015, Month.NOVEMBER, 1, 0, 30),
+ "2015-11-01 00:30:00 Pacific Daylight Time"},
+ {"yyyy-MM-dd HH:mm:ss zzzz", LocalDateTime.of(2015, Month.NOVEMBER, 1, 1, 30),
+ "2015-11-01 01:30:00 Pacific Daylight Time"},
+ {"yyyy-MM-dd HH:mm:ss zzzz", LocalDateTime.of(2015, Month.NOVEMBER, 1, 2, 30),
+ "2015-11-01 02:30:00 Pacific Standard Time"},
+ };
+ }
+
+ @Test(dataProvider = "formatNonGenericTimeZonePatterns_1")
+ public void test_appendZoneText_parseNonGenricTimeZonePatterns_1(String pattern, LocalDateTime ldt, String expected) {
+ ZoneId zId = ZoneId.of("America/Los_Angeles");
+ DateTimeFormatter df = new DateTimeFormatterBuilder().appendPattern(pattern).toFormatter(Locale.US);
+ ZonedDateTime zdt = ZonedDateTime.of(ldt, zId);
+ String actual = df.format(zdt);
+ assertEquals(actual, expected);
+ }
+
+ @DataProvider(name = "formatNonGenericTimeZonePatterns_2")
+ Object[][] data_formatNonGenericTimeZonePatterns_2() {
+ return new Object[][] {
+ {"yyyy-MM-dd HH:mm:ss z", LocalDateTime.of(2015, Month.NOVEMBER, 1, 0, 30),
+ "2015-11-01 00:30:00 PDT"},
+ {"yyyy-MM-dd HH:mm:ss z", LocalDateTime.of(2015, Month.NOVEMBER, 1, 1, 30),
+ "2015-11-01 01:30:00 PT"},
+ {"yyyy-MM-dd HH:mm:ss z", LocalDateTime.of(2015, Month.NOVEMBER, 1, 2, 30),
+ "2015-11-01 02:30:00 PST"},
+ {"yyyy-MM-dd HH:mm:ss zzzz", LocalDateTime.of(2015, Month.NOVEMBER, 1, 0, 30),
+ "2015-11-01 00:30:00 Pacific Daylight Time"},
+ {"yyyy-MM-dd HH:mm:ss zzzz", LocalDateTime.of(2015, Month.NOVEMBER, 1, 1, 30),
+ "2015-11-01 01:30:00 Pacific Time"},
+ {"yyyy-MM-dd HH:mm:ss zzzz", LocalDateTime.of(2015, Month.NOVEMBER, 1, 2, 30),
+ "2015-11-01 02:30:00 Pacific Standard Time"},
+ };
+ }
+
+ @Test(dataProvider = "formatNonGenericTimeZonePatterns_2")
+ public void test_appendZoneText_parseNonGenricTimeZonePatterns_2(String pattern, LocalDateTime ldt, String expected) {
+ ZoneId zId = ZoneId.of("America/Los_Angeles");
+ DateTimeFormatter df = DateTimeFormatter.ofPattern(pattern, Locale.US).withZone(zId);
+ String actual = df.format(ldt);
+ assertEquals(actual, expected);
+ }
+
@Test(expectedExceptions=NullPointerException.class)
public void test_appendZoneText_1arg_nullText() throws Exception {
builder.appendZoneText(null);
@@ -632,6 +877,8 @@
{"W"},
{"W"},
+ {"g"},
+ {"ggggg"},
};
}
@@ -701,6 +948,9 @@
{"www"},
{"WW"},
+
+ {"vv"},
+ {"vvv"},
};
}
@@ -733,6 +983,131 @@
}
//-----------------------------------------------------------------------
+ @DataProvider(name="modJulianFieldPattern")
+ Object[][] data_modJuilanFieldPattern() {
+ return new Object[][] {
+ {"g", "1"},
+ {"g", "123456"},
+ {"gggggg", "123456"},
+ };
+ }
+
+ @Test(dataProvider="modJulianFieldPattern")
+ public void test_modJulianFieldPattern(String pattern, String input) throws Exception {
+ DateTimeFormatter.ofPattern(pattern).parse(input);
+ }
+
+ @DataProvider(name="modJulianFieldValues")
+ Object[][] data_modJuilanFieldValues() {
+ return new Object[][] {
+ {1970, 1, 1, "40587"},
+ {1858, 11, 17, "0"},
+ {1858, 11, 16, "-1"},
+ };
+ }
+
+ @Test(dataProvider="modJulianFieldValues")
+ public void test_modJulianFieldValues(int y, int m, int d, String expected) throws Exception {
+ DateTimeFormatter df = new DateTimeFormatterBuilder().appendPattern("g").toFormatter();
+ assertEquals(LocalDate.of(y, m, d).format(df), expected);
+ }
+ //----------------------------------------------------------------------
+ @DataProvider(name="dayOfYearFieldValues")
+ Object[][] data_dayOfYearFieldValues() {
+ return new Object[][] {
+ {2016, 1, 1, "D", "1"},
+ {2016, 1, 31, "D", "31"},
+ {2016, 1, 1, "DD", "01"},
+ {2016, 1, 31, "DD", "31"},
+ {2016, 4, 9, "DD", "100"},
+ {2016, 1, 1, "DDD", "001"},
+ {2016, 1, 31, "DDD", "031"},
+ {2016, 4, 9, "DDD", "100"},
+ };
+ }
+
+ @Test(dataProvider="dayOfYearFieldValues")
+ public void test_dayOfYearFieldValues(int y, int m, int d, String pattern, String expected) throws Exception {
+ DateTimeFormatter df = new DateTimeFormatterBuilder().appendPattern(pattern).toFormatter();
+ assertEquals(LocalDate.of(y, m, d).format(df), expected);
+ }
+
+ @DataProvider(name="dayOfYearFieldAdjacentParsingValues")
+ Object[][] data_dayOfYearFieldAdjacentParsingValues() {
+ return new Object[][] {
+ {"20160281015", LocalDateTime.of(2016, 1, 28, 10, 15)},
+ {"20161001015", LocalDateTime.of(2016, 4, 9, 10, 15)},
+ };
+ }
+
+ @Test(dataProvider="dayOfYearFieldAdjacentParsingValues")
+ public void test_dayOfYearFieldAdjacentValueParsing(String input, LocalDateTime expected) {
+ DateTimeFormatter df = new DateTimeFormatterBuilder().appendPattern("yyyyDDDHHmm").toFormatter();
+ LocalDateTime actual = LocalDateTime.parse(input, df);
+ assertEquals(actual, expected);
+ }
+
+ @Test(expectedExceptions = DateTimeParseException.class)
+ public void test_dayOfYearFieldInvalidValue() {
+ DateTimeFormatter.ofPattern("DDD").parse("1234");
+ }
+
+ @Test(expectedExceptions = DateTimeParseException.class)
+ public void test_dayOfYearFieldInvalidAdacentValueParsingPattern() {
+ // patterns D and DD will not take part in adjacent value parsing
+ DateTimeFormatter.ofPattern("yyyyDDHHmmss").parse("201610123456");
+ }
+
+ //-----------------------------------------------------------------------
+ @DataProvider(name="secondsPattern")
+ Object[][] data_secondsPattern() {
+ return new Object[][] {
+ {"A", "1", LocalTime.ofNanoOfDay(1_000_000)},
+ {"A", "100000", LocalTime.ofSecondOfDay(100)},
+ {"AA", "01", LocalTime.ofNanoOfDay(1_000_000)},
+ {"AA", "100000", LocalTime.ofSecondOfDay(100)},
+ {"AAAAAA", "100000", LocalTime.ofSecondOfDay(100)},
+ {"HHmmssn", "0000001", LocalTime.ofNanoOfDay(1)},
+ {"HHmmssn", "000000111", LocalTime.ofNanoOfDay(111)},
+ {"HHmmssnn", "00000001", LocalTime.ofNanoOfDay(1)},
+ {"HHmmssnn", "0000001111", LocalTime.ofNanoOfDay(1111)},
+ {"HHmmssnnnnnn", "000000111111", LocalTime.ofNanoOfDay(111_111)},
+ {"N", "1", LocalTime.ofNanoOfDay(1)},
+ {"N", "100000", LocalTime.ofNanoOfDay(100_000)},
+ {"NN", "01", LocalTime.ofNanoOfDay(1)},
+ {"NN", "100000", LocalTime.ofNanoOfDay(100_000)},
+ {"NNNNNN", "100000", LocalTime.ofNanoOfDay(100_000)},
+ };
+ }
+
+ @Test(dataProvider="secondsPattern")
+ public void test_secondsPattern(String pattern, String input, LocalTime expected) throws Exception {
+ DateTimeFormatter df = new DateTimeFormatterBuilder().appendPattern(pattern).toFormatter();
+ assertEquals(LocalTime.parse(input, df), expected);
+ }
+
+ @DataProvider(name="secondsValues")
+ Object[][] data_secondsValues() {
+ return new Object[][] {
+ {"A", 1, "1000"},
+ {"n", 1, "0"},
+ {"N", 1, "1000000000"},
+ };
+ }
+
+ @Test(dataProvider="secondsValues")
+ public void test_secondsValues(String pattern, int seconds , String expected) throws Exception {
+ DateTimeFormatter df = new DateTimeFormatterBuilder().appendPattern(pattern).toFormatter();
+ assertEquals(LocalTime.ofSecondOfDay(seconds).format(df), expected);
+ }
+
+ @Test(expectedExceptions = DateTimeParseException.class)
+ public void test_secondsPatternInvalidAdacentValueParsingPattern() {
+ // patterns A*, N*, n* will not take part in adjacent value parsing
+ DateTimeFormatter.ofPattern("yyyyAA").parse("201610");
+ }
+
+ //-----------------------------------------------------------------------
@Test
public void test_adjacent_strict_firstFixedWidth() throws Exception {
// succeeds because both number elements are fixed width
@@ -868,7 +1243,7 @@
@Test
public void test_adjacent_lenient_fractionFollows_0digit() throws Exception {
- // succeeds because hour/min are fixed width
+ // succeeds because hour, min and fraction of seconds are fixed width
DateTimeFormatter f = builder.parseLenient().appendValue(HOUR_OF_DAY, 2).appendValue(MINUTE_OF_HOUR, 2).appendFraction(NANO_OF_SECOND, 3, 3, false).toFormatter(Locale.UK);
ParsePosition pp = new ParsePosition(0);
TemporalAccessor parsed = f.parseUnresolved("1230", pp);
@@ -878,4 +1253,441 @@
assertEquals(parsed.getLong(MINUTE_OF_HOUR), 30L);
}
+ @DataProvider(name="adjacentFractionParseData")
+ Object[][] data_adjacent_fraction_parse() {
+ return new Object[][] {
+ {"20130812214600025", "yyyyMMddHHmmssSSS", LocalDateTime.of(2013, 8, 12, 21, 46, 00, 25000000)},
+ {"201308122146000256", "yyyyMMddHHmmssSSSS", LocalDateTime.of(2013, 8, 12, 21, 46, 00, 25600000)},
+ };
+ }
+
+ @Test(dataProvider = "adjacentFractionParseData")
+ public void test_adjacent_fraction(String input, String pattern, LocalDateTime expected) {
+ DateTimeFormatter dtf = DateTimeFormatter.ofPattern(pattern);
+ LocalDateTime actual = LocalDateTime.parse(input, dtf);
+ assertEquals(actual, expected);
+ }
+
+ @DataProvider(name="lenientOffsetParseData")
+ Object[][] data_lenient_offset_parse() {
+ return new Object[][] {
+ {"+HH", "+01", 3600},
+ {"+HH", "+0101", 3660},
+ {"+HH", "+010101", 3661},
+ {"+HH", "+01", 3600},
+ {"+HH", "+01:01", 3660},
+ {"+HH", "+01:01:01", 3661},
+ {"+HHmm", "+01", 3600},
+ {"+HHmm", "+0101", 3660},
+ {"+HHmm", "+010101", 3661},
+ {"+HH:mm", "+01", 3600},
+ {"+HH:mm", "+01:01", 3660},
+ {"+HH:mm", "+01:01:01", 3661},
+ {"+HHMM", "+01", 3600},
+ {"+HHMM", "+0101", 3660},
+ {"+HHMM", "+010101", 3661},
+ {"+HH:MM", "+01", 3600},
+ {"+HH:MM", "+01:01", 3660},
+ {"+HH:MM", "+01:01:01", 3661},
+ {"+HHMMss", "+01", 3600},
+ {"+HHMMss", "+0101", 3660},
+ {"+HHMMss", "+010101", 3661},
+ {"+HH:MM:ss", "+01", 3600},
+ {"+HH:MM:ss", "+01:01", 3660},
+ {"+HH:MM:ss", "+01:01:01", 3661},
+ {"+HHMMSS", "+01", 3600},
+ {"+HHMMSS", "+0101", 3660},
+ {"+HHMMSS", "+010101", 3661},
+ {"+HH:MM:SS", "+01", 3600},
+ {"+HH:MM:SS", "+01:01", 3660},
+ {"+HH:MM:SS", "+01:01:01", 3661},
+ {"+HHmmss", "+01", 3600},
+ {"+HHmmss", "+0101", 3660},
+ {"+HHmmss", "+010101", 3661},
+ {"+HH:mm:ss", "+01", 3600},
+ {"+HH:mm:ss", "+01:01", 3660},
+ {"+HH:mm:ss", "+01:01:01", 3661},
+
+ {"+H", "+1", 3600},
+ {"+H", "+101", 3660},
+ {"+H", "+10101", 3661},
+ {"+H", "+1:01", 3660},
+ {"+H", "+1:01:01", 3661},
+ {"+H", "+01", 3600},
+ {"+H", "+0101", 3660},
+ {"+H", "+010101", 3661},
+ {"+H", "+01:01", 3660},
+ {"+H", "+01:01:01", 3661},
+ {"+Hmm", "+1", 3600},
+ {"+Hmm", "+101", 3660},
+ {"+Hmm", "+10101", 3661},
+ {"+Hmm", "+01", 3600},
+ {"+Hmm", "+0101", 3660},
+ {"+Hmm", "+010101", 3661},
+ {"+H:mm", "+1", 3600},
+ {"+H:mm", "+1:01", 3660},
+ {"+H:mm", "+1:01:01", 3661},
+ {"+H:mm", "+01", 3600},
+ {"+H:mm", "+01:01", 3660},
+ {"+H:mm", "+01:01:01", 3661},
+ {"+HMM", "+1", 3600},
+ {"+HMM", "+101", 3660},
+ {"+HMM", "+10101", 3661},
+ {"+HMM", "+01", 3600},
+ {"+HMM", "+0101", 3660},
+ {"+HMM", "+010101", 3661},
+ {"+H:MM", "+1", 3600},
+ {"+H:MM", "+1:01", 3660},
+ {"+H:MM", "+1:01:01", 3661},
+ {"+H:MM", "+01", 3600},
+ {"+H:MM", "+01:01", 3660},
+ {"+H:MM", "+01:01:01", 3661},
+ {"+HMMss", "+1", 3600},
+ {"+HMMss", "+101", 3660},
+ {"+HMMss", "+10101", 3661},
+ {"+HMMss", "+01", 3600},
+ {"+HMMss", "+0101", 3660},
+ {"+HMMss", "+010101", 3661},
+ {"+H:MM:ss", "+1", 3600},
+ {"+H:MM:ss", "+1:01", 3660},
+ {"+H:MM:ss", "+1:01:01", 3661},
+ {"+H:MM:ss", "+01", 3600},
+ {"+H:MM:ss", "+01:01", 3660},
+ {"+H:MM:ss", "+01:01:01", 3661},
+ {"+HMMSS", "+1", 3600},
+ {"+HMMSS", "+101", 3660},
+ {"+HMMSS", "+10101", 3661},
+ {"+HMMSS", "+01", 3600},
+ {"+HMMSS", "+0101", 3660},
+ {"+HMMSS", "+010101", 3661},
+ {"+H:MM:SS", "+1", 3600},
+ {"+H:MM:SS", "+1:01", 3660},
+ {"+H:MM:SS", "+1:01:01", 3661},
+ {"+H:MM:SS", "+01", 3600},
+ {"+H:MM:SS", "+01:01", 3660},
+ {"+H:MM:SS", "+01:01:01", 3661},
+ {"+Hmmss", "+1", 3600},
+ {"+Hmmss", "+101", 3660},
+ {"+Hmmss", "+10101", 3661},
+ {"+Hmmss", "+01", 3600},
+ {"+Hmmss", "+0101", 3660},
+ {"+Hmmss", "+010101", 3661},
+ {"+H:mm:ss", "+1", 3600},
+ {"+H:mm:ss", "+1:01", 3660},
+ {"+H:mm:ss", "+1:01:01", 3661},
+ {"+H:mm:ss", "+01", 3600},
+ {"+H:mm:ss", "+01:01", 3660},
+ {"+H:mm:ss", "+01:01:01", 3661},
+ };
+ }
+
+ @DataProvider(name="strictDoubleDigitHourOffsetParseData")
+ Object[][] data_strictDoubleDigitHour_offset_parse() {
+ return new Object[][] {
+ {"+HH", "+01", 3600},
+ {"+HHmm", "+01", 3600},
+ {"+HHmm", "+0101", 3660},
+ {"+HH:mm", "+01", 3600},
+ {"+HH:mm", "+01:01", 3660},
+ {"+HHMM", "+0101", 3660},
+ {"+HH:MM", "+01:01", 3660},
+ {"+HHMMss", "+0101", 3660},
+ {"+HHMMss", "+010101", 3661},
+ {"+HH:MM:ss", "+01:01", 3660},
+ {"+HH:MM:ss", "+01:01:01", 3661},
+ {"+HHMMSS", "+010101", 3661},
+ {"+HH:MM:SS", "+01:01:01", 3661},
+ {"+HHmmss", "+01", 3600},
+ {"+HHmmss", "+0101", 3660},
+ {"+HHmmss", "+010101", 3661},
+ {"+HH:mm:ss", "+01", 3600},
+ {"+HH:mm:ss", "+01:01", 3660},
+ {"+HH:mm:ss", "+01:01:01", 3661},
+ };
+ }
+
+ @DataProvider(name="strictSingleDigitHourOffsetParseData")
+ Object[][] data_strictSingleDigitHour_offset_parse() {
+ return new Object[][] {
+ {"+H", "+01", 3600},
+ {"+H", "+1", 3600},
+ {"+Hmm", "+01", 3600},
+ {"+Hmm", "+0101", 3660},
+ {"+Hmm", "+1", 3600},
+ {"+Hmm", "+101", 3660},
+ {"+H:mm", "+01", 3600},
+ {"+H:mm", "+01:01", 3660},
+ {"+H:mm", "+1", 3600},
+ {"+H:mm", "+1:01", 3660},
+ {"+HMM", "+0101", 3660},
+ {"+HMM", "+101", 3660},
+ {"+H:MM", "+01:01", 3660},
+ {"+H:MM", "+1:01", 3660},
+ {"+HMMss", "+0101", 3660},
+ {"+HMMss", "+010101", 3661},
+ {"+HMMss", "+101", 3660},
+ {"+HMMss", "+10101", 3661},
+ {"+H:MM:ss", "+01:01", 3660},
+ {"+H:MM:ss", "+01:01:01", 3661},
+ {"+H:MM:ss", "+1:01", 3660},
+ {"+H:MM:ss", "+1:01:01", 3661},
+ {"+HMMSS", "+010101", 3661},
+ {"+HMMSS", "+10101", 3661},
+ {"+H:MM:SS", "+01:01:01", 3661},
+ {"+H:MM:SS", "+1:01:01", 3661},
+ {"+Hmmss", "+01", 3600},
+ {"+Hmmss", "+0101", 3660},
+ {"+Hmmss", "+010101", 3661},
+ {"+Hmmss", "+1", 3600},
+ {"+Hmmss", "+101", 3660},
+ {"+Hmmss", "+10101", 3661},
+ {"+H:mm:ss", "+01", 3600},
+ {"+H:mm:ss", "+01:01", 3660},
+ {"+H:mm:ss", "+01:01:01", 3661},
+ {"+H:mm:ss", "+1", 3600},
+ {"+H:mm:ss", "+1:01", 3660},
+ {"+H:mm:ss", "+1:01:01", 3661},
+ };
+ }
+
+ @Test(dataProvider="lenientOffsetParseData")
+ public void test_lenient_offset_parse_1(String pattern, String offset, int offsetSeconds) {
+ assertEquals(new DateTimeFormatterBuilder().parseLenient().appendOffset(pattern, "Z").toFormatter().parse(offset).get(OFFSET_SECONDS),
+ offsetSeconds);
+ }
+
+ @Test
+ public void test_lenient_offset_parse_2() {
+ assertEquals(new DateTimeFormatterBuilder().parseLenient().appendOffsetId().toFormatter().parse("+01").get(OFFSET_SECONDS),
+ 3600);
+ }
+
+ @Test(dataProvider="strictDoubleDigitHourOffsetParseData")
+ public void test_strictDoubleDigitHour_offset_parse_1(String pattern, String offset, int offsetSeconds) {
+ assertEquals(new DateTimeFormatterBuilder().appendOffset(pattern, "Z").toFormatter()
+ .parse(offset).get(OFFSET_SECONDS), offsetSeconds);
+ }
+
+ @Test(dataProvider="strictDoubleDigitHourOffsetParseData")
+ public void test_strictDoubleDigitHour_offset_parse_2(String pattern, String offset, int offsetSeconds) {
+ assertEquals(new DateTimeFormatterBuilder().appendOffset(pattern, "Z")
+ .appendLiteral("text").toFormatter().parse(offset + "text").get(OFFSET_SECONDS), offsetSeconds);
+ }
+
+ @Test(dataProvider="strictSingleDigitHourOffsetParseData")
+ public void test_strictSingleDigitHour_offset_parse_1(String pattern, String offset, int offsetSeconds) {
+ assertEquals(new DateTimeFormatterBuilder().appendOffset(pattern, "Z").toFormatter()
+ .parse(offset).get(OFFSET_SECONDS), offsetSeconds);
+ }
+
+ @Test(dataProvider="strictSingleDigitHourOffsetParseData")
+ public void test_strictSingleDigitHour_offset_parse_2(String pattern, String offset, int offsetSeconds) {
+ assertEquals(new DateTimeFormatterBuilder().appendOffset(pattern, "Z")
+ .appendLiteral("text").toFormatter().parse(offset + "text").get(OFFSET_SECONDS), offsetSeconds);
+ }
+
+ @DataProvider(name="strictOffsetAdjacentParseValidPatternData")
+ Object[][] data_strict_offset_adjacentParse_validPattern() {
+ return new Object[][] {
+ {"+HH", "+01", 3600},
+ {"+HHmm", "+0101", 3660},
+ {"+HH:mm", "+01", 3600},
+ {"+HH:mm", "+01:01", 3660},
+ {"+HHMM", "+0101", 3660},
+ {"+HH:MM", "+01:01", 3660},
+ {"+HHMMss", "+010101", 3661},
+ {"+HH:MM:ss", "+01:01", 3660},
+ {"+HH:MM:ss", "+01:01:01", 3661},
+ {"+HHMMSS", "+010101", 3661},
+ {"+HH:MM:SS", "+01:01:01", 3661},
+ {"+HHmmss", "+010101", 3661},
+ {"+HH:mm:ss", "+01", 3600},
+ {"+HH:mm:ss", "+01:01", 3660},
+ {"+HH:mm:ss", "+01:01:01", 3661},
+
+ {"+H", "+01", 3600},
+ {"+Hmm", "+0101", 3660},
+ {"+H:mm", "+01", 3600},
+ {"+H:mm", "+01:01", 3660},
+ {"+H:mm", "+1:01", 3660},
+ {"+HMM", "+0101", 3660},
+ {"+H:MM", "+01:01", 3660},
+ {"+H:MM", "+1:01", 3660},
+ {"+HMMss", "+010101", 3661},
+ {"+H:MM:ss", "+01:01", 3660},
+ {"+H:MM:ss", "+01:01:01", 3661},
+ {"+H:MM:ss", "+1:01", 3660},
+ {"+H:MM:ss", "+1:01:01", 3661},
+ {"+HMMSS", "+010101", 3661},
+ {"+H:MM:SS", "+01:01:01", 3661},
+ {"+H:MM:SS", "+1:01:01", 3661},
+ {"+Hmmss", "+010101", 3661},
+ {"+H:mm:ss", "+01", 3600},
+ {"+H:mm:ss", "+01:01", 3660},
+ {"+H:mm:ss", "+01:01:01", 3661},
+ {"+H:mm:ss", "+1:01", 3660},
+ {"+H:mm:ss", "+1:01:01", 3661},
+ };
+ }
+
+ @Test(dataProvider="strictOffsetAdjacentParseValidPatternData")
+ public void test_strict_offset_adjacentValidPattern_parse(String pattern, String offset, int offsetSeconds) {
+ TemporalAccessor tmp = new DateTimeFormatterBuilder().appendOffset(pattern, "Z")
+ .appendValue(HOUR_OF_DAY, 2).toFormatter().parse(offset + "12");
+ assertEquals(tmp.get(OFFSET_SECONDS), offsetSeconds);
+ assertEquals(tmp.get(HOUR_OF_DAY), 12);
+ }
+
+ @DataProvider(name="strictOffsetAdjacentParseInvalidPatternData")
+ Object[][] data_strict_offset_adjacentParse_invalidPattern() {
+ return new Object[][] {
+ {"+HHmm", "+01", 3600},
+ {"+HHMMss", "+0101", 3660},
+ {"+HHmmss", "+01", 3600},
+ {"+HHmmss", "+0101", 3660},
+ {"+H", "+1", 3600},
+ {"+Hmm", "+01", 3600},
+ {"+H:mm", "+1", 3600},
+ {"+Hmm", "+1", 3600},
+ {"+Hmm", "+101", 3660},
+ {"+HMM", "+101", 3660},
+ {"+HMMss", "+0101", 3660},
+ {"+HMMss", "+101", 3660},
+ {"+HMMss", "+10101", 3661},
+ {"+HMMSS", "+10101", 3661},
+ {"+Hmmss", "+01", 3600},
+ {"+Hmmss", "+0101", 3660},
+ {"+Hmmss", "+1", 3600},
+ {"+Hmmss", "+101", 3660},
+ {"+Hmmss", "+10101", 3661},
+ {"+H:mm:ss", "+1", 3600},
+ };
+ }
+
+ @Test(dataProvider="strictOffsetAdjacentParseInvalidPatternData", expectedExceptions=DateTimeParseException.class)
+ public void test_strict_offset_adjacentInvalidPattern_parse(String pattern, String offset, int offsetSeconds) {
+ new DateTimeFormatterBuilder().appendOffset(pattern, "Z").appendValue(HOUR_OF_DAY, 2)
+ .toFormatter().parse(offset + "12");
+ }
+
+ @DataProvider(name="lenientOffsetAdjacentParseValidPatternData")
+ Object[][] data_lenient_offset_adjacentParse_validPattern() {
+ return new Object[][] {
+ {"+HH:mm", "+01", 3600},
+ {"+HH:mm", "+01:01", 3660},
+ {"+HH:MM", "+01:01", 3660},
+ {"+HH:MM:ss", "+01:01", 3660},
+ {"+HH:MM:ss", "+01:01:01", 3661},
+ {"+HHMMSS", "+010101", 3661},
+ {"+HH:MM:SS", "+01:01:01", 3661},
+ {"+HHmmss", "+010101", 3661},
+ {"+HH:mm:ss", "+01", 3600},
+ {"+HH:mm:ss", "+01:01", 3660},
+ {"+HH:mm:ss", "+01:01:01", 3661},
+ {"+H:mm", "+01", 3600},
+ {"+H:mm", "+01:01", 3660},
+ {"+H:mm", "+1:01", 3660},
+ {"+H:MM", "+01:01", 3660},
+ {"+H:MM", "+1:01", 3660},
+ {"+HMMss", "+010101", 3661},
+ {"+H:MM:ss", "+01:01", 3660},
+ {"+H:MM:ss", "+01:01:01", 3661},
+ {"+H:MM:ss", "+1:01", 3660},
+ {"+H:MM:ss", "+1:01:01", 3661},
+ {"+HMMSS", "+010101", 3661},
+ {"+H:MM:SS", "+01:01:01", 3661},
+ {"+H:MM:SS", "+1:01:01", 3661},
+ {"+Hmmss", "+010101", 3661},
+ {"+H:mm:ss", "+01", 3600},
+ {"+H:mm:ss", "+01:01", 3660},
+ {"+H:mm:ss", "+01:01:01", 3661},
+ {"+H:mm:ss", "+1:01", 3660},
+ {"+H:mm:ss", "+1:01:01", 3661},
+ };
+ }
+
+ @Test(dataProvider="lenientOffsetAdjacentParseValidPatternData")
+ public void test_lenient_offset_adjacentValidPattern_parse(String pattern, String offset, int offsetSeconds) {
+ TemporalAccessor tmp = new DateTimeFormatterBuilder().parseLenient()
+ .appendOffset(pattern, "Z").appendValue(HOUR_OF_DAY, 2).toFormatter().parse(offset + "12");
+ assertEquals(tmp.get(OFFSET_SECONDS), offsetSeconds);
+ assertEquals(tmp.get(HOUR_OF_DAY), 12);
+ }
+
+ @Test
+ public void test_lenient_offset_adjacentValidPattern_parse1() {
+ TemporalAccessor tmp = new DateTimeFormatterBuilder().parseLenient()
+ .appendOffset("+HMMSS", "Z").appendValue(HOUR_OF_DAY, 2).toFormatter().parse("+10101" + "12");
+ //Equivalent to +101011. In lenient mode, offset will parse upto 6 digit if possible.
+ //It will take 1 digit from HOUR_OF_DAY.
+ assertEquals(tmp.get(OFFSET_SECONDS), 36611);
+ assertEquals(tmp.get(HOUR_OF_DAY), 2);
+ }
+
+ @DataProvider(name="lenientOffsetAdjacentParseInvalidPatternData")
+ Object[][] data_lenient_offset_adjacentParse_invalidPattern() {
+ return new Object[][] {
+ {"+HH", "+01", 3600},
+ {"+HHmm", "+0101", 3660},
+ {"+HHMM", "+0101", 3660},
+ {"+H", "+01", 3600},
+ {"+Hmm", "+0101", 3660},
+ {"+HMM", "+0101", 3660},
+ };
+ }
+
+ @Test(dataProvider="lenientOffsetAdjacentParseInvalidPatternData", expectedExceptions=DateTimeParseException.class)
+ public void test_lenient_offset_adjacentInvalidPattern_parse(String pattern, String offset, int offsetSeconds) {
+ new DateTimeFormatterBuilder().parseLenient().appendOffset(pattern, "Z")
+ .appendValue(HOUR_OF_DAY, 2).toFormatter().parse(offset + "12");
+ }
+
+ @DataProvider(name="badValues")
+ Object[][] data_badOffsetValues() {
+ return new Object[][] {
+ {"+HH", "+24"},
+ {"+HHMM", "-1361"},
+ {"+HH:MM:ss", "+13:12:66"},
+ {"+HH:MM:SS", "+24:60:60"},
+ {"+HHMMSS", "369999"},
+ {"+H:MM", "+28:12"},
+ };
+ }
+
+ @Test(dataProvider="badValues", expectedExceptions=DateTimeParseException.class)
+ public void test_badOffset_parse(String pattern, String offset) {
+ new DateTimeFormatterBuilder().appendOffset(pattern, "Z").toFormatter().parse(offset);
+ }
+
+ @Test(expectedExceptions=DateTimeParseException.class)
+ public void test_strict_appendOffsetId() {
+ new DateTimeFormatterBuilder().appendOffsetId().toFormatter().parse("+01");
+ }
+
+ @Test(expectedExceptions=DateTimeParseException.class)
+ public void test_strict_appendOffset_1() {
+ new DateTimeFormatterBuilder().appendOffset("+HH:MM:ss", "Z").toFormatter().parse("+01");
+ }
+
+ @Test(expectedExceptions=DateTimeParseException.class)
+ public void test_strict_appendOffset_2() {
+ new DateTimeFormatterBuilder().appendOffset("+HHMMss", "Z").toFormatter().parse("+01");
+ }
+
+ @Test(expectedExceptions=DateTimeParseException.class)
+ public void test_strict_appendOffset_3() {
+ new DateTimeFormatterBuilder().appendOffset("+H:MM:ss", "Z").toFormatter().parse("+1");
+ }
+
+ @Test(expectedExceptions=DateTimeParseException.class)
+ public void test_strict_appendOffset_4() {
+ new DateTimeFormatterBuilder().appendOffset("+HMMss", "Z").toFormatter().parse("+1");
+ }
+
+ @Test
+ public void test_basic_iso_date() {
+ assertEquals(BASIC_ISO_DATE.parse("20021231+01").get(OFFSET_SECONDS), 3600);
+ assertEquals(BASIC_ISO_DATE.parse("20021231+0101").get(OFFSET_SECONDS), 3660);
+ }
+
}
diff --git a/ojluni/src/test/java/time/tck/java/time/format/TCKLocalizedFieldParser.java b/ojluni/src/test/java/time/tck/java/time/format/TCKLocalizedFieldParser.java
index eef99fc..6286a1d 100644
--- a/ojluni/src/test/java/time/tck/java/time/format/TCKLocalizedFieldParser.java
+++ b/ojluni/src/test/java/time/tck/java/time/format/TCKLocalizedFieldParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -66,9 +66,11 @@
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.DateTimeParseException;
import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalField;
import java.time.temporal.WeekFields;
+import java.util.Locale;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -79,12 +81,17 @@
*/
@Test
public class TCKLocalizedFieldParser extends AbstractTestPrinterParser {
-
+ public static final WeekFields WEEKDEF = WeekFields.of(Locale.US);
+ public static final TemporalField WEEK_BASED_YEAR = WEEKDEF.weekBasedYear();
+ public static final TemporalField WEEK_OF_WEEK_BASED_YEAR = WEEKDEF.weekOfWeekBasedYear();
+ public static final TemporalField DAY_OF_WEEK = WEEKDEF.dayOfWeek();
//-----------------------------------------------------------------------
@DataProvider(name="FieldPatterns")
Object[][] provider_fieldPatterns() {
return new Object[][] {
- {"e", "6", 0, 1, 6},
+ {"e", "6", 0, 1, 6},
+ {"ee", "06", 0, 2, 6},
+ {"c", "6", 0, 1 , 6},
{"W", "3", 0, 1, 3},
{"w", "29", 0, 2, 29},
{"ww", "29", 0, 2, 29},
@@ -99,6 +106,7 @@
WeekFields weekDef = WeekFields.of(locale);
TemporalField field = null;
switch(pattern.charAt(0)) {
+ case 'c' :
case 'e' :
field = weekDef.dayOfWeek();
break;
@@ -176,9 +184,9 @@
{"Y-w-e", "2008-01-1", 0, 9, LocalDate.of(2007, 12, 30)},
{"Y-w-e", "2008-52-1", 0, 9, LocalDate.of(2008, 12, 21)},
{"Y-w-e", "2008-52-7", 0, 9, LocalDate.of(2008, 12, 27)},
- {"Y-w-e", "2009-01-01", 0, 10, LocalDate.of(2008, 12, 28)},
- {"Y-w-e", "2009-01-04", 0, 10, LocalDate.of(2008, 12, 31)},
- {"Y-w-e", "2009-01-05", 0, 10, LocalDate.of(2009, 1, 1)},
+ {"Y-w-e", "2009-01-1", 0, 9, LocalDate.of(2008, 12, 28)},
+ {"Y-w-e", "2009-01-4", 0, 9, LocalDate.of(2008, 12, 31)},
+ {"Y-w-e", "2009-01-5", 0, 9, LocalDate.of(2009, 1, 1)},
};
}
@@ -202,4 +210,77 @@
}
}
+ //-----------------------------------------------------------------------
+ @DataProvider(name = "adjacentValuePatterns1")
+ Object[][] provider_adjacentValuePatterns1() {
+ return new Object[][] {
+ {"YYww", WEEK_BASED_YEAR, WEEK_OF_WEEK_BASED_YEAR, "1612", 2016, 12},
+ {"YYYYww", WEEK_BASED_YEAR, WEEK_OF_WEEK_BASED_YEAR, "201612", 2016, 12},
+ };
+ }
+
+ @Test(dataProvider = "adjacentValuePatterns1")
+ public void test_adjacentValuePatterns1(String pattern, TemporalField field1, TemporalField field2,
+ String text, int expected1, int expected2) {
+ DateTimeFormatter df = new DateTimeFormatterBuilder()
+ .appendPattern(pattern).toFormatter(Locale.US);
+ ParsePosition ppos = new ParsePosition(0);
+ TemporalAccessor parsed = df.parseUnresolved(text, ppos);
+ assertEquals(parsed.get(field1), expected1);
+ assertEquals(parsed.get(field2), expected2);
+ }
+
+ @DataProvider(name = "adjacentValuePatterns2")
+ Object[][] provider_adjacentValuePatterns2() {
+ return new Object[][] {
+ {"YYYYwwc", WEEK_BASED_YEAR, WEEK_OF_WEEK_BASED_YEAR, DAY_OF_WEEK,
+ "2016121", 2016, 12, 1},
+ {"YYYYwwee", WEEK_BASED_YEAR, WEEK_OF_WEEK_BASED_YEAR, DAY_OF_WEEK,
+ "20161201", 2016, 12, 1},
+ {"YYYYwwe", WEEK_BASED_YEAR, WEEK_OF_WEEK_BASED_YEAR, DAY_OF_WEEK,
+ "2016121", 2016, 12, 1},
+ };
+ }
+
+ @Test(dataProvider = "adjacentValuePatterns2")
+ public void test_adjacentValuePatterns2(String pattern, TemporalField field1, TemporalField field2,
+ TemporalField field3, String text, int expected1, int expected2, int expected3) {
+ DateTimeFormatter df = new DateTimeFormatterBuilder()
+ .appendPattern(pattern).toFormatter(Locale.US);
+ ParsePosition ppos = new ParsePosition(0);
+ TemporalAccessor parsed = df.parseUnresolved(text, ppos);
+ assertEquals(parsed.get(field1), expected1);
+ assertEquals(parsed.get(field2), expected2);
+ assertEquals(parsed.get(field3), expected3);
+ }
+
+ @Test
+ public void test_adjacentValuePatterns3() {
+ String pattern = "yyyyMMddwwc";
+ String text = "20120720296";
+ DateTimeFormatter df = new DateTimeFormatterBuilder()
+ .appendPattern(pattern).toFormatter(Locale.US);
+ ParsePosition ppos = new ParsePosition(0);
+ TemporalAccessor parsed = df.parseUnresolved(text, ppos);
+ assertEquals(parsed.get(DAY_OF_WEEK), 6);
+ assertEquals(parsed.get(WEEK_OF_WEEK_BASED_YEAR), 29);
+ LocalDate result = LocalDate.parse(text, df);
+ LocalDate expectedValue = LocalDate.of(2012, 07, 20);
+ assertEquals(result, expectedValue, "LocalDate incorrect for " + pattern);
+ }
+
+ @DataProvider(name = "invalidPatterns")
+ Object[][] provider_invalidPatterns() {
+ return new Object[][] {
+ {"W", "01"},
+ {"c", "01"},
+ {"e", "01"},
+ {"yyyyMMddwwc", "201207202906"}, // 1 extra digit in the input
+ };
+ }
+
+ @Test(dataProvider = "invalidPatterns", expectedExceptions = DateTimeParseException.class)
+ public void test_invalidPatterns(String pattern, String value) {
+ DateTimeFormatter.ofPattern(pattern).parse(value);
+ }
}
diff --git a/ojluni/src/test/java/time/tck/java/time/format/TCKLocalizedOffsetIdPrinterParser.java b/ojluni/src/test/java/time/tck/java/time/format/TCKLocalizedOffsetIdPrinterParser.java
new file mode 100644
index 0000000..d0a1f18
--- /dev/null
+++ b/ojluni/src/test/java/time/tck/java/time/format/TCKLocalizedOffsetIdPrinterParser.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package tck.java.time.format;
+
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.Locale;
+
+import org.testng.annotations.Test;
+
+/**
+ * Test localized behavior of formatter.
+ */
+@Test
+public class TCKLocalizedOffsetIdPrinterParser {
+ @Test
+ public void test_localized_offset_parse() {
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.S O")
+ .withLocale(Locale.ENGLISH);
+ String date = formatter.format(ZonedDateTime.now(ZoneOffset.UTC));
+ formatter.parse(date) ;
+ }
+}
diff --git a/ojluni/src/test/java/time/tck/java/time/format/TCKOffsetPrinterParser.java b/ojluni/src/test/java/time/tck/java/time/format/TCKOffsetPrinterParser.java
index 76cfa56..704e240 100644
--- a/ojluni/src/test/java/time/tck/java/time/format/TCKOffsetPrinterParser.java
+++ b/ojluni/src/test/java/time/tck/java/time/format/TCKOffsetPrinterParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -93,6 +93,14 @@
private static final ZoneOffset OFFSET_M000045 = ZoneOffset.ofHoursMinutesSeconds(0, 0, -45);
private static final LocalDateTime DT_2012_06_30_12_30_40 = LocalDateTime.of(2012, 6, 30, 12, 30, 40);
+ private static final ZoneOffset OFFSET_P1100 = ZoneOffset.ofHours(11);
+ private static final ZoneOffset OFFSET_P1123 = ZoneOffset.ofHoursMinutes(11, 23);
+ private static final ZoneOffset OFFSET_P1023 = ZoneOffset.ofHoursMinutes(10, 23);
+ private static final ZoneOffset OFFSET_P112345 = ZoneOffset.ofHoursMinutesSeconds(11, 23, 45);
+ private static final ZoneOffset OFFSET_P100045 = ZoneOffset.ofHoursMinutesSeconds(10, 0, 45);
+ private static final ZoneOffset OFFSET_M1100 = ZoneOffset.ofHours(-11);
+ private static final ZoneOffset OFFSET_M1123 = ZoneOffset.ofHoursMinutes(-11, -23);
+ private static final ZoneOffset OFFSET_M112345 = ZoneOffset.ofHoursMinutesSeconds(-11, -23, -45);
private DateTimeFormatterBuilder builder;
@BeforeMethod
@@ -199,6 +207,236 @@
{"+HH:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-00:23:00"},
{"+HH:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-01:23:45"},
{"+HH:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-00:00:45"},
+
+ {"+HH:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+ {"+HH:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+01"},
+ {"+HH:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+01:23"},
+ {"+HH:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "+00:23"},
+ {"+HH:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+01:23:45"},
+ {"+HH:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-00:00:45"},
+ {"+HH:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-01"},
+ {"+HH:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-01:23"},
+ {"+HH:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-00:23"},
+ {"+HH:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-01:23:45"},
+ {"+HH:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-00:00:45"},
+
+ {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+ {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+01"},
+ {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+0123"},
+ {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "+0023"},
+ {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+012345"},
+ {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P000045, "+000045"},
+ {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-01"},
+ {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-0123"},
+ {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-0023"},
+ {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-012345"},
+ {"+HHmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-000045"},
+
+ {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+ {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+1"},
+ {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+1"},
+ {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "Z"},
+ {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+1"},
+ {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_P000045, "Z"},
+ {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-1"},
+ {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-1"},
+ {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "Z"},
+ {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-1"},
+ {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "Z"},
+
+ {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+ {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+1"},
+ {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+123"},
+ {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "+023"},
+ {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+123"},
+ {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_P000045, "Z"},
+ {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-1"},
+ {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-123"},
+ {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-023"},
+ {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-123"},
+ {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "Z"},
+
+ {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+ {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+100"},
+ {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+123"},
+ {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "+023"},
+ {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+123"},
+ {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_P000045, "Z"},
+ {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-100"},
+ {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-123"},
+ {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-023"},
+ {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-123"},
+ {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "Z"},
+
+ {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+ {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+1:00"},
+ {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+1:23"},
+ {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "+0:23"},
+ {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+1:23"},
+ {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_P000045, "Z"},
+ {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-1:00"},
+ {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-1:23"},
+ {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-0:23"},
+ {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-1:23"},
+ {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "Z"},
+
+ {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+ {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+100"},
+ {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+123"},
+ {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "+023"},
+ {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+12345"},
+ {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_P000045, "+00045"},
+ {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-100"},
+ {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-123"},
+ {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-023"},
+ {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-12345"},
+ {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-00045"},
+
+ {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+ {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+1:00"},
+ {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+1:23"},
+ {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "+0:23"},
+ {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+1:23:45"},
+ {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-0:00:45"},
+ {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-1:00"},
+ {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-1:23"},
+ {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-0:23"},
+ {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-1:23:45"},
+ {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-0:00:45"},
+
+ {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+ {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+10000"},
+ {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+12300"},
+ {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "+02300"},
+ {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+12345"},
+ {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-00045"},
+ {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-10000"},
+ {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-12300"},
+ {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-02300"},
+ {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-12345"},
+ {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-00045"},
+
+ {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+ {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+1:00:00"},
+ {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+1:23:00"},
+ {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "+0:23:00"},
+ {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+1:23:45"},
+ {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-0:00:45"},
+ {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-1:00:00"},
+ {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-1:23:00"},
+ {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-0:23:00"},
+ {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-1:23:45"},
+ {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-0:00:45"},
+
+ {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+ {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+1"},
+ {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+1:23"},
+ {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "+0:23"},
+ {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+1:23:45"},
+ {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-0:00:45"},
+ {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-1"},
+ {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-1:23"},
+ {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-0:23"},
+ {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-1:23:45"},
+ {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-0:00:45"},
+
+ {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_UTC, "Z"},
+ {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0100, "+1"},
+ {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0123, "+123"},
+ {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P0023, "+023"},
+ {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P012345, "+12345"},
+ {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P000045, "+00045"},
+ {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0100, "-1"},
+ {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0123, "-123"},
+ {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M0023, "-023"},
+ {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M012345, "-12345"},
+ {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M000045, "-00045"},
+
+ {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_P1100, "+11"},
+ {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_P1123, "+11"},
+ {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_P1023, "+10"},
+ {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_P112345, "+11"},
+ {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_P100045, "+10"},
+ {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_M1100, "-11"},
+ {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_M1123, "-11"},
+ {"+H", "Z", DT_2012_06_30_12_30_40, OFFSET_M112345, "-11"},
+
+ {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_P1100, "+11"},
+ {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_P1123, "+1123"},
+ {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_P1023, "+1023"},
+ {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_P112345, "+1123"},
+ {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_P100045, "+10"},
+ {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_M1100, "-11"},
+ {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_M1123, "-1123"},
+ {"+Hmm", "Z", DT_2012_06_30_12_30_40, OFFSET_M112345, "-1123"},
+
+ {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_P1100, "+1100"},
+ {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_P1123, "+1123"},
+ {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_P1023, "+1023"},
+ {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_P112345, "+1123"},
+ {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_P100045, "+1000"},
+ {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_M1100, "-1100"},
+ {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_M1123, "-1123"},
+ {"+HMM", "Z", DT_2012_06_30_12_30_40, OFFSET_M112345, "-1123"},
+
+ {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_P1100, "+11:00"},
+ {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_P1123, "+11:23"},
+ {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_P1023, "+10:23"},
+ {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_P112345, "+11:23"},
+ {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_P100045, "+10:00"},
+ {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_M1100, "-11:00"},
+ {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_M1123, "-11:23"},
+ {"+H:MM", "Z", DT_2012_06_30_12_30_40, OFFSET_M112345, "-11:23"},
+
+ {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1100, "+1100"},
+ {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1123, "+1123"},
+ {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1023, "+1023"},
+ {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_P112345, "+112345"},
+ {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_P100045, "+100045"},
+ {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_M1100, "-1100"},
+ {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_M1123, "-1123"},
+ {"+HMMss", "Z", DT_2012_06_30_12_30_40, OFFSET_M112345, "-112345"},
+
+ {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1100, "+11:00"},
+ {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1123, "+11:23"},
+ {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1023, "+10:23"},
+ {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P112345, "+11:23:45"},
+ {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M1100, "-11:00"},
+ {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M1123, "-11:23"},
+ {"+H:MM:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M112345, "-11:23:45"},
+
+ {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_P1100, "+110000"},
+ {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_P1123, "+112300"},
+ {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_P1023, "+102300"},
+ {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_P112345, "+112345"},
+ {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_M1100, "-110000"},
+ {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_M1123, "-112300"},
+ {"+HMMSS", "Z", DT_2012_06_30_12_30_40, OFFSET_M112345, "-112345"},
+
+ {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_P1100, "+11:00:00"},
+ {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_P1123, "+11:23:00"},
+ {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_P1023, "+10:23:00"},
+ {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_P112345, "+11:23:45"},
+ {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M1100, "-11:00:00"},
+ {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M1123, "-11:23:00"},
+ {"+H:MM:SS", "Z", DT_2012_06_30_12_30_40, OFFSET_M112345, "-11:23:45"},
+
+ {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1100, "+11"},
+ {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1123, "+11:23"},
+ {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1023, "+10:23"},
+ {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_P112345, "+11:23:45"},
+ {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M1100, "-11"},
+ {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M1123, "-11:23"},
+ {"+H:mm:ss", "Z", DT_2012_06_30_12_30_40, OFFSET_M112345, "-11:23:45"},
+
+ {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1100, "+11"},
+ {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1123, "+1123"},
+ {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P1023, "+1023"},
+ {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P112345, "+112345"},
+ {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_P100045, "+100045"},
+ {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M1100, "-11"},
+ {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M1123, "-1123"},
+ {"+Hmmss", "Z", DT_2012_06_30_12_30_40, OFFSET_M112345, "-112345"},
};
}
diff --git a/ojluni/src/test/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java b/ojluni/src/test/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java
index 122da86..c165688 100644
--- a/ojluni/src/test/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java
+++ b/ojluni/src/test/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java
@@ -152,144 +152,182 @@
@DataProvider(name="parseSuccess")
Object[][] data_parseSuccess() {
return new Object[][] {
- {"Z", 1, -1, ZoneId.of("Z")},
- {"UTC", 3, -1, ZoneId.of("UTC")},
- {"UT", 2, -1, ZoneId.of("UT")},
- {"GMT", 3, -1, ZoneId.of("GMT")},
+ {"Z", 1, -1, ZoneId.of("Z"), true},
+ {"UTC", 3, -1, ZoneId.of("UTC"), false},
+ {"UT", 2, -1, ZoneId.of("UT"), false},
+ {"GMT", 3, -1, ZoneId.of("GMT"), false},
+ {"GMT0", 4, -1, ZoneId.of("GMT0"), false},
- {"+00:00", 6, -1, ZoneOffset.UTC},
- {"UTC+00:00", 9, -1, ZoneId.of("UTC")},
- {"UT+00:00", 8, -1, ZoneId.of("UT")},
- {"GMT+00:00", 9, -1, ZoneId.of("GMT")},
- {"-00:00", 6, -1, ZoneOffset.UTC},
- {"UTC-00:00", 9, -1, ZoneId.of("UTC")},
- {"UT-00:00", 8, -1, ZoneId.of("UT")},
- {"GMT-00:00", 9, -1, ZoneId.of("GMT")},
+ {"+00:00", 6, -1, ZoneOffset.UTC, true},
+ {"UTC+00:00", 9, -1, ZoneId.of("UTC"), false},
+ {"UT+00:00", 8, -1, ZoneId.of("UT"), false},
+ {"GMT+00:00", 9, -1, ZoneId.of("GMT"), false},
+ {"-00:00", 6, -1, ZoneOffset.UTC, true},
+ {"UTC-00:00", 9, -1, ZoneId.of("UTC"), false},
+ {"UT-00:00", 8, -1, ZoneId.of("UT"), false},
+ {"GMT-00:00", 9, -1, ZoneId.of("GMT"), false},
- {"+01:30", 6, -1, ZoneOffset.ofHoursMinutes(1, 30)},
- {"UTC+01:30", 9, -1, ZoneId.of("UTC+01:30")},
- {"UT+02:30", 8, -1, ZoneId.of("UT+02:30")},
- {"GMT+03:30", 9, -1, ZoneId.of("GMT+03:30")},
- {"-01:30", 6, -1, ZoneOffset.ofHoursMinutes(-1, -30)},
- {"UTC-01:30", 9, -1, ZoneId.of("UTC-01:30")},
- {"UT-02:30", 8, -1, ZoneId.of("UT-02:30")},
- {"GMT-03:30", 9, -1, ZoneId.of("GMT-03:30")},
+ {"+01:30", 6, -1, ZoneOffset.ofHoursMinutes(1, 30), true},
+ {"UTC+01:30", 9, -1, ZoneId.of("UTC+01:30"), false},
+ {"UT+02:30", 8, -1, ZoneId.of("UT+02:30"), false},
+ {"GMT+03:30", 9, -1, ZoneId.of("GMT+03:30"), false},
+ {"-01:30", 6, -1, ZoneOffset.ofHoursMinutes(-1, -30), true},
+ {"UTC-01:30", 9, -1, ZoneId.of("UTC-01:30"), false},
+ {"UT-02:30", 8, -1, ZoneId.of("UT-02:30"), false},
+ {"GMT-03:30", 9, -1, ZoneId.of("GMT-03:30"), false},
// fallback to UTC
- {"UTC-01:WW", 3, -1, ZoneId.of("UTC")},
- {"UT-02:WW", 2, -1, ZoneId.of("UT")},
- {"GMT-03:WW", 3, -1, ZoneId.of("GMT")},
- {"Z0", 1, -1, ZoneOffset.UTC},
- {"UTC1", 3, -1, ZoneId.of("UTC")},
+ {"UTC-01:WW", 3, -1, ZoneId.of("UTC"), false},
+ {"UT-02:WW", 2, -1, ZoneId.of("UT"), false},
+ {"GMT-03:WW", 3, -1, ZoneId.of("GMT"), false},
+ {"Z0", 1, -1, ZoneOffset.UTC, true},
+ {"UTC1", 3, -1, ZoneId.of("UTC"), false},
// Z not parsed as zero
- {"UTCZ", 3, -1, ZoneId.of("UTC")},
- {"UTZ", 2, -1, ZoneId.of("UT")},
- {"GMTZ", 3, -1, ZoneId.of("GMT")},
+ {"UTCZ", 3, -1, ZoneId.of("UTC"), false},
+ {"UTZ", 2, -1, ZoneId.of("UT"), false},
+ {"GMTZ", 3, -1, ZoneId.of("GMT"), false},
// 0 not parsed
- {"UTC0", 3, -1, ZoneId.of("UTC")},
- {"UT0", 2, -1, ZoneId.of("UT")},
+ {"UTC0", 3, -1, ZoneId.of("UTC"), false},
+ {"UT0", 2, -1, ZoneId.of("UT"), false},
// fail to parse
- {"", 0, 0, null},
- {"A", 0, 0, null},
- {"UZ", 0, 0, null},
- {"GMA", 0, 0, null},
- {"0", 0, 0, null},
- {"+", 0, 0, null},
- {"-", 0, 0, null},
+ {"", 0, 0, null, false},
+ {"A", 0, 0, null, false},
+ {"UZ", 0, 0, null, false},
+ {"GMA", 0, 0, null, false},
+ {"0", 0, 0, null, false},
+ {"+", 0, 0, null, false},
+ {"-", 0, 0, null, false},
// zone IDs
- {"Europe/London", 13, -1, ZoneId.of("Europe/London")},
- {"America/New_York", 16, -1, ZoneId.of("America/New_York")},
- {"America/Bogusville", 0, 0, null},
+ {"Europe/London", 13, -1, ZoneId.of("Europe/London"), false},
+ {"America/New_York", 16, -1, ZoneId.of("America/New_York"), false},
+ {"America/Bogusville", 0, 0, null, false},
};
}
@Test(dataProvider="parseSuccess")
- public void test_parseSuccess_plain(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
+ public void test_ZoneId_parseSuccess_plain(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
builder.appendZoneId();
- TemporalAccessor parsed = builder.toFormatter().parseUnresolved(text, pos);
- assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + text);
- assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + text);
- if (expected != null) {
- assertEquals(parsed.query(TemporalQueries.zoneId()), expected, "Incorrect zoneId parsing: " + text);
- assertEquals(parsed.query(TemporalQueries.offset()), null, "Incorrect offset parsing: " + text);
- assertEquals(parsed.query(TemporalQueries.zone()), expected, "Incorrect zone parsing: " + text);
- } else {
- assertEquals(parsed, null);
- }
+ test(text, expectedIndex, expectedErrorIndex, expected, isZoneOffset);
}
@Test(dataProvider="parseSuccess")
- public void test_parseSuccess_prefix(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
+ public void test_ZoneId_parseSuccess_prefix(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
builder.appendZoneId();
pos.setIndex(3);
- String prefixText = "XXX" + text;
- TemporalAccessor parsed = builder.toFormatter().parseUnresolved(prefixText, pos);
- assertEquals(pos.getErrorIndex(), expectedErrorIndex >= 0 ? expectedErrorIndex + 3 : expectedErrorIndex, "Incorrect error index parsing: " + prefixText);
- assertEquals(pos.getIndex(), expectedIndex + 3, "Incorrect index parsing: " + prefixText);
- if (expected != null) {
- assertEquals(parsed.query(TemporalQueries.zoneId()), expected, "Incorrect zoneId parsing: " + prefixText);
- assertEquals(parsed.query(TemporalQueries.offset()), null, "Incorrect offset parsing: " + prefixText);
- assertEquals(parsed.query(TemporalQueries.zone()), expected, "Incorrect zone parsing: " + prefixText);
- } else {
- assertEquals(parsed, null);
- }
+ test("XXX" + text,
+ expectedIndex + 3,
+ expectedErrorIndex >= 0 ? expectedErrorIndex + 3 : expectedErrorIndex,
+ expected, isZoneOffset);
}
@Test(dataProvider="parseSuccess")
- public void test_parseSuccess_suffix(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
+ public void test_ZoneId_parseSuccess_suffix(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
builder.appendZoneId();
- String suffixText = text + "XXX";
- TemporalAccessor parsed = builder.toFormatter().parseUnresolved(suffixText, pos);
- assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + suffixText);
- assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + suffixText);
- if (expected != null) {
- assertEquals(parsed.query(TemporalQueries.zoneId()), expected, "Incorrect zoneId parsing: " + suffixText);
- assertEquals(parsed.query(TemporalQueries.offset()), null, "Incorrect offset parsing: " + suffixText);
- assertEquals(parsed.query(TemporalQueries.zone()), expected, "Incorrect zone parsing: " + suffixText);
- } else {
- assertEquals(parsed, null);
- }
+ test(text + "XXX", expectedIndex, expectedErrorIndex, expected, isZoneOffset);
}
@Test(dataProvider="parseSuccess")
- public void test_parseSuccess_caseSensitive(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
+ public void test_ZoneId_parseSuccess_caseSensitive(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
builder.parseCaseSensitive().appendZoneId();
- String lcText = text.toLowerCase(Locale.ENGLISH);
- TemporalAccessor parsed = builder.toFormatter().parseUnresolved(lcText, pos);
+
if (text.matches("[^A-Z]*[A-Z].*")) { // if input has letters
+ String lcText = text.toLowerCase(Locale.ENGLISH);
+ TemporalAccessor parsed = builder.toFormatter().parseUnresolved(lcText, pos);
assertEquals(pos.getErrorIndex() >= 0, true);
assertEquals(pos.getIndex(), 0);
assertEquals(parsed, null);
} else {
- // case sensitive made no difference
- assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + lcText);
- assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + lcText);
- if (expected != null) {
- assertEquals(parsed.query(TemporalQueries.zoneId()), expected);
- assertEquals(parsed.query(TemporalQueries.offset()), null);
- assertEquals(parsed.query(TemporalQueries.zone()), expected);
- } else {
- assertEquals(parsed, null);
- }
+ test(text.toLowerCase(Locale.ENGLISH), expectedIndex, expectedErrorIndex, expected, isZoneOffset);
}
}
@Test(dataProvider="parseSuccess")
- public void test_parseSuccess_caseInsensitive(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
+ public void test_ZoneId_parseSuccess_caseInsensitive(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
builder.parseCaseInsensitive().appendZoneId();
- String lcText = text.toLowerCase(Locale.ENGLISH);
- TemporalAccessor parsed = builder.toFormatter().parseUnresolved(lcText, pos);
- assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + lcText);
- assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + lcText);
+ test(text.toLowerCase(Locale.ENGLISH), expectedIndex, expectedErrorIndex, expected, isZoneOffset);
+ }
+
+ @Test(dataProvider="parseSuccess")
+ public void test_ZoneOrOffsetId_parseSuccess_plain(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
+ builder.appendZoneOrOffsetId();
+ test(text, expectedIndex, expectedErrorIndex, expected, isZoneOffset);
+ }
+
+ @Test(dataProvider="parseSuccess")
+ public void test_ZoneOrOffsetId_parseSuccess_prefix(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
+ builder.appendZoneOrOffsetId();
+ pos.setIndex(3);
+ test("XXX" + text,
+ expectedIndex + 3,
+ expectedErrorIndex >= 0 ? expectedErrorIndex + 3 : expectedErrorIndex,
+ expected, isZoneOffset);
+ }
+
+ @Test(dataProvider="parseSuccess")
+ public void test_ZoneOrOffsetId_parseSuccess_suffix(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
+ builder.appendZoneOrOffsetId();
+ test(text + "XXX", expectedIndex, expectedErrorIndex, expected, isZoneOffset);
+ }
+
+ @Test(dataProvider="parseSuccess")
+ public void test_ZoneOrOffsetId_parseSuccess_caseSensitive(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
+ builder.parseCaseSensitive().appendZoneOrOffsetId();
+ if (text.matches("[^A-Z]*[A-Z].*")) { // if input has letters
+ String lcText = text.toLowerCase(Locale.ENGLISH);
+ TemporalAccessor parsed = builder.toFormatter().parseUnresolved(lcText, pos);
+ assertEquals(pos.getErrorIndex() >= 0, true);
+ assertEquals(pos.getIndex(), 0);
+ assertEquals(parsed, null);
+ } else {
+ test(text.toLowerCase(Locale.ENGLISH), expectedIndex, expectedErrorIndex, expected, isZoneOffset);
+ }
+ }
+
+ @Test(dataProvider="parseSuccess")
+ public void test_ZoneOrOffsetIdparseSuccess_caseInsensitive(
+ String text, int expectedIndex, int expectedErrorIndex, ZoneId expected, boolean isZoneOffset)
+ {
+ builder.parseCaseInsensitive().appendZoneOrOffsetId();
+ test(text.toLowerCase(Locale.ENGLISH), expectedIndex, expectedErrorIndex, expected, isZoneOffset);
+ }
+
+ private void test(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected,
+ boolean isZoneOffset) {
+ TemporalAccessor parsed = builder.toFormatter().parseUnresolved(text, pos);
+ assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + text);
+ assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + text);
if (expected != null) {
- ZoneId zid = parsed.query(TemporalQueries.zoneId());
- assertEquals(parsed.query(TemporalQueries.zoneId()), expected, "Incorrect zoneId parsing: " + lcText);
- assertEquals(parsed.query(TemporalQueries.offset()), null, "Incorrect offset parsing: " + lcText);
- assertEquals(parsed.query(TemporalQueries.zone()), expected, "Incorrect zone parsing: " + lcText);
+ assertEquals(parsed.query(TemporalQueries.zoneId()),
+ expected,
+ "Incorrect zoneId parsing: " + text);
+ assertEquals(parsed.query(TemporalQueries.offset()),
+ isZoneOffset ? expected : null,
+ "Incorrect offset parsing: " + text);
+ assertEquals(parsed.query(TemporalQueries.zone()),
+ expected,
+ "Incorrect zone parsing: " + text);
} else {
assertEquals(parsed, null);
}
diff --git a/ojluni/src/test/java/time/tck/java/time/serial/TCKZoneIdSerialization.java b/ojluni/src/test/java/time/tck/java/time/serial/TCKZoneIdSerialization.java
index c6f3abe..34c79c3 100644
--- a/ojluni/src/test/java/time/tck/java/time/serial/TCKZoneIdSerialization.java
+++ b/ojluni/src/test/java/time/tck/java/time/serial/TCKZoneIdSerialization.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -63,8 +63,11 @@
import org.testng.annotations.Test;
import tck.java.time.AbstractTCKTest;
-import java.io.*;
-import java.lang.reflect.Field;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamConstants;
import java.time.DateTimeException;
import java.time.ZoneId;
import java.time.zone.ZoneRulesException;
@@ -153,10 +156,8 @@
private ZoneId deserialize(String id) throws Exception {
String serClass = ZoneId.class.getPackage().getName() + ".Ser";
- Class<?> serCls = Class.forName(serClass);
- Field field = serCls.getDeclaredField("serialVersionUID");
- field.setAccessible(true);
- long serVer = (Long) field.get(null);
+ long serVer = getSUID(ZoneId.class);
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (DataOutputStream dos = new DataOutputStream(baos)) {
dos.writeShort(ObjectStreamConstants.STREAM_MAGIC);
diff --git a/ojluni/src/test/java/time/tck/java/time/temporal/TCKIsoFields.java b/ojluni/src/test/java/time/tck/java/time/temporal/TCKIsoFields.java
index d607571..c86805f 100644
--- a/ojluni/src/test/java/time/tck/java/time/temporal/TCKIsoFields.java
+++ b/ojluni/src/test/java/time/tck/java/time/temporal/TCKIsoFields.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -71,12 +71,15 @@
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
+import java.time.chrono.ThaiBuddhistDate;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.time.format.DateTimeParseException;
import java.time.format.ResolverStyle;
import java.time.temporal.IsoFields;
import java.time.temporal.Temporal;
+import java.time.temporal.TemporalField;
+import java.time.temporal.UnsupportedTemporalTypeException;
import java.time.temporal.ValueRange;
import org.testng.annotations.DataProvider;
@@ -439,6 +442,45 @@
}
//-----------------------------------------------------------------------
+ // rangeRefinedBy
+ //-----------------------------------------------------------------------
+ @DataProvider(name="isofields")
+ Object[][] data_isofields() {
+ return new Object[][] {
+ {IsoFields.DAY_OF_QUARTER, 49, ValueRange.of(1, 91)},
+ {IsoFields.QUARTER_OF_YEAR, 2, ValueRange.of(1, 4)},
+ {IsoFields.WEEK_OF_WEEK_BASED_YEAR, 20, ValueRange.of(1, 52)},
+ {IsoFields.WEEK_BASED_YEAR, 2016, ValueRange.of(LocalDate.MIN.getYear(),
+ LocalDate.MAX.getYear())},
+ };
+ }
+
+ @Test(dataProvider = "isofields")
+ public void test_isofields_rangerefinedby(TemporalField field, int value, ValueRange valueRange) {
+ LocalDate date = LocalDate.of(2016, 5, 19);
+ assertEquals(field.rangeRefinedBy(date), valueRange);
+ }
+
+ @Test(dataProvider = "isofields", expectedExceptions = UnsupportedTemporalTypeException.class)
+ public void test_nonisofields_rangerefinedby(TemporalField field, int value, ValueRange valueRange) {
+ field.rangeRefinedBy(ThaiBuddhistDate.now());
+ }
+
+ //-----------------------------------------------------------------------
+ // getFrom
+ //-----------------------------------------------------------------------
+ @Test(dataProvider = "isofields")
+ public void test_isofields_getFrom(TemporalField field, int value, ValueRange valueRange) {
+ LocalDate date = LocalDate.of(2016, 5, 19);
+ assertEquals(field.getFrom(date), value);
+ }
+
+ @Test(dataProvider = "isofields", expectedExceptions = UnsupportedTemporalTypeException.class)
+ public void test_nonisofields_getFrom(TemporalField field, int value, ValueRange valueRange) {
+ field.getFrom(ThaiBuddhistDate.now());
+ }
+
+ //-----------------------------------------------------------------------
public void test_loop() {
// loop round at least one 400 year cycle, including before 1970
LocalDate date = LocalDate.of(1960, 1, 5); // Tuseday of week 1 1960
diff --git a/ojluni/src/test/java/time/tck/java/time/zone/TCKZoneOffsetTransitionRule.java b/ojluni/src/test/java/time/tck/java/time/zone/TCKZoneOffsetTransitionRule.java
index 58e2ff5..3c0c14c 100644
--- a/ojluni/src/test/java/time/tck/java/time/zone/TCKZoneOffsetTransitionRule.java
+++ b/ojluni/src/test/java/time/tck/java/time/zone/TCKZoneOffsetTransitionRule.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -156,6 +156,13 @@
OFFSET_0200, OFFSET_0200, OFFSET_0300);
}
+ @Test(expectedExceptions=IllegalArgumentException.class)
+ public void test_factory_nonZeroTimeNanos() {
+ ZoneOffsetTransitionRule.of(
+ Month.MARCH, 20, DayOfWeek.SUNDAY, LocalTime.of(1, 2, 3, 400_000_000),
+ false, TimeDefinition.WALL, OFFSET_0200, OFFSET_0200, OFFSET_0300);
+ }
+
//-----------------------------------------------------------------------
// getters
//-----------------------------------------------------------------------
diff --git a/ojluni/src/test/java/time/tck/java/time/zone/TCKZoneRules.java b/ojluni/src/test/java/time/tck/java/time/zone/TCKZoneRules.java
index 2781ca5..9eae05e 100644
--- a/ojluni/src/test/java/time/tck/java/time/zone/TCKZoneRules.java
+++ b/ojluni/src/test/java/time/tck/java/time/zone/TCKZoneRules.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -112,11 +112,13 @@
return ZoneId.of("Europe/London").getRules();
}
+ @Test
public void test_London() {
ZoneRules test = europeLondon();
assertEquals(test.isFixedOffset(), false);
}
+ @Test
public void test_London_preTimeZones() {
ZoneRules test = europeLondon();
ZonedDateTime old = createZDT(1800, 1, 1, ZoneOffset.UTC);
@@ -129,6 +131,7 @@
assertEquals(test.isDaylightSavings(instant), false);
}
+ @Test
public void test_London_getOffset() {
ZoneRules test = europeLondon();
assertEquals(test.getOffset(createInstant(2008, 1, 1, ZoneOffset.UTC)), OFFSET_ZERO);
@@ -145,6 +148,7 @@
assertEquals(test.getOffset(createInstant(2008, 12, 1, ZoneOffset.UTC)), OFFSET_ZERO);
}
+ @Test
public void test_London_getOffset_toDST() {
ZoneRules test = europeLondon();
assertEquals(test.getOffset(createInstant(2008, 3, 24, ZoneOffset.UTC)), OFFSET_ZERO);
@@ -160,6 +164,7 @@
assertEquals(test.getOffset(createInstant(2008, 3, 30, 1, 0, 0, 0, ZoneOffset.UTC)), OFFSET_PONE);
}
+ @Test
public void test_London_getOffset_fromDST() {
ZoneRules test = europeLondon();
assertEquals(test.getOffset(createInstant(2008, 10, 24, ZoneOffset.UTC)), OFFSET_PONE);
@@ -175,6 +180,7 @@
assertEquals(test.getOffset(createInstant(2008, 10, 26, 1, 0, 0, 0, ZoneOffset.UTC)), OFFSET_ZERO);
}
+ @Test
public void test_London_getOffsetInfo() {
ZoneRules test = europeLondon();
checkOffset(test, createLDT(2008, 1, 1), OFFSET_ZERO, 1);
@@ -191,6 +197,7 @@
checkOffset(test, createLDT(2008, 12, 1), OFFSET_ZERO, 1);
}
+ @Test
public void test_London_getOffsetInfo_toDST() {
ZoneRules test = europeLondon();
checkOffset(test, createLDT(2008, 3, 24), OFFSET_ZERO, 1);
@@ -206,6 +213,7 @@
checkOffset(test, LocalDateTime.of(2008, 3, 30, 2, 0, 0, 0), OFFSET_PONE, 1);
}
+ @Test
public void test_London_getOffsetInfo_fromDST() {
ZoneRules test = europeLondon();
checkOffset(test, createLDT(2008, 10, 24), OFFSET_PONE, 1);
@@ -221,6 +229,7 @@
checkOffset(test, LocalDateTime.of(2008, 10, 26, 2, 0, 0, 0), OFFSET_ZERO, 1);
}
+ @Test
public void test_London_getOffsetInfo_gap() {
ZoneRules test = europeLondon();
final LocalDateTime dateTime = LocalDateTime.of(2008, 3, 30, 1, 0, 0, 0);
@@ -246,6 +255,7 @@
assertEquals(trans.hashCode(), otherTrans.hashCode());
}
+ @Test
public void test_London_getOffsetInfo_overlap() {
ZoneRules test = europeLondon();
final LocalDateTime dateTime = LocalDateTime.of(2008, 10, 26, 1, 0, 0, 0);
@@ -272,6 +282,7 @@
assertEquals(trans.hashCode(), otherTrans.hashCode());
}
+ @Test
public void test_London_getStandardOffset() {
ZoneRules test = europeLondon();
ZonedDateTime zdt = createZDT(1840, 1, 1, ZoneOffset.UTC);
@@ -288,6 +299,7 @@
}
}
+ @Test
public void test_London_getTransitions() {
ZoneRules test = europeLondon();
List<ZoneOffsetTransition> trans = test.getTransitions();
@@ -365,6 +377,7 @@
assertEquals(it.hasNext(), false);
}
+ @Test
public void test_London_getTransitionRules() {
ZoneRules test = europeLondon();
List<ZoneOffsetTransitionRule> rules = test.getTransitionRules();
@@ -394,6 +407,7 @@
}
//-----------------------------------------------------------------------
+ @Test
public void test_London_nextTransition_historic() {
ZoneRules test = europeLondon();
List<ZoneOffsetTransition> trans = test.getTransitions();
@@ -410,6 +424,7 @@
}
}
+ @Test
public void test_London_nextTransition_rulesBased() {
ZoneRules test = europeLondon();
List<ZoneOffsetTransitionRule> rules = test.getTransitionRules();
@@ -431,6 +446,7 @@
}
}
+ @Test
public void test_London_nextTransition_lastYear() {
ZoneRules test = europeLondon();
List<ZoneOffsetTransitionRule> rules = test.getTransitionRules();
@@ -439,6 +455,7 @@
}
//-----------------------------------------------------------------------
+ @Test
public void test_London_previousTransition_historic() {
ZoneRules test = europeLondon();
List<ZoneOffsetTransition> trans = test.getTransitions();
@@ -457,6 +474,7 @@
}
}
+ @Test
public void test_London_previousTransition_rulesBased() {
ZoneRules test = europeLondon();
List<ZoneOffsetTransitionRule> rules = test.getTransitionRules();
@@ -494,11 +512,13 @@
return ZoneId.of("Europe/Paris").getRules();
}
+ @Test
public void test_Paris() {
ZoneRules test = europeParis();
assertEquals(test.isFixedOffset(), false);
}
+ @Test
public void test_Paris_preTimeZones() {
ZoneRules test = europeParis();
ZonedDateTime old = createZDT(1800, 1, 1, ZoneOffset.UTC);
@@ -511,6 +531,7 @@
assertEquals(test.isDaylightSavings(instant), false);
}
+ @Test
public void test_Paris_getOffset() {
ZoneRules test = europeParis();
assertEquals(test.getOffset(createInstant(2008, 1, 1, ZoneOffset.UTC)), OFFSET_PONE);
@@ -527,6 +548,7 @@
assertEquals(test.getOffset(createInstant(2008, 12, 1, ZoneOffset.UTC)), OFFSET_PONE);
}
+ @Test
public void test_Paris_getOffset_toDST() {
ZoneRules test = europeParis();
assertEquals(test.getOffset(createInstant(2008, 3, 24, ZoneOffset.UTC)), OFFSET_PONE);
@@ -542,6 +564,7 @@
assertEquals(test.getOffset(createInstant(2008, 3, 30, 1, 0, 0, 0, ZoneOffset.UTC)), OFFSET_PTWO);
}
+ @Test
public void test_Paris_getOffset_fromDST() {
ZoneRules test = europeParis();
assertEquals(test.getOffset(createInstant(2008, 10, 24, ZoneOffset.UTC)), OFFSET_PTWO);
@@ -557,6 +580,7 @@
assertEquals(test.getOffset(createInstant(2008, 10, 26, 1, 0, 0, 0, ZoneOffset.UTC)), OFFSET_PONE);
}
+ @Test
public void test_Paris_getOffsetInfo() {
ZoneRules test = europeParis();
checkOffset(test, createLDT(2008, 1, 1), OFFSET_PONE, 1);
@@ -573,6 +597,7 @@
checkOffset(test, createLDT(2008, 12, 1), OFFSET_PONE, 1);
}
+ @Test
public void test_Paris_getOffsetInfo_toDST() {
ZoneRules test = europeParis();
checkOffset(test, createLDT(2008, 3, 24), OFFSET_PONE, 1);
@@ -588,6 +613,7 @@
checkOffset(test, LocalDateTime.of(2008, 3, 30, 3, 0, 0, 0), OFFSET_PTWO, 1);
}
+ @Test
public void test_Paris_getOffsetInfo_fromDST() {
ZoneRules test = europeParis();
checkOffset(test, createLDT(2008, 10, 24), OFFSET_PTWO, 1);
@@ -603,6 +629,7 @@
checkOffset(test, LocalDateTime.of(2008, 10, 26, 3, 0, 0, 0), OFFSET_PONE, 1);
}
+ @Test
public void test_Paris_getOffsetInfo_gap() {
ZoneRules test = europeParis();
final LocalDateTime dateTime = LocalDateTime.of(2008, 3, 30, 2, 0, 0, 0);
@@ -626,6 +653,7 @@
assertEquals(trans.hashCode(), otherTrans.hashCode());
}
+ @Test
public void test_Paris_getOffsetInfo_overlap() {
ZoneRules test = europeParis();
final LocalDateTime dateTime = LocalDateTime.of(2008, 10, 26, 2, 0, 0, 0);
@@ -650,6 +678,7 @@
assertEquals(trans.hashCode(), otherTrans.hashCode());
}
+ @Test
public void test_Paris_getStandardOffset() {
ZoneRules test = europeParis();
ZonedDateTime zdt = createZDT(1840, 1, 1, ZoneOffset.UTC);
@@ -677,11 +706,13 @@
return ZoneId.of("America/New_York").getRules();
}
+ @Test
public void test_NewYork() {
ZoneRules test = americaNewYork();
assertEquals(test.isFixedOffset(), false);
}
+ @Test
public void test_NewYork_preTimeZones() {
ZoneRules test = americaNewYork();
ZonedDateTime old = createZDT(1800, 1, 1, ZoneOffset.UTC);
@@ -694,6 +725,7 @@
assertEquals(test.isDaylightSavings(instant), false);
}
+ @Test
public void test_NewYork_getOffset() {
ZoneRules test = americaNewYork();
ZoneOffset offset = ZoneOffset.ofHours(-5);
@@ -723,6 +755,7 @@
assertEquals(test.getOffset(createInstant(2008, 12, 28, offset)), ZoneOffset.ofHours(-5));
}
+ @Test
public void test_NewYork_getOffset_toDST() {
ZoneRules test = americaNewYork();
ZoneOffset offset = ZoneOffset.ofHours(-5);
@@ -738,6 +771,7 @@
assertEquals(test.getOffset(createInstant(2008, 3, 9, 2, 0, 0, 0, offset)), ZoneOffset.ofHours(-4));
}
+ @Test
public void test_NewYork_getOffset_fromDST() {
ZoneRules test = americaNewYork();
ZoneOffset offset = ZoneOffset.ofHours(-4);
@@ -753,6 +787,7 @@
assertEquals(test.getOffset(createInstant(2008, 11, 2, 2, 0, 0, 0, offset)), ZoneOffset.ofHours(-5));
}
+ @Test
public void test_NewYork_getOffsetInfo() {
ZoneRules test = americaNewYork();
checkOffset(test, createLDT(2008, 1, 1), ZoneOffset.ofHours(-5), 1);
@@ -781,6 +816,7 @@
checkOffset(test, createLDT(2008, 12, 28), ZoneOffset.ofHours(-5), 1);
}
+ @Test
public void test_NewYork_getOffsetInfo_toDST() {
ZoneRules test = americaNewYork();
checkOffset(test, createLDT(2008, 3, 8), ZoneOffset.ofHours(-5), 1);
@@ -795,6 +831,7 @@
checkOffset(test, LocalDateTime.of(2008, 3, 9, 3, 0, 0, 0), ZoneOffset.ofHours(-4), 1);
}
+ @Test
public void test_NewYork_getOffsetInfo_fromDST() {
ZoneRules test = americaNewYork();
checkOffset(test, createLDT(2008, 11, 1), ZoneOffset.ofHours(-4), 1);
@@ -809,6 +846,7 @@
checkOffset(test, LocalDateTime.of(2008, 11, 2, 2, 0, 0, 0), ZoneOffset.ofHours(-5), 1);
}
+ @Test
public void test_NewYork_getOffsetInfo_gap() {
ZoneRules test = americaNewYork();
final LocalDateTime dateTime = LocalDateTime.of(2008, 3, 9, 2, 0, 0, 0);
@@ -832,6 +870,7 @@
assertEquals(trans.hashCode(), otherTrans.hashCode());
}
+ @Test
public void test_NewYork_getOffsetInfo_overlap() {
ZoneRules test = americaNewYork();
final LocalDateTime dateTime = LocalDateTime.of(2008, 11, 2, 1, 0, 0, 0);
@@ -856,6 +895,7 @@
assertEquals(trans.hashCode(), otherTrans.hashCode());
}
+ @Test
public void test_NewYork_getStandardOffset() {
ZoneRules test = americaNewYork();
ZonedDateTime dateTime = createZDT(1860, 1, 1, ZoneOffset.UTC);
@@ -877,6 +917,7 @@
return ZoneId.of("Asia/Kathmandu").getRules();
}
+ @Test
public void test_Kathmandu_nextTransition_historic() {
ZoneRules test = asiaKathmandu();
List<ZoneOffsetTransition> trans = test.getTransitions();
@@ -893,6 +934,7 @@
}
}
+ @Test
public void test_Kathmandu_nextTransition_noRules() {
ZoneRules test = asiaKathmandu();
List<ZoneOffsetTransition> trans = test.getTransitions();
@@ -908,6 +950,7 @@
return ZoneId.of("Pacific/Apia").getRules();
}
+ @Test
public void test_Apia_nextTransition_historic() {
ZoneRules test = pacificApia();
List<ZoneOffsetTransition> trans = test.getTransitions();
@@ -924,6 +967,7 @@
}
}
+ @Test
public void test_Apia_jumpOverInternationalDateLine_M10_to_P14() {
// transition occurred at 2011-12-30T00:00-10:00
ZoneRules test = pacificApia();
@@ -942,9 +986,8 @@
assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(2011, 12, 31, 1, 0));
}
+ @Test
public void test_Apia_jumpForwardOverInternationalDateLine_P12_to_M12() {
- // Android-changed: 1879 changed to 1892 in this test due to 2017c IANA update. Upstream
- // will probably do the same. See https://bugs.openjdk.java.net/browse/JDK-8190259
// transition occurred at 1892-07-04T00:00+12:33:04
ZoneRules test = pacificApia();
Instant instantBefore = LocalDate.of(1892, 7, 2).atStartOfDay(ZoneOffset.UTC).toInstant();
@@ -978,6 +1021,7 @@
//-----------------------------------------------------------------------
// of()
//-----------------------------------------------------------------------
+ @Test
public void test_of(){
//used for standard offset
ZoneOffset stdOffset1 = ZoneOffset.UTC;
@@ -1053,6 +1097,7 @@
//-----------------------------------------------------------------------
// equals() / hashCode()
//-----------------------------------------------------------------------
+ @Test
public void test_equals() {
ZoneRules test1 = europeLondon();
ZoneRules test2 = europeParis();
@@ -1069,14 +1114,17 @@
assertEquals(test2.hashCode() == test2b.hashCode(), true);
}
+ @Test
public void test_equals_null() {
assertEquals(europeLondon().equals(null), false);
}
+ @Test
public void test_equals_notZoneRules() {
assertEquals(europeLondon().equals("Europe/London"), false);
}
+ @Test
public void test_toString() {
assertEquals(europeLondon().toString().contains("ZoneRules"), true);
}
diff --git a/ojluni/src/test/java/time/tck/java/time/zone/TCKZoneRulesProvider.java b/ojluni/src/test/java/time/tck/java/time/zone/TCKZoneRulesProvider.java
index a30424f..f51bb39 100644
--- a/ojluni/src/test/java/time/tck/java/time/zone/TCKZoneRulesProvider.java
+++ b/ojluni/src/test/java/time/tck/java/time/zone/TCKZoneRulesProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -91,10 +91,11 @@
public void test_getAvailableGroupIds() {
Set<String> zoneIds = ZoneRulesProvider.getAvailableZoneIds();
assertEquals(zoneIds.contains("Europe/London"), true);
- zoneIds.clear();
- assertEquals(zoneIds.size(), 0);
- Set<String> zoneIds2 = ZoneRulesProvider.getAvailableZoneIds();
- assertEquals(zoneIds2.contains("Europe/London"), true);
+ }
+
+ @Test(expectedExceptions=UnsupportedOperationException.class)
+ public void test_getAvailableGroupIds_modifyZoneId() {
+ ZoneRulesProvider.getAvailableZoneIds().clear();
}
//-----------------------------------------------------------------------
diff --git a/ojluni/src/test/java/time/test/java/time/TestClock_System.java b/ojluni/src/test/java/time/test/java/time/TestClock_System.java
index 881a760..55ef1cd 100644
--- a/ojluni/src/test/java/time/test/java/time/TestClock_System.java
+++ b/ojluni/src/test/java/time/test/java/time/TestClock_System.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -62,10 +62,14 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertSame;
+import java.lang.reflect.Field;
import java.time.Clock;
+import java.time.Instant;
import java.time.ZoneId;
+import java.time.ZoneOffset;
import org.testng.annotations.Test;
+import org.testng.annotations.DataProvider;
/**
* Test system clock.
@@ -74,6 +78,7 @@
public class TestClock_System {
private static final ZoneId PARIS = ZoneId.of("Europe/Paris");
+ private static final Clock systemUTC = Clock.systemUTC();
public void test_withZone_same() {
Clock test = Clock.system(PARIS);
@@ -87,4 +92,330 @@
assertEquals(test.toString(), "SystemClock[Europe/Paris]");
}
+ //-----------------------------------------------------------------------
+ @DataProvider(name="sampleSystemUTC")
+ Object[][] provider_sampleSystemUTC() {
+ return new Object[][] {
+ {"Clock.systemUTC()#1", Clock.systemUTC()},
+ {"Clock.systemUTC()#2", Clock.systemUTC()},
+ {"Clock.system(ZoneOffset.UTC)#1", Clock.system(ZoneOffset.UTC)},
+ {"Clock.system(ZoneOffset.UTC)#2", Clock.system(ZoneOffset.UTC)}
+ };
+ }
+
+ // Test for 8073394
+ @Test(dataProvider="sampleSystemUTC")
+ public void test_systemUTC(String s, Clock clock) {
+ if (clock != systemUTC) {
+ throw new RuntimeException("Unexpected clock instance for " + s + ": "
+ + "\n\texpected: " + toString(systemUTC)
+ + "\n\tactual: " + toString(clock));
+ }
+ }
+
+ private static String toString(Clock c) {
+ return c == null ? null :
+ c + " " + c.getClass().getName() + "@" + System.identityHashCode(c);
+ }
+
+ //-----------------------------------------------------------------------
+
+ private static String formatTime(String prefix, Instant time) {
+ return prefix + ": " + time + " - seconds: "
+ + time.getEpochSecond() + ", nanos: "
+ + time.getNano();
+ }
+
+ public void test_ClockResolution() {
+ Clock highestUTC = Clock.systemUTC();
+
+ Instant start = Instant.ofEpochMilli(System.currentTimeMillis());
+
+ try {
+ // smoke test
+ Instant system1 = Instant.ofEpochMilli(System.currentTimeMillis());
+ Instant system2 = Instant.ofEpochMilli(System.currentTimeMillis());
+ Instant highest1 = highestUTC.instant();
+ Instant highest2 = highestUTC.instant();
+ System.out.println(formatTime("\nsystemUTC #1 ", system1));
+ System.out.println(formatTime("systemUTC #2 ", system2));
+ System.out.println(formatTime("highestResolutionUTC #1 ", highest1));
+ System.out.println(formatTime("highestResolutionUTC #2 ", highest2));
+
+ if (system2.isBefore(system1)) {
+ System.err.println("system2 is before system1!");
+ System.err.println(formatTime("\n\tsystem1", system1));
+ System.err.println(formatTime("\n\tsystem2", system2));
+ throw new RuntimeException("system2 is before system1!"
+ + formatTime("\n\tsystem1", system1)
+ + formatTime("\n\tsystem2", system2));
+ }
+ if (highest2.isBefore(highest1)) {
+ System.err.println("highest2 is before highest1!");
+ System.err.println(formatTime("\n\thighest1", system1));
+ System.err.println(formatTime("\n\tsystem2", highest2));
+ throw new RuntimeException("highest2 is before system1!"
+ + formatTime("\n\thighest1", system1)
+ + formatTime("\n\tsystem2", highest2));
+ }
+
+ // better test - but depends on implementation details.
+ // we're not rounding - so highest1 should be greater or equal to
+ // system1
+ system1 = Instant.ofEpochMilli(System.currentTimeMillis());
+ highest1 = highestUTC.instant();
+
+ System.out.println(formatTime("\nsystemUTC ", system1));
+ System.out.println(formatTime("highestResolutionUTC ", highest1));
+
+ if (highest1.isBefore(system1)) {
+ System.err.println("highest1 is before system1!");
+ System.err.println(formatTime("\n\tsystem1", system1));
+ System.err.println(formatTime("\n\thighest1", highest1));
+ throw new RuntimeException("highest1 is before system1!"
+ + formatTime("\n\tsystem1", system1)
+ + formatTime("\n\thighest1", highest1));
+ }
+
+ int count=0;
+ // let's preheat the system a bit:
+ int lastNanos = 0;
+ for (int i = 0; i < 1000 ; i++) {
+ system1 = Instant.ofEpochMilli(System.currentTimeMillis());
+ final int sysnan = system1.getNano();
+ int nanos;
+ do {
+ highest1 = highestUTC.instant();
+ nanos = highest1.getNano();
+ } while (nanos == lastNanos); // Repeat to get a different value
+ lastNanos = nanos;
+
+ if ((nanos % 1000000) > 0) {
+ count++; // we have micro seconds
+ }
+ if ((sysnan % 1000000) > 0) {
+ throw new RuntimeException("Expected only millisecconds "
+ + "precision for systemUTC, found "
+ + (sysnan % 1000000) + " remainder.");
+ }
+ }
+ System.out.println("\nNumber of time stamps which had better than"
+ + " millisecond precision: "+count+"/"+1000);
+ System.out.println(formatTime("\nsystemUTC ", system1));
+ System.out.println(formatTime("highestResolutionUTC ", highest1));
+ if (count == 0) {
+ System.err.println("Something is strange: no microsecond "
+ + "precision with highestResolutionUTC?");
+ throw new RuntimeException("Micro second preccision not reached");
+ }
+
+ // check again
+ if (highest1.isBefore(system1)) {
+ System.err.println("highest1 is before system1!");
+ System.err.println(formatTime("\n\tsystem1", system1));
+ System.err.println(formatTime("\n\thighest1", highest1));
+ throw new RuntimeException("highest1 is before system1!"
+ + formatTime("\n\tsystem1", system1)
+ + formatTime("\n\thighest1", highest1));
+ }
+
+ // leap of faith: ensure that highest1 is from within 10 secs of
+ // system1
+ if (highest1.toEpochMilli() != system1.toEpochMilli()) {
+ long delta = highest1.getEpochSecond() - system1.getEpochSecond();
+ if (delta > 10) {
+ throw new RuntimeException("Unexpected long delay between two clocks ("
+ + delta + " seconds)"
+ + formatTime("\n\t system1", system1)
+ + formatTime("\n\t highest1", highest1));
+
+ }
+ } else {
+ System.out.println("You won the lottery: the two dates are within 1 millisecond!\n");
+ }
+
+ } finally {
+ Instant stop = Instant.ofEpochMilli(System.currentTimeMillis());
+ if (start.isAfter(stop)) {
+ // This should not happen - but can (un)probably be observed
+ // when switching to summer time, or if another application
+ // is switching the system date...
+ System.err.println("Cannot test - date was setback: "
+ + formatTime("\n\tstarted at", start)
+ + formatTime("\n\tstopped at", stop) + "\n");
+ return; // will prevent exceptions from being propagated.
+ }
+ }
+ }
+
+ static final long MAX_OFFSET = 0x0100000000L;
+ static final long MIN_OFFSET = -MAX_OFFSET;
+
+ // A helper class to test that SystemClock correctly recomputes
+ // its offset.
+ static class SystemClockOffset {
+
+ static final int MILLIS_IN_SECOND = 1000;
+ static final int NANOS_IN_MILLI = 1000_000;
+ static final int NANOS_IN_MICRO = 1000;
+ static final int NANOS_IN_SECOND = 1000_000_000;
+
+ static final boolean verbose = true;
+ static final Clock systemUTC = Clock.systemUTC();
+ static final Field offsetField;
+
+ static {
+ try {
+ offsetField = Class.forName("java.time.Clock$SystemClock").getDeclaredField("offset");
+ offsetField.setAccessible(true);
+ } catch (ClassNotFoundException | NoSuchFieldException ex) {
+ throw new ExceptionInInitializerError(ex);
+ }
+ }
+
+ static enum Answer {
+
+ YES, // isOffLimit = YES: we must get -1
+ NO, // isOffLimit = NO: we must not not get -1
+ MAYBE // isOffLimit = MAYBE: we might get -1 or a valid adjustment.
+ };
+
+ static long distance(long one, long two) {
+ return one > two ? Math.subtractExact(one, two)
+ : Math.subtractExact(two, one);
+ }
+
+ static Answer isOffLimits(long before, long after, long offset) {
+ long relativeDistanceBefore = distance(before, offset);
+ long relativeDistanceAfter = distance(after, offset);
+ if (relativeDistanceBefore >= MAX_OFFSET && relativeDistanceAfter >= MAX_OFFSET) {
+ return Answer.YES;
+ }
+ if (relativeDistanceBefore < MAX_OFFSET && relativeDistanceAfter < MAX_OFFSET) {
+ if (relativeDistanceBefore == 0 || relativeDistanceAfter == 0) {
+ return Answer.MAYBE; // unlucky case where
+ }
+ return Answer.NO;
+ }
+ return Answer.MAYBE;
+ }
+
+ static void testWithOffset(String name, long offset)
+ throws IllegalAccessException {
+ testWithOffset(name, offset, systemUTC);
+ }
+
+ static void testWithOffset(String name, long offset, Clock clock)
+ throws IllegalAccessException {
+ offsetField.set(clock, offset);
+ long beforeMillis = System.currentTimeMillis();
+ final Instant instant = clock.instant();
+ long afterMillis = System.currentTimeMillis();
+ long actualOffset = offsetField.getLong(clock);
+ long instantMillis = instant.getEpochSecond() * MILLIS_IN_SECOND
+ + instant.getNano() / NANOS_IN_MILLI;
+ if (instantMillis < beforeMillis || instantMillis > afterMillis) {
+ throw new RuntimeException(name
+ + ": Invalid instant: " + instant
+ + " (~" + instantMillis + "ms)"
+ + " when time in millis is in ["
+ + beforeMillis + ", " + afterMillis
+ + "] and offset in seconds is " + offset);
+ }
+ Answer isOffLimits = isOffLimits(beforeMillis / MILLIS_IN_SECOND,
+ afterMillis / MILLIS_IN_SECOND, offset);
+ switch (isOffLimits) {
+ case YES:
+ if (actualOffset == offset) {
+ throw new RuntimeException(name
+ + ": offset was offlimit but was not recomputed "
+ + " when time in millis is in ["
+ + beforeMillis + ", " + afterMillis
+ + "] and offset in seconds was " + offset);
+ }
+ break;
+ case NO:
+ if (actualOffset != offset) {
+ throw new RuntimeException(name
+ + ": offset was not offlimit but was recomputed.");
+ }
+ break;
+ default:
+ break;
+ }
+ if (distance(actualOffset, instant.getEpochSecond()) >= MAX_OFFSET) {
+ throw new RuntimeException(name + ": Actual offset is too far off:"
+ + " offset=" + actualOffset
+ + "instant.seconds=" + instant.getEpochSecond());
+ }
+ long adjustment = (instant.getEpochSecond() - actualOffset) * NANOS_IN_SECOND
+ + instant.getNano();
+ validateAdjustment(name, actualOffset, beforeMillis, afterMillis, adjustment);
+ }
+
+ static void validateAdjustment(String name, long offset, long beforeMillis,
+ long afterMillis, long adjustment) {
+ System.out.println("Validating adjustment: " + adjustment);
+ long expectedMax = distance(offset, beforeMillis / MILLIS_IN_SECOND)
+ * NANOS_IN_SECOND
+ + (beforeMillis % MILLIS_IN_SECOND) * NANOS_IN_MILLI
+ + (afterMillis - beforeMillis + 1) * NANOS_IN_MILLI;
+ long absoluteAdjustment = distance(0, adjustment);
+ if (absoluteAdjustment > expectedMax) {
+ long adjSec = absoluteAdjustment / NANOS_IN_SECOND;
+ long adjMil = (absoluteAdjustment % NANOS_IN_SECOND) / NANOS_IN_MILLI;
+ long adjMic = (absoluteAdjustment % NANOS_IN_MILLI) / NANOS_IN_MICRO;
+ long adjNan = (absoluteAdjustment % NANOS_IN_MICRO);
+ long expSec = expectedMax / NANOS_IN_SECOND;
+ long expMil = (expectedMax % NANOS_IN_SECOND) / NANOS_IN_MILLI;
+ long expMic = (expectedMax % NANOS_IN_MILLI) / NANOS_IN_MICRO;
+ long expNan = (expectedMax % NANOS_IN_MICRO);
+ System.err.println("Excessive adjustment: " + adjSec + "s, "
+ + adjMil + "ms, " + adjMic + "mics, " + adjNan + "ns");
+ System.err.println("Epected max: " + expSec + "s, "
+ + expMil + "ms, " + expMic + "mics, " + expNan + "ns");
+
+ throw new RuntimeException(name
+ + ": Excessive adjustment: " + adjustment
+ + " when time in millis is in ["
+ + beforeMillis + ", " + afterMillis
+ + "] and offset in seconds is " + offset);
+ }
+ }
+ }
+
+ public void test_OffsetRegular() throws IllegalAccessException {
+ System.out.println("*** Testing regular cases ***");
+ SystemClockOffset.testWithOffset("System.currentTimeMillis()/1000",
+ System.currentTimeMillis()/1000);
+ SystemClockOffset.testWithOffset("System.currentTimeMillis()/1000 - 1024",
+ System.currentTimeMillis()/1000 - 1024);
+ SystemClockOffset.testWithOffset("System.currentTimeMillis()/1000 + 1024",
+ System.currentTimeMillis()/1000 + 1024);
+ }
+
+ public void test_OffsetLimits() throws IllegalAccessException {
+ System.out.println("*** Testing limits ***");
+ SystemClockOffset.testWithOffset("System.currentTimeMillis()/1000 - MAX_OFFSET + 1",
+ System.currentTimeMillis()/1000 - MAX_OFFSET + 1);
+ SystemClockOffset.testWithOffset("System.currentTimeMillis()/1000 + MAX_OFFSET - 1",
+ System.currentTimeMillis()/1000 + MAX_OFFSET - 1);
+ SystemClockOffset.testWithOffset("System.currentTimeMillis()/1000 - MAX_OFFSET",
+ System.currentTimeMillis()/1000 - MAX_OFFSET);
+ SystemClockOffset.testWithOffset("System.currentTimeMillis()/1000 + MAX_OFFSET",
+ System.currentTimeMillis()/1000 + MAX_OFFSET);
+ SystemClockOffset.testWithOffset("System.currentTimeMillis()/1000 - MAX_OFFSET - 1024",
+ System.currentTimeMillis()/1000 - MAX_OFFSET - 1024);
+ SystemClockOffset.testWithOffset("System.currentTimeMillis()/1000 + MAX_OFFSET + 1024",
+ System.currentTimeMillis()/1000 + MAX_OFFSET + 1024);
+ SystemClockOffset.testWithOffset("0", 0);
+ SystemClockOffset.testWithOffset("-1", -1);
+ SystemClockOffset.testWithOffset("Integer.MAX_VALUE + System.currentTimeMillis()/1000",
+ ((long)Integer.MAX_VALUE) + System.currentTimeMillis()/1000);
+ SystemClockOffset.testWithOffset("System.currentTimeMillis()/1000 - Integer.MIN_VALUE",
+ System.currentTimeMillis()/1000 - Integer.MIN_VALUE);
+ SystemClockOffset.testWithOffset("Long.MAX_VALUE", Long.MAX_VALUE);
+ SystemClockOffset.testWithOffset("System.currentTimeMillis()/1000 - Long.MIN_VALUE",
+ (Long.MIN_VALUE + System.currentTimeMillis()/1000)*-1);
+ }
}
diff --git a/ojluni/src/test/java/time/test/java/time/TestLocalDate.java b/ojluni/src/test/java/time/test/java/time/TestLocalDate.java
index a6bd18c..91eb2a4 100644
--- a/ojluni/src/test/java/time/test/java/time/TestLocalDate.java
+++ b/ojluni/src/test/java/time/test/java/time/TestLocalDate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -67,6 +67,7 @@
import java.time.LocalDate;
import java.time.Month;
import java.time.temporal.ChronoUnit;
+import java.time.temporal.IsoFields;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
@@ -444,4 +445,40 @@
}
}
+ @DataProvider(name="quarterYearsToAdd")
+ Object[][] provider_quarterYearsToAdd() {
+ return new Object[][] {
+ {Long.valueOf(-1000000000)},
+ {Long.valueOf(-256)},
+ {Long.valueOf(-255)},
+ {Long.valueOf(-1)},
+ {Long.valueOf(0)},
+ {Long.valueOf(1)},
+ {Long.valueOf(255)},
+ {Long.valueOf(256)},
+ {Long.valueOf(1000000000)},
+ };
+ }
+
+ @Test(dataProvider="quarterYearsToAdd")
+ public void test_plus_QuarterYears(long quarterYears) {
+ LocalDate t0 = TEST_2007_07_15
+ .plus(quarterYears, IsoFields.QUARTER_YEARS);
+ LocalDate t1 = TEST_2007_07_15
+ .plus(quarterYears, ChronoUnit.MONTHS)
+ .plus(quarterYears, ChronoUnit.MONTHS)
+ .plus(quarterYears, ChronoUnit.MONTHS);
+ assertEquals(t0, t1);
+ }
+
+ @Test(dataProvider="quarterYearsToAdd")
+ public void test_minus_QuarterYears(long quarterYears) {
+ LocalDate t0 = TEST_2007_07_15
+ .minus(quarterYears, IsoFields.QUARTER_YEARS);
+ LocalDate t1 = TEST_2007_07_15
+ .minus(quarterYears, ChronoUnit.MONTHS)
+ .minus(quarterYears, ChronoUnit.MONTHS)
+ .minus(quarterYears, ChronoUnit.MONTHS);
+ assertEquals(t0, t1);
+ }
}
diff --git a/ojluni/src/test/java/time/test/java/time/chrono/TestEraDisplayName.java b/ojluni/src/test/java/time/test/java/time/chrono/TestEraDisplayName.java
new file mode 100644
index 0000000..d2d655f
--- /dev/null
+++ b/ojluni/src/test/java/time/test/java/time/chrono/TestEraDisplayName.java
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package test.java.time.chrono;
+
+import java.time.*;
+import java.time.chrono.*;
+import java.time.format.*;
+import java.util.Locale;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import static org.testng.Assert.assertEquals;
+
+/**
+ * Tests Era.getDisplayName() correctly returns the name based on each
+ * chrono implementation.
+ * Note: The exact result may depend on locale data provider's implementation.
+ *
+ * @bug 8171049
+ */
+@Test
+public class TestEraDisplayName {
+ private static final Locale THAI = Locale.forLanguageTag("th-TH");
+ private static final Locale EGYPT = Locale.forLanguageTag("ar-EG");
+
+ @DataProvider(name="eraDisplayName")
+ Object[][] eraDisplayName() {
+ return new Object[][] {
+ // Era, text style, displyay locale, expected name
+ // IsoEra
+ { IsoEra.BCE, TextStyle.FULL, Locale.US, "Before Christ" },
+ { IsoEra.CE, TextStyle.FULL, Locale.US, "Anno Domini" },
+ { IsoEra.BCE, TextStyle.FULL, Locale.JAPAN, "\u7d00\u5143\u524d" },
+ { IsoEra.CE, TextStyle.FULL, Locale.JAPAN, "\u897f\u66a6" },
+ { IsoEra.BCE, TextStyle.SHORT, Locale.US, "BC" },
+ { IsoEra.CE, TextStyle.SHORT, Locale.US, "AD" },
+ { IsoEra.BCE, TextStyle.SHORT, Locale.JAPAN, "\u7d00\u5143\u524d" },
+ { IsoEra.CE, TextStyle.SHORT, Locale.JAPAN, "\u897f\u66a6" },
+ { IsoEra.BCE, TextStyle.NARROW, Locale.US, "B" },
+ { IsoEra.CE, TextStyle.NARROW, Locale.US, "A" },
+ { IsoEra.BCE, TextStyle.NARROW, Locale.JAPAN, "BC" },
+ { IsoEra.CE, TextStyle.NARROW, Locale.JAPAN, "AD" },
+
+ // JapaneseEra
+ { JapaneseEra.MEIJI, TextStyle.FULL, Locale.US, "Meiji" },
+ // Android-changed: Android uses CLDR data.
+ // { JapaneseEra.TAISHO, TextStyle.FULL, Locale.US, "Taisho" },
+ // { JapaneseEra.SHOWA, TextStyle.FULL, Locale.US, "Showa" },
+ { JapaneseEra.TAISHO, TextStyle.FULL, Locale.US, "Taishō" },
+ { JapaneseEra.SHOWA, TextStyle.FULL, Locale.US, "Shōwa" },
+ { JapaneseEra.HEISEI, TextStyle.FULL, Locale.US, "Heisei" },
+ { JapaneseEra.MEIJI, TextStyle.FULL, Locale.JAPAN, "\u660e\u6cbb" },
+ { JapaneseEra.TAISHO, TextStyle.FULL, Locale.JAPAN, "\u5927\u6b63" },
+ { JapaneseEra.SHOWA, TextStyle.FULL, Locale.JAPAN, "\u662d\u548c" },
+ { JapaneseEra.HEISEI, TextStyle.FULL, Locale.JAPAN, "\u5e73\u6210" },
+ { JapaneseEra.MEIJI, TextStyle.SHORT, Locale.US, "Meiji" },
+ // Android-changed: Android uses CLDR data.
+ // { JapaneseEra.TAISHO, TextStyle.SHORT, Locale.US, "Taisho" },
+ // { JapaneseEra.SHOWA, TextStyle.SHORT, Locale.US, "Showa" },
+ { JapaneseEra.TAISHO, TextStyle.SHORT, Locale.US, "Taishō" },
+ { JapaneseEra.SHOWA, TextStyle.SHORT, Locale.US, "Shōwa" },
+ { JapaneseEra.HEISEI, TextStyle.SHORT, Locale.US, "Heisei" },
+ { JapaneseEra.MEIJI, TextStyle.SHORT, Locale.JAPAN, "\u660e\u6cbb" },
+ { JapaneseEra.TAISHO, TextStyle.SHORT, Locale.JAPAN, "\u5927\u6b63" },
+ { JapaneseEra.SHOWA, TextStyle.SHORT, Locale.JAPAN, "\u662d\u548c" },
+ { JapaneseEra.HEISEI, TextStyle.SHORT, Locale.JAPAN, "\u5e73\u6210" },
+ { JapaneseEra.MEIJI, TextStyle.NARROW, Locale.US, "M" },
+ { JapaneseEra.TAISHO, TextStyle.NARROW, Locale.US, "T" },
+ { JapaneseEra.SHOWA, TextStyle.NARROW, Locale.US, "S" },
+ { JapaneseEra.HEISEI, TextStyle.NARROW, Locale.US, "H" },
+ { JapaneseEra.MEIJI, TextStyle.NARROW, Locale.JAPAN, "M" },
+ { JapaneseEra.TAISHO, TextStyle.NARROW, Locale.JAPAN, "T" },
+ { JapaneseEra.SHOWA, TextStyle.NARROW, Locale.JAPAN, "S" },
+ { JapaneseEra.HEISEI, TextStyle.NARROW, Locale.JAPAN, "H" },
+
+ // ThaiBuddhistEra
+ // Android-changed: Android uses CLDR data.
+ // { ThaiBuddhistEra.BEFORE_BE, TextStyle.FULL, Locale.US, "BC" },
+ // { ThaiBuddhistEra.BE, TextStyle.FULL, Locale.US, "BE" },
+ // { ThaiBuddhistEra.BEFORE_BE, TextStyle.FULL, THAI, "BC" },
+ // { ThaiBuddhistEra.BE, TextStyle.FULL, THAI,
+ // "\u0e1e\u0e38\u0e17\u0e18\u0e28\u0e31\u0e01\u0e23\u0e32\u0e0a" },
+ // { ThaiBuddhistEra.BEFORE_BE, TextStyle.SHORT, Locale.US, "BC" },
+ // { ThaiBuddhistEra.BE, TextStyle.SHORT, Locale.US, "BE" },
+ // { ThaiBuddhistEra.BEFORE_BE, TextStyle.SHORT, THAI,
+ // "\u0e1b\u0e35\u0e01\u0e48\u0e2d\u0e19\u0e04\u0e23\u0e34\u0e2a" +
+ // "\u0e15\u0e4c\u0e01\u0e32\u0e25\u0e17\u0e35\u0e48" },
+ // { ThaiBuddhistEra.BE, TextStyle.SHORT, THAI, "\u0e1e.\u0e28." },
+ // { ThaiBuddhistEra.BEFORE_BE, TextStyle.NARROW, Locale.US, "BC" },
+ // { ThaiBuddhistEra.BE, TextStyle.NARROW, Locale.US, "BE" },
+ // { ThaiBuddhistEra.BEFORE_BE, TextStyle.NARROW, THAI, "BC" },
+ // { ThaiBuddhistEra.BE, TextStyle.NARROW, THAI, "\u0e1e.\u0e28." },
+ { ThaiBuddhistEra.BEFORE_BE, TextStyle.FULL, Locale.US, "0" },
+ { ThaiBuddhistEra.BE, TextStyle.FULL, Locale.US, "BE" },
+ { ThaiBuddhistEra.BEFORE_BE, TextStyle.FULL, THAI, "0" },
+ { ThaiBuddhistEra.BE, TextStyle.FULL, THAI,
+ "\u0e1e\u0e38\u0e17\u0e18\u0e28\u0e31\u0e01\u0e23\u0e32\u0e0a" },
+ { ThaiBuddhistEra.BEFORE_BE, TextStyle.SHORT, Locale.US, "0" },
+ { ThaiBuddhistEra.BE, TextStyle.SHORT, Locale.US, "BE" },
+ { ThaiBuddhistEra.BEFORE_BE, TextStyle.SHORT, THAI, "0" },
+ { ThaiBuddhistEra.BE, TextStyle.SHORT, THAI, "\u0e1e.\u0e28." },
+ { ThaiBuddhistEra.BEFORE_BE, TextStyle.NARROW, Locale.US, "0" },
+ { ThaiBuddhistEra.BE, TextStyle.NARROW, Locale.US, "BE" },
+ { ThaiBuddhistEra.BEFORE_BE, TextStyle.NARROW, THAI, "0" },
+ { ThaiBuddhistEra.BE, TextStyle.NARROW, THAI, "\u0e1e.\u0e28." },
+
+ // MinguoEra
+ // Android-changed: Android uses CLDR data.
+ // { MinguoEra.BEFORE_ROC, TextStyle.FULL, Locale.US, "Before R.O.C." },
+ // { MinguoEra.ROC, TextStyle.FULL, Locale.US, "Minguo" },
+ // { MinguoEra.BEFORE_ROC, TextStyle.FULL, Locale.TAIWAN, "\u6c11\u570b\u524d" },
+ // { MinguoEra.ROC, TextStyle.FULL, Locale.TAIWAN, "\u6c11\u570b" },
+ // { MinguoEra.BEFORE_ROC, TextStyle.SHORT, Locale.US, "Before R.O.C." },
+ // { MinguoEra.ROC, TextStyle.SHORT, Locale.US, "Minguo" },
+ // { MinguoEra.BEFORE_ROC, TextStyle.SHORT, Locale.TAIWAN, "\u6c11\u570b\u524d" },
+ // { MinguoEra.ROC, TextStyle.SHORT, Locale.TAIWAN, "\u6c11\u570b" },
+ // { MinguoEra.BEFORE_ROC, TextStyle.NARROW, Locale.US, "Before R.O.C." },
+ // { MinguoEra.ROC, TextStyle.NARROW, Locale.US, "Minguo" },
+ // { MinguoEra.BEFORE_ROC, TextStyle.NARROW, Locale.TAIWAN, "\u6c11\u570b\u524d" },
+ // { MinguoEra.ROC, TextStyle.NARROW, Locale.TAIWAN, "\u6c11\u570b" },
+ { MinguoEra.BEFORE_ROC, TextStyle.FULL, Locale.US, "B.R.O.C." },
+ { MinguoEra.ROC, TextStyle.FULL, Locale.US, "Minguo" },
+ { MinguoEra.BEFORE_ROC, TextStyle.FULL, Locale.TAIWAN, "\u6c11\u570b\u524d" },
+ { MinguoEra.ROC, TextStyle.FULL, Locale.TAIWAN, "\u6c11\u570b" },
+ { MinguoEra.BEFORE_ROC, TextStyle.SHORT, Locale.US, "B.R.O.C." },
+ { MinguoEra.ROC, TextStyle.SHORT, Locale.US, "Minguo" },
+ { MinguoEra.BEFORE_ROC, TextStyle.SHORT, Locale.TAIWAN, "\u6c11\u570b\u524d" },
+ { MinguoEra.ROC, TextStyle.SHORT, Locale.TAIWAN, "\u6c11\u570b" },
+ { MinguoEra.BEFORE_ROC, TextStyle.NARROW, Locale.US, "B.R.O.C." },
+ { MinguoEra.ROC, TextStyle.NARROW, Locale.US, "Minguo" },
+ { MinguoEra.BEFORE_ROC, TextStyle.NARROW, Locale.TAIWAN, "\u6c11\u570b\u524d" },
+ { MinguoEra.ROC, TextStyle.NARROW, Locale.TAIWAN, "\u6c11\u570b" },
+
+ // HijrahEra
+ { HijrahEra.AH, TextStyle.FULL, Locale.US, "AH" },
+ { HijrahEra.AH, TextStyle.FULL, EGYPT, "\u0647\u0640" },
+ { HijrahEra.AH, TextStyle.SHORT, Locale.US, "AH" },
+ { HijrahEra.AH, TextStyle.SHORT, EGYPT, "\u0647\u0640" },
+ { HijrahEra.AH, TextStyle.NARROW, Locale.US, "AH" },
+ { HijrahEra.AH, TextStyle.NARROW, EGYPT, "\u0647\u0640" },
+ };
+ }
+
+ @Test(dataProvider="eraDisplayName")
+ public void test_eraDisplayName(Era era, TextStyle style, Locale locale, String expected) {
+ assertEquals(era.getDisplayName(style, locale), expected);
+ }
+}
diff --git a/ojluni/src/test/java/time/test/java/time/chrono/TestJapaneseChronology.java b/ojluni/src/test/java/time/test/java/time/chrono/TestJapaneseChronology.java
index 7c6e25d..0d122b9 100644
--- a/ojluni/src/test/java/time/test/java/time/chrono/TestJapaneseChronology.java
+++ b/ojluni/src/test/java/time/test/java/time/chrono/TestJapaneseChronology.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
diff --git a/ojluni/src/test/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java b/ojluni/src/test/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java
index f86f144..7bd8a6d 100644
--- a/ojluni/src/test/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java
+++ b/ojluni/src/test/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java
@@ -624,7 +624,7 @@
@Test
public void test_chronoFields() {
ChronoLocalDate hdate = HijrahChronology.INSTANCE.date(1434, 6, 28);
- assertEquals(hdate.get(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH), 3);
+ assertEquals(hdate.get(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH), 7);
assertEquals(hdate.get(ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR), 7);
assertEquals(hdate.get(ChronoField.ALIGNED_WEEK_OF_MONTH), 4);
assertEquals(hdate.get(ChronoField.ALIGNED_WEEK_OF_YEAR), 25);
@@ -787,4 +787,32 @@
public void test_hijrahToJapanese(HijrahDate hijrah, String japanese) {
assertEquals(JapaneseChronology.INSTANCE.date(hijrah).toString(), japanese);
}
+
+ @DataProvider(name="alignedDayOfWeekInMonthTestDates")
+ Object[][] data_alignedDayOfWeekInMonth() {
+ return new Object[][] {
+ {1437, 9, 1, 1, 1},
+ {1437, 10, 1, 1, 1},
+ {1437, 10, 11, 2, 4},
+ {1437, 10, 29, 5, 1},
+ };
+ }
+
+ //-----------------------------------------------------------------------
+ // Test for aligned-week-of-month calculation based on the day-of-month
+ //-----------------------------------------------------------------------
+ @Test(dataProvider="alignedDayOfWeekInMonthTestDates")
+ public void test_alignedWeekOfMonth(int year, int month, int dom, int wom, int dowm) {
+ HijrahDate date = HijrahChronology.INSTANCE.date(year, month, dom);
+ assertEquals(date.getLong(ChronoField.ALIGNED_WEEK_OF_MONTH), wom);
+ }
+
+ //-----------------------------------------------------------------------
+ // Test for aligned-day-of-week calculation based on the day-of-month
+ //-----------------------------------------------------------------------
+ @Test(dataProvider="alignedDayOfWeekInMonthTestDates")
+ public void test_alignedDayOfWeekInMonth(int year, int month, int dom, int wom, int dowm) {
+ HijrahDate date = HijrahChronology.INSTANCE.date(year, month, dom);
+ assertEquals(date.getLong(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH), dowm);
+ }
}
diff --git a/ojluni/src/test/java/time/test/java/time/format/TestDateTimeFormatter.java b/ojluni/src/test/java/time/test/java/time/format/TestDateTimeFormatter.java
index 1bfa479..c9c513f 100644
--- a/ojluni/src/test/java/time/test/java/time/format/TestDateTimeFormatter.java
+++ b/ojluni/src/test/java/time/test/java/time/format/TestDateTimeFormatter.java
@@ -79,19 +79,24 @@
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
+import java.time.chrono.Chronology;
import java.time.chrono.ThaiBuddhistChronology;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.time.format.DecimalStyle;
import java.time.format.SignStyle;
+import java.time.format.TextStyle;
+import java.time.temporal.Temporal;
import java.time.temporal.TemporalAccessor;
import java.util.Locale;
import java.util.function.Function;
+import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
/**
* Test DateTimeFormatter.
+ * @bug 8085887
*/
@Test
public class TestDateTimeFormatter {
@@ -196,4 +201,75 @@
assertTrue(msg.contains("11:30:56"), msg);
}
+ @DataProvider(name="nozone_exception_cases")
+ Object[][] exceptionCases() {
+ return new Object[][] {
+ {LocalDateTime.of(2000, 1, 1, 1, 1), "z", "ZoneId"},
+ {OffsetDateTime.of(2000, 1, 1, 3, 3, 3, 0, ZoneOffset.ofTotalSeconds(60)), "z", "ZoneId"},
+ };
+ }
+
+ // Test cases that should throw an exception with a cogent message
+ // containing the Type being queried and the Temporal being queried.
+ @Test(dataProvider="nozone_exception_cases")
+ public void test_throws_message(Temporal temporal, String pattern, String queryName) {
+ DateTimeFormatter fmt = DateTimeFormatter.ofPattern(pattern);
+ try {
+ fmt.format(temporal);
+ fail("Format using \"" + pattern + "\" with " +
+ temporal + " should have failed");
+ } catch (DateTimeException dte) {
+ String msg = dte.getMessage();
+ // Verify message contains the type that is missing and the temporal value
+ assertTrue(msg.contains(queryName),
+ String.format("\"%s\" missing from %s", queryName, msg));
+ String s = temporal.toString();
+ assertTrue(msg.contains(s),
+ String.format("\"%s\" missing from %s", s, msg));
+ }
+
+ }
+
+ // Test cases that should throw an exception with a cogent message when missing the Chronology
+ @Test
+ public void test_throws_message_chrono() {
+ Chronology chrono = ThaiBuddhistChronology.INSTANCE;
+ DateTimeFormatter fmt = new DateTimeFormatterBuilder().appendZoneId().toFormatter()
+ .withChronology(chrono);
+ LocalTime now = LocalTime.now();
+ try {
+ fmt.format(now);
+ fail("Format using appendZoneId() should have failed");
+ } catch (DateTimeException dte) {
+ String msg = dte.getMessage();
+ // Verify message contains the type that is missing and the temporal value
+ assertTrue(msg.contains("ZoneId"),
+ String.format("\"%s\" missing from %s", "ZoneId", msg));
+ assertTrue(msg.contains(chrono.toString()),
+ String.format("\"%s\" missing from %s", chrono.toString(), msg));
+ }
+
+ }
+
+ // Test cases that should throw an exception with a cogent message when missing the ZoneId
+ @Test
+ public void test_throws_message_zone() {
+ ZoneId zone = ZoneId.of("Pacific/Honolulu");
+ DateTimeFormatter fmt = new DateTimeFormatterBuilder().appendChronologyId().toFormatter()
+ .withZone(zone);
+ LocalTime now = LocalTime.now();
+ try {
+ fmt.format(now);
+ fail("Format using appendChronologyId() should have failed");
+ } catch (DateTimeException dte) {
+ String msg = dte.getMessage();
+ // Verify message contains the type that is missing and the temporal value
+ assertTrue(msg.contains("Chronology"),
+ String.format("\"%s\" missing from %s", "Chronology", msg));
+ assertTrue(msg.contains(zone.toString()),
+ String.format("\"%s\" missing from %s", zone.toString(), msg));
+ }
+
+ }
+
}
diff --git a/ojluni/src/test/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java b/ojluni/src/test/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java
index fad6c81..5c62921 100644
--- a/ojluni/src/test/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java
+++ b/ojluni/src/test/java/time/test/java/time/format/TestDateTimeFormatterBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -485,8 +485,6 @@
{"HH:MM:ss"},
{"HHMMSS"},
{"HH:MM:SS"},
- {"+H"},
- {"+HMM"},
{"+HHM"},
{"+A"},
};
@@ -685,7 +683,7 @@
{"LLLLL", "Text(MonthOfYear,NARROW_STANDALONE)"},
{"D", "Value(DayOfYear)"},
- {"DD", "Value(DayOfYear,2)"},
+ {"DD", "Value(DayOfYear,2,3,NOT_NEGATIVE)"},
{"DDD", "Value(DayOfYear,3)"},
{"d", "Value(DayOfMonth)"},
@@ -747,17 +745,17 @@
{"SSS", "Fraction(NanoOfSecond,3,3)"},
{"SSSSSSSSS", "Fraction(NanoOfSecond,9,9)"},
- {"A", "Value(MilliOfDay)"},
- {"AA", "Value(MilliOfDay,2)"},
- {"AAA", "Value(MilliOfDay,3)"},
+ {"A", "Value(MilliOfDay,1,19,NOT_NEGATIVE)"},
+ {"AA", "Value(MilliOfDay,2,19,NOT_NEGATIVE)"},
+ {"AAA", "Value(MilliOfDay,3,19,NOT_NEGATIVE)"},
- {"n", "Value(NanoOfSecond)"},
- {"nn", "Value(NanoOfSecond,2)"},
- {"nnn", "Value(NanoOfSecond,3)"},
+ {"n", "Value(NanoOfSecond,1,19,NOT_NEGATIVE)"},
+ {"nn", "Value(NanoOfSecond,2,19,NOT_NEGATIVE)"},
+ {"nnn", "Value(NanoOfSecond,3,19,NOT_NEGATIVE)"},
- {"N", "Value(NanoOfDay)"},
- {"NN", "Value(NanoOfDay,2)"},
- {"NNN", "Value(NanoOfDay,3)"},
+ {"N", "Value(NanoOfDay,1,19,NOT_NEGATIVE)"},
+ {"NN", "Value(NanoOfDay,2,19,NOT_NEGATIVE)"},
+ {"NNN", "Value(NanoOfDay,3,19,NOT_NEGATIVE)"},
{"z", "ZoneText(SHORT)"},
{"zz", "ZoneText(SHORT)"},
@@ -783,7 +781,7 @@
{"xxxxx", "Offset(+HH:MM:ss,'+00:00')"}, // LDML
{"ppH", "Pad(Value(HourOfDay),2)"},
- {"pppDD", "Pad(Value(DayOfYear,2),3)"},
+ {"pppDD", "Pad(Value(DayOfYear,2,3,NOT_NEGATIVE),3)"},
{"yyyy[-MM[-dd", "Value(YearOfEra,4,19,EXCEEDS_PAD)['-'Value(MonthOfYear,2)['-'Value(DayOfMonth,2)]]"},
{"yyyy[-MM[-dd]]", "Value(YearOfEra,4,19,EXCEEDS_PAD)['-'Value(MonthOfYear,2)['-'Value(DayOfMonth,2)]]"},
@@ -883,25 +881,6 @@
}
//-----------------------------------------------------------------------
- @DataProvider(name="patternPrint")
- Object[][] data_patternPrint() {
- return new Object[][] {
- {"Q", date(2012, 2, 10), "1"},
- {"QQ", date(2012, 2, 10), "01"},
- {"QQQ", date(2012, 2, 10), "Q1"},
- {"QQQQ", date(2012, 2, 10), "1st quarter"},
- {"QQQQQ", date(2012, 2, 10), "1"},
- };
- }
-
- @Test(dataProvider="patternPrint")
- public void test_appendPattern_patternPrint(String input, Temporal temporal, String expected) throws Exception {
- DateTimeFormatter f = builder.appendPattern(input).toFormatter(Locale.UK);
- String test = f.format(temporal);
- assertEquals(test, expected);
- }
-
- //-----------------------------------------------------------------------
@DataProvider(name="localePatterns")
Object[][] localizedDateTimePatterns() {
// Android-changed: Adapt for changes since old CLDR version this tests were written for.
@@ -918,62 +897,6 @@
{null, FormatStyle.LONG, IsoChronology.INSTANCE, Locale.US, "h:mm:ss a z"},
{null, FormatStyle.MEDIUM, IsoChronology.INSTANCE, Locale.US, "h:mm:ss a"},
{null, FormatStyle.SHORT, IsoChronology.INSTANCE, Locale.US, "h:mm a"},
-
- // French Locale and ISO Chronology
- {FormatStyle.FULL, FormatStyle.FULL, IsoChronology.INSTANCE, Locale.FRENCH, "EEEE d MMMM y 'à' HH:mm:ss zzzz"},
- {FormatStyle.LONG, FormatStyle.LONG, IsoChronology.INSTANCE, Locale.FRENCH, "d MMMM y 'à' HH:mm:ss z"},
- // Android-changed: Since ICU 68, medium format uses ',' instead of 'à', to separate the date and time in French.
- // {FormatStyle.MEDIUM, FormatStyle.MEDIUM, IsoChronology.INSTANCE, Locale.FRENCH, "d MMM y 'à' HH:mm:ss"},
- {FormatStyle.MEDIUM, FormatStyle.MEDIUM, IsoChronology.INSTANCE, Locale.FRENCH, "d MMM y, HH:mm:ss"},
- {FormatStyle.SHORT, FormatStyle.SHORT, IsoChronology.INSTANCE, Locale.FRENCH, "dd/MM/y HH:mm"},
- {FormatStyle.FULL, null, IsoChronology.INSTANCE, Locale.FRENCH, "EEEE d MMMM y"},
- {FormatStyle.LONG, null, IsoChronology.INSTANCE, Locale.FRENCH, "d MMMM y"},
- {FormatStyle.MEDIUM, null, IsoChronology.INSTANCE, Locale.FRENCH, "d MMM y"},
- {FormatStyle.SHORT, null, IsoChronology.INSTANCE, Locale.FRENCH, "dd/MM/y"},
- {null, FormatStyle.FULL, IsoChronology.INSTANCE, Locale.FRENCH, "HH:mm:ss zzzz"},
- {null, FormatStyle.LONG, IsoChronology.INSTANCE, Locale.FRENCH, "HH:mm:ss z"},
- {null, FormatStyle.MEDIUM, IsoChronology.INSTANCE, Locale.FRENCH, "HH:mm:ss"},
- {null, FormatStyle.SHORT, IsoChronology.INSTANCE, Locale.FRENCH, "HH:mm"},
-
- // Japanese Locale and JapaneseChronology
- {FormatStyle.FULL, FormatStyle.FULL, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5EEEE H\u6642mm\u5206ss\u79d2 zzzz"},
- {FormatStyle.LONG, FormatStyle.LONG, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5 H:mm:ss z"},
- {FormatStyle.MEDIUM, FormatStyle.MEDIUM, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5 H:mm:ss"},
- {FormatStyle.SHORT, FormatStyle.SHORT, JapaneseChronology.INSTANCE, Locale.JAPANESE, "GGGGGy/M/d H:mm"},
- {FormatStyle.FULL, null, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5EEEE"},
- {FormatStyle.LONG, null, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5"},
- {FormatStyle.MEDIUM, null, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5"},
- {FormatStyle.SHORT, null, JapaneseChronology.INSTANCE, Locale.JAPANESE, "GGGGGy/M/d"},
- {null, FormatStyle.FULL, JapaneseChronology.INSTANCE, Locale.JAPANESE, "H\u6642mm\u5206ss\u79d2 zzzz"},
- {null, FormatStyle.LONG, JapaneseChronology.INSTANCE, Locale.JAPANESE, "H:mm:ss z"},
- {null, FormatStyle.MEDIUM, JapaneseChronology.INSTANCE, Locale.JAPANESE, "H:mm:ss"},
- {null, FormatStyle.SHORT, JapaneseChronology.INSTANCE, Locale.JAPANESE, "H:mm"},
-
- // Chinese Local and Chronology
- // Android-changed: Since ICU 70, use 24-hour time format
- // {FormatStyle.FULL, FormatStyle.FULL, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5EEEE zzzz ah:mm:ss"},
- // {FormatStyle.LONG, FormatStyle.LONG, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5 z ah:mm:ss"},
- // {FormatStyle.MEDIUM, FormatStyle.MEDIUM, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5 ah:mm:ss"},
- {FormatStyle.FULL, FormatStyle.FULL, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5EEEE zzzz HH:mm:ss"},
- {FormatStyle.LONG, FormatStyle.LONG, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5 z HH:mm:ss"},
- {FormatStyle.MEDIUM, FormatStyle.MEDIUM, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5 HH:mm:ss"},
- // Android-changed: Since ICU 68, use single 'y' to represent year in short form like other format styles
- // {FormatStyle.SHORT, FormatStyle.SHORT, MinguoChronology.INSTANCE, Locale.CHINESE, "Gyy/M/d ah:mm"},
- {FormatStyle.SHORT, FormatStyle.SHORT, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy/M/d HH:mm"},
- {FormatStyle.FULL, null, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5EEEE"},
- {FormatStyle.LONG, null, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5"},
- {FormatStyle.MEDIUM, null, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5"},
- // Android-changed: Since ICU 68, use single 'y' to represent year in short form like other format styles
- // {FormatStyle.SHORT, null, MinguoChronology.INSTANCE, Locale.CHINESE, "Gyy/M/d"},
- // {null, FormatStyle.FULL, MinguoChronology.INSTANCE, Locale.CHINESE, "zzzz ah:mm:ss"},
- // {null, FormatStyle.LONG, MinguoChronology.INSTANCE, Locale.CHINESE, "z ah:mm:ss"},
- // {null, FormatStyle.MEDIUM, MinguoChronology.INSTANCE, Locale.CHINESE, "ah:mm:ss"},
- // {null, FormatStyle.SHORT, MinguoChronology.INSTANCE, Locale.CHINESE, "ah:mm"},
- {FormatStyle.SHORT, null, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy/M/d"},
- {null, FormatStyle.FULL, MinguoChronology.INSTANCE, Locale.CHINESE, "zzzz HH:mm:ss"},
- {null, FormatStyle.LONG, MinguoChronology.INSTANCE, Locale.CHINESE, "z HH:mm:ss"},
- {null, FormatStyle.MEDIUM, MinguoChronology.INSTANCE, Locale.CHINESE, "HH:mm:ss"},
- {null, FormatStyle.SHORT, MinguoChronology.INSTANCE, Locale.CHINESE, "HH:mm"},
};
}
@@ -1026,5 +949,4 @@
private static Temporal date(int y, int m, int d) {
return LocalDate.of(y, m, d);
}
-
}
diff --git a/ojluni/src/test/java/time/test/java/time/format/TestDateTimeFormatterBuilderWithLocale.java b/ojluni/src/test/java/time/test/java/time/format/TestDateTimeFormatterBuilderWithLocale.java
new file mode 100644
index 0000000..ee14792
--- /dev/null
+++ b/ojluni/src/test/java/time/test/java/time/format/TestDateTimeFormatterBuilderWithLocale.java
@@ -0,0 +1,250 @@
+/*
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2009-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of JSR-310 nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * @test
+ * @modules jdk.localedata
+ */
+package test.java.time.format;
+
+import java.time.chrono.ChronoLocalDate;
+import java.time.chrono.Chronology;
+import java.time.chrono.IsoChronology;
+import java.time.chrono.JapaneseChronology;
+import java.time.chrono.JapaneseEra;
+import java.time.chrono.MinguoChronology;
+import java.time.chrono.ThaiBuddhistChronology;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.FormatStyle;
+import java.time.format.ResolverStyle;
+import java.time.LocalDate;
+import java.time.temporal.ChronoField;
+import java.time.temporal.Temporal;
+import java.time.temporal.TemporalAccessor;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import static org.testng.Assert.assertEquals;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * Test DateTimeFormatterBuilder.
+ */
+@Test
+public class TestDateTimeFormatterBuilderWithLocale {
+
+ private DateTimeFormatterBuilder builder;
+
+ @BeforeMethod
+ public void setUp() {
+ builder = new DateTimeFormatterBuilder();
+ }
+
+ //-----------------------------------------------------------------------
+ @DataProvider(name="patternPrint")
+ Object[][] data_patternPrint() {
+ return new Object[][] {
+ {"Q", date(2012, 2, 10), "1"},
+ {"QQ", date(2012, 2, 10), "01"},
+ {"QQQ", date(2012, 2, 10), "Q1"},
+ {"QQQQ", date(2012, 2, 10), "1st quarter"},
+ {"QQQQQ", date(2012, 2, 10), "1"},
+ };
+ }
+
+ @Test(dataProvider="patternPrint")
+ public void test_appendPattern_patternPrint(String input, Temporal temporal, String expected) throws Exception {
+ DateTimeFormatter f = builder.appendPattern(input).toFormatter(Locale.UK);
+ String test = f.format(temporal);
+ assertEquals(test, expected);
+ }
+
+ //-----------------------------------------------------------------------
+ @DataProvider(name="mapTextLookup")
+ Object[][] data_mapTextLookup() {
+ return new Object[][] {
+ {IsoChronology.INSTANCE.date(1, 1, 1), Locale.ENGLISH},
+ {JapaneseChronology.INSTANCE.date(JapaneseEra.HEISEI, 1, 1, 8), Locale.ENGLISH},
+ {MinguoChronology.INSTANCE.date(1, 1, 1), Locale.ENGLISH},
+ {ThaiBuddhistChronology.INSTANCE.date(1, 1, 1), Locale.ENGLISH},
+ };
+ }
+
+ @Test(dataProvider="mapTextLookup")
+ public void test_appendText_mapTextLookup(ChronoLocalDate date, Locale locale) {
+ final String firstYear = "firstYear";
+ final String firstMonth = "firstMonth";
+ final String firstYearMonth = firstYear + firstMonth;
+ final long first = 1L;
+
+ DateTimeFormatter formatter = builder
+ .appendText(ChronoField.YEAR_OF_ERA, Map.of(first, firstYear))
+ .appendText(ChronoField.MONTH_OF_YEAR, Map.of(first, firstMonth))
+ .toFormatter(locale)
+ .withResolverStyle(ResolverStyle.STRICT);
+
+ assertEquals(date.format(formatter), firstYearMonth);
+
+ TemporalAccessor ta = formatter.parse(firstYearMonth);
+ assertEquals(ta.getLong(ChronoField.YEAR_OF_ERA), first);
+ assertEquals(ta.getLong(ChronoField.MONTH_OF_YEAR), first);
+ }
+
+
+ //-----------------------------------------------------------------------
+ @DataProvider(name="localePatterns")
+ Object[][] localizedDateTimePatterns() {
+ // Android-changed: Adapt for changes since old CLDR version this tests were written for.
+ return new Object[][] {
+ // French Locale and ISO Chronology
+ {FormatStyle.FULL, FormatStyle.FULL, IsoChronology.INSTANCE, Locale.FRENCH, "EEEE d MMMM y '\u00e0' HH:mm:ss zzzz"},
+ {FormatStyle.LONG, FormatStyle.LONG, IsoChronology.INSTANCE, Locale.FRENCH, "d MMMM y '\u00e0' HH:mm:ss z"},
+ // Android-changed: Since ICU 68, medium format uses ',' instead of '\u00e0', to separate the date and time in French.
+ // {FormatStyle.MEDIUM, FormatStyle.MEDIUM, IsoChronology.INSTANCE, Locale.FRENCH, "d MMM y '\u00e0' HH:mm:ss"},
+ {FormatStyle.MEDIUM, FormatStyle.MEDIUM, IsoChronology.INSTANCE, Locale.FRENCH, "d MMM y, HH:mm:ss"},
+ {FormatStyle.SHORT, FormatStyle.SHORT, IsoChronology.INSTANCE, Locale.FRENCH, "dd/MM/y HH:mm"},
+ {FormatStyle.FULL, null, IsoChronology.INSTANCE, Locale.FRENCH, "EEEE d MMMM y"},
+ {FormatStyle.LONG, null, IsoChronology.INSTANCE, Locale.FRENCH, "d MMMM y"},
+ {FormatStyle.MEDIUM, null, IsoChronology.INSTANCE, Locale.FRENCH, "d MMM y"},
+ {FormatStyle.SHORT, null, IsoChronology.INSTANCE, Locale.FRENCH, "dd/MM/y"},
+ {null, FormatStyle.FULL, IsoChronology.INSTANCE, Locale.FRENCH, "HH:mm:ss zzzz"},
+ {null, FormatStyle.LONG, IsoChronology.INSTANCE, Locale.FRENCH, "HH:mm:ss z"},
+ {null, FormatStyle.MEDIUM, IsoChronology.INSTANCE, Locale.FRENCH, "HH:mm:ss"},
+ {null, FormatStyle.SHORT, IsoChronology.INSTANCE, Locale.FRENCH, "HH:mm"},
+
+ // Japanese Locale and JapaneseChronology
+ {FormatStyle.FULL, FormatStyle.FULL, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5EEEE H\u6642mm\u5206ss\u79d2 zzzz"},
+ {FormatStyle.LONG, FormatStyle.LONG, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5 H:mm:ss z"},
+ {FormatStyle.MEDIUM, FormatStyle.MEDIUM, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5 H:mm:ss"},
+ {FormatStyle.SHORT, FormatStyle.SHORT, JapaneseChronology.INSTANCE, Locale.JAPANESE, "GGGGGy/M/d H:mm"},
+ {FormatStyle.FULL, null, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5EEEE"},
+ {FormatStyle.LONG, null, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5"},
+ {FormatStyle.MEDIUM, null, JapaneseChronology.INSTANCE, Locale.JAPANESE, "Gy\u5e74M\u6708d\u65e5"},
+ {FormatStyle.SHORT, null, JapaneseChronology.INSTANCE, Locale.JAPANESE, "GGGGGy/M/d"},
+ {null, FormatStyle.FULL, JapaneseChronology.INSTANCE, Locale.JAPANESE, "H\u6642mm\u5206ss\u79d2 zzzz"},
+ {null, FormatStyle.LONG, JapaneseChronology.INSTANCE, Locale.JAPANESE, "H:mm:ss z"},
+ {null, FormatStyle.MEDIUM, JapaneseChronology.INSTANCE, Locale.JAPANESE, "H:mm:ss"},
+ {null, FormatStyle.SHORT, JapaneseChronology.INSTANCE, Locale.JAPANESE, "H:mm"},
+
+ // Chinese Local and Chronology
+ // Android-changed: Since ICU 70, use 24-hour time format
+ // {FormatStyle.FULL, FormatStyle.FULL, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5EEEE zzzz ah:mm:ss"},
+ // {FormatStyle.LONG, FormatStyle.LONG, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5 z ah:mm:ss"},
+ // {FormatStyle.MEDIUM, FormatStyle.MEDIUM, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5 ah:mm:ss"},
+ {FormatStyle.FULL, FormatStyle.FULL, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5EEEE zzzz HH:mm:ss"},
+ {FormatStyle.LONG, FormatStyle.LONG, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5 z HH:mm:ss"},
+ {FormatStyle.MEDIUM, FormatStyle.MEDIUM, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5 HH:mm:ss"},
+ // Android-changed: Since ICU 68, use single 'y' to represent year in short form like other format styles
+ // {FormatStyle.SHORT, FormatStyle.SHORT, MinguoChronology.INSTANCE, Locale.CHINESE, "Gyy/M/d ah:mm"},
+ {FormatStyle.SHORT, FormatStyle.SHORT, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy/M/d HH:mm"},
+ {FormatStyle.FULL, null, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5EEEE"},
+ {FormatStyle.LONG, null, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5"},
+ {FormatStyle.MEDIUM, null, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy\u5e74M\u6708d\u65e5"},
+ // Android-changed: Since ICU 68, use single 'y' to represent year in short form like other format styles
+ // {FormatStyle.SHORT, null, MinguoChronology.INSTANCE, Locale.CHINESE, "Gyy/M/d"},
+ // {null, FormatStyle.FULL, MinguoChronology.INSTANCE, Locale.CHINESE, "zzzz ah:mm:ss"},
+ // {null, FormatStyle.LONG, MinguoChronology.INSTANCE, Locale.CHINESE, "z ah:mm:ss"},
+ // {null, FormatStyle.MEDIUM, MinguoChronology.INSTANCE, Locale.CHINESE, "ah:mm:ss"},
+ // {null, FormatStyle.SHORT, MinguoChronology.INSTANCE, Locale.CHINESE, "ah:mm"},
+ {FormatStyle.SHORT, null, MinguoChronology.INSTANCE, Locale.CHINESE, "Gy/M/d"},
+ {null, FormatStyle.FULL, MinguoChronology.INSTANCE, Locale.CHINESE, "zzzz HH:mm:ss"},
+ {null, FormatStyle.LONG, MinguoChronology.INSTANCE, Locale.CHINESE, "z HH:mm:ss"},
+ {null, FormatStyle.MEDIUM, MinguoChronology.INSTANCE, Locale.CHINESE, "HH:mm:ss"},
+ {null, FormatStyle.SHORT, MinguoChronology.INSTANCE, Locale.CHINESE, "HH:mm"},
+ };
+ }
+
+ @Test(dataProvider="localePatterns")
+ public void test_getLocalizedDateTimePattern(FormatStyle dateStyle, FormatStyle timeStyle,
+ Chronology chrono, Locale locale, String expected) {
+ String actual = DateTimeFormatterBuilder.getLocalizedDateTimePattern(dateStyle, timeStyle, chrono, locale);
+ assertEquals(actual, expected, "Pattern " + convertNonAscii(actual));
+ }
+
+ /**
+ * Returns a string that includes non-ascii characters after expanding
+ * the non-ascii characters to their Java language \\uxxxx form.
+ * @param input an input string
+ * @return the encoded string.
+ */
+ private String convertNonAscii(String input) {
+ StringBuilder sb = new StringBuilder(input.length() * 6);
+ for (int i = 0; i < input.length(); i++) {
+ char ch = input.charAt(i);
+ if (ch < 255) {
+ sb.append(ch);
+ } else {
+ sb.append("\\u");
+ sb.append(Integer.toHexString(ch));
+ }
+ }
+ return sb.toString();
+ }
+
+ private static Temporal date(int y, int m, int d) {
+ return LocalDate.of(y, m, d);
+ }
+}
diff --git a/ojluni/src/test/java/time/test/java/time/format/TestDateTimeTextProvider.java b/ojluni/src/test/java/time/test/java/time/format/TestDateTimeTextProvider.java
index 76296df..da4a276 100644
--- a/ojluni/src/test/java/time/test/java/time/format/TestDateTimeTextProvider.java
+++ b/ojluni/src/test/java/time/test/java/time/format/TestDateTimeTextProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -80,7 +80,6 @@
public class TestDateTimeTextProvider extends AbstractTestPrinterParser {
Locale enUS = new Locale("en", "US");
- Locale ptBR = new Locale("pt", "BR");
//-----------------------------------------------------------------------
@DataProvider(name = "Text")
@@ -94,15 +93,6 @@
{DAY_OF_WEEK, 6, TextStyle.SHORT, enUS, "Sat"},
{DAY_OF_WEEK, 7, TextStyle.SHORT, enUS, "Sun"},
- // Android-changed: upstream tests expect title case names for pt_BR, but CLDR has lower with dot
- {DAY_OF_WEEK, 1, TextStyle.SHORT, ptBR, "seg."},
- {DAY_OF_WEEK, 2, TextStyle.SHORT, ptBR, "ter."},
- {DAY_OF_WEEK, 3, TextStyle.SHORT, ptBR, "qua."},
- {DAY_OF_WEEK, 4, TextStyle.SHORT, ptBR, "qui."},
- {DAY_OF_WEEK, 5, TextStyle.SHORT, ptBR, "sex."},
- {DAY_OF_WEEK, 6, TextStyle.SHORT, ptBR, "s\u00E1b."},
- {DAY_OF_WEEK, 7, TextStyle.SHORT, ptBR, "dom."},
-
{DAY_OF_WEEK, 1, TextStyle.FULL, enUS, "Monday"},
{DAY_OF_WEEK, 2, TextStyle.FULL, enUS, "Tuesday"},
{DAY_OF_WEEK, 3, TextStyle.FULL, enUS, "Wednesday"},
@@ -111,15 +101,6 @@
{DAY_OF_WEEK, 6, TextStyle.FULL, enUS, "Saturday"},
{DAY_OF_WEEK, 7, TextStyle.FULL, enUS, "Sunday"},
- // Android-changed: upstream tests expect title case names for pt_BR, but CLDR has lower
- {DAY_OF_WEEK, 1, TextStyle.FULL, ptBR, "segunda-feira"},
- {DAY_OF_WEEK, 2, TextStyle.FULL, ptBR, "ter\u00E7a-feira"},
- {DAY_OF_WEEK, 3, TextStyle.FULL, ptBR, "quarta-feira"},
- {DAY_OF_WEEK, 4, TextStyle.FULL, ptBR, "quinta-feira"},
- {DAY_OF_WEEK, 5, TextStyle.FULL, ptBR, "sexta-feira"},
- {DAY_OF_WEEK, 6, TextStyle.FULL, ptBR, "s\u00E1bado"},
- {DAY_OF_WEEK, 7, TextStyle.FULL, ptBR, "domingo"},
-
{MONTH_OF_YEAR, 1, TextStyle.SHORT, enUS, "Jan"},
{MONTH_OF_YEAR, 2, TextStyle.SHORT, enUS, "Feb"},
{MONTH_OF_YEAR, 3, TextStyle.SHORT, enUS, "Mar"},
@@ -133,20 +114,6 @@
{MONTH_OF_YEAR, 11, TextStyle.SHORT, enUS, "Nov"},
{MONTH_OF_YEAR, 12, TextStyle.SHORT, enUS, "Dec"},
- // Android-changed: upstream tests expect title case names for pt_BR, but CLDR has lower with dot
- {MONTH_OF_YEAR, 1, TextStyle.SHORT, ptBR, "jan."},
- {MONTH_OF_YEAR, 2, TextStyle.SHORT, ptBR, "fev."},
- {MONTH_OF_YEAR, 3, TextStyle.SHORT, ptBR, "mar."},
- {MONTH_OF_YEAR, 4, TextStyle.SHORT, ptBR, "abr."},
- {MONTH_OF_YEAR, 5, TextStyle.SHORT, ptBR, "mai."},
- {MONTH_OF_YEAR, 6, TextStyle.SHORT, ptBR, "jun."},
- {MONTH_OF_YEAR, 7, TextStyle.SHORT, ptBR, "jul."},
- {MONTH_OF_YEAR, 8, TextStyle.SHORT, ptBR, "ago."},
- {MONTH_OF_YEAR, 9, TextStyle.SHORT, ptBR, "set."},
- {MONTH_OF_YEAR, 10, TextStyle.SHORT, ptBR, "out."},
- {MONTH_OF_YEAR, 11, TextStyle.SHORT, ptBR, "nov."},
- {MONTH_OF_YEAR, 12, TextStyle.SHORT, ptBR, "dez."},
-
{MONTH_OF_YEAR, 1, TextStyle.FULL, enUS, "January"},
{MONTH_OF_YEAR, 2, TextStyle.FULL, enUS, "February"},
{MONTH_OF_YEAR, 3, TextStyle.FULL, enUS, "March"},
@@ -160,20 +127,6 @@
{MONTH_OF_YEAR, 11, TextStyle.FULL, enUS, "November"},
{MONTH_OF_YEAR, 12, TextStyle.FULL, enUS, "December"},
- // Android-changed: upstream tests expect title case names for pt_BR, but CLDR has lower
- {MONTH_OF_YEAR, 1, TextStyle.FULL, ptBR, "janeiro"},
- {MONTH_OF_YEAR, 2, TextStyle.FULL, ptBR, "fevereiro"},
- {MONTH_OF_YEAR, 3, TextStyle.FULL, ptBR, "mar\u00E7o"},
- {MONTH_OF_YEAR, 4, TextStyle.FULL, ptBR, "abril"},
- {MONTH_OF_YEAR, 5, TextStyle.FULL, ptBR, "maio"},
- {MONTH_OF_YEAR, 6, TextStyle.FULL, ptBR, "junho"},
- {MONTH_OF_YEAR, 7, TextStyle.FULL, ptBR, "julho"},
- {MONTH_OF_YEAR, 8, TextStyle.FULL, ptBR, "agosto"},
- {MONTH_OF_YEAR, 9, TextStyle.FULL, ptBR, "setembro"},
- {MONTH_OF_YEAR, 10, TextStyle.FULL, ptBR, "outubro"},
- {MONTH_OF_YEAR, 11, TextStyle.FULL, ptBR, "novembro"},
- {MONTH_OF_YEAR, 12, TextStyle.FULL, ptBR, "dezembro"},
-
{AMPM_OF_DAY, 0, TextStyle.SHORT, enUS, "AM"},
{AMPM_OF_DAY, 1, TextStyle.SHORT, enUS, "PM"},
diff --git a/ojluni/src/test/java/time/test/java/time/format/TestDateTimeTextProviderWithLocale.java b/ojluni/src/test/java/time/test/java/time/format/TestDateTimeTextProviderWithLocale.java
new file mode 100644
index 0000000..7c90357
--- /dev/null
+++ b/ojluni/src/test/java/time/test/java/time/format/TestDateTimeTextProviderWithLocale.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2011-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of JSR-310 nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * @test
+ * @modules jdk.localedata
+ */
+
+package test.java.time.format;
+
+import static java.time.temporal.ChronoField.AMPM_OF_DAY;
+import static java.time.temporal.ChronoField.DAY_OF_WEEK;
+import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
+import static org.testng.Assert.assertEquals;
+
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.format.TextStyle;
+import java.time.temporal.TemporalField;
+import java.util.Locale;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * Test SimpleDateTimeTextProviderWithLocale.
+ */
+@Test
+public class TestDateTimeTextProviderWithLocale extends AbstractTestPrinterParser {
+
+ Locale enUS = new Locale("en", "US");
+ Locale ptBR = new Locale("pt", "BR");
+
+ //-----------------------------------------------------------------------
+ @DataProvider(name = "Text")
+ Object[][] data_text() {
+ return new Object[][] {
+ // Android-changed: upstream tests expect title case names for pt_BR, but CLDR has lower with dot
+ // {DAY_OF_WEEK, 1, TextStyle.SHORT, ptBR, "seg"},
+ // {DAY_OF_WEEK, 2, TextStyle.SHORT, ptBR, "ter"},
+ // {DAY_OF_WEEK, 3, TextStyle.SHORT, ptBR, "qua"},
+ // {DAY_OF_WEEK, 4, TextStyle.SHORT, ptBR, "qui"},
+ // {DAY_OF_WEEK, 5, TextStyle.SHORT, ptBR, "sex"},
+ // {DAY_OF_WEEK, 6, TextStyle.SHORT, ptBR, "s\u00E1b"},
+ // {DAY_OF_WEEK, 7, TextStyle.SHORT, ptBR, "dom"},
+ {DAY_OF_WEEK, 1, TextStyle.SHORT, ptBR, "seg."},
+ {DAY_OF_WEEK, 2, TextStyle.SHORT, ptBR, "ter."},
+ {DAY_OF_WEEK, 3, TextStyle.SHORT, ptBR, "qua."},
+ {DAY_OF_WEEK, 4, TextStyle.SHORT, ptBR, "qui."},
+ {DAY_OF_WEEK, 5, TextStyle.SHORT, ptBR, "sex."},
+ {DAY_OF_WEEK, 6, TextStyle.SHORT, ptBR, "s\u00E1b."},
+ {DAY_OF_WEEK, 7, TextStyle.SHORT, ptBR, "dom."},
+
+ {DAY_OF_WEEK, 1, TextStyle.FULL, ptBR, "segunda-feira"},
+ {DAY_OF_WEEK, 2, TextStyle.FULL, ptBR, "ter\u00E7a-feira"},
+ {DAY_OF_WEEK, 3, TextStyle.FULL, ptBR, "quarta-feira"},
+ {DAY_OF_WEEK, 4, TextStyle.FULL, ptBR, "quinta-feira"},
+ {DAY_OF_WEEK, 5, TextStyle.FULL, ptBR, "sexta-feira"},
+ {DAY_OF_WEEK, 6, TextStyle.FULL, ptBR, "s\u00E1bado"},
+ {DAY_OF_WEEK, 7, TextStyle.FULL, ptBR, "domingo"},
+
+ // Android-changed: upstream tests expect title case names for pt_BR, but CLDR has lower with dot
+ // {MONTH_OF_YEAR, 1, TextStyle.SHORT, ptBR, "jan"},
+ // {MONTH_OF_YEAR, 2, TextStyle.SHORT, ptBR, "fev"},
+ // {MONTH_OF_YEAR, 3, TextStyle.SHORT, ptBR, "mar"},
+ // {MONTH_OF_YEAR, 4, TextStyle.SHORT, ptBR, "abr"},
+ // {MONTH_OF_YEAR, 5, TextStyle.SHORT, ptBR, "mai"},
+ // {MONTH_OF_YEAR, 6, TextStyle.SHORT, ptBR, "jun"},
+ // {MONTH_OF_YEAR, 7, TextStyle.SHORT, ptBR, "jul"},
+ // {MONTH_OF_YEAR, 8, TextStyle.SHORT, ptBR, "ago"},
+ // {MONTH_OF_YEAR, 9, TextStyle.SHORT, ptBR, "set"},
+ // {MONTH_OF_YEAR, 10, TextStyle.SHORT, ptBR, "out"},
+ // {MONTH_OF_YEAR, 11, TextStyle.SHORT, ptBR, "nov"},
+ // {MONTH_OF_YEAR, 12, TextStyle.SHORT, ptBR, "dez"},
+ {MONTH_OF_YEAR, 1, TextStyle.SHORT, ptBR, "jan."},
+ {MONTH_OF_YEAR, 2, TextStyle.SHORT, ptBR, "fev."},
+ {MONTH_OF_YEAR, 3, TextStyle.SHORT, ptBR, "mar."},
+ {MONTH_OF_YEAR, 4, TextStyle.SHORT, ptBR, "abr."},
+ {MONTH_OF_YEAR, 5, TextStyle.SHORT, ptBR, "mai."},
+ {MONTH_OF_YEAR, 6, TextStyle.SHORT, ptBR, "jun."},
+ {MONTH_OF_YEAR, 7, TextStyle.SHORT, ptBR, "jul."},
+ {MONTH_OF_YEAR, 8, TextStyle.SHORT, ptBR, "ago."},
+ {MONTH_OF_YEAR, 9, TextStyle.SHORT, ptBR, "set."},
+ {MONTH_OF_YEAR, 10, TextStyle.SHORT, ptBR, "out."},
+ {MONTH_OF_YEAR, 11, TextStyle.SHORT, ptBR, "nov."},
+ {MONTH_OF_YEAR, 12, TextStyle.SHORT, ptBR, "dez."},
+
+ {MONTH_OF_YEAR, 1, TextStyle.FULL, ptBR, "janeiro"},
+ {MONTH_OF_YEAR, 2, TextStyle.FULL, ptBR, "fevereiro"},
+ {MONTH_OF_YEAR, 3, TextStyle.FULL, ptBR, "mar\u00E7o"},
+ {MONTH_OF_YEAR, 4, TextStyle.FULL, ptBR, "abril"},
+ {MONTH_OF_YEAR, 5, TextStyle.FULL, ptBR, "maio"},
+ {MONTH_OF_YEAR, 6, TextStyle.FULL, ptBR, "junho"},
+ {MONTH_OF_YEAR, 7, TextStyle.FULL, ptBR, "julho"},
+ {MONTH_OF_YEAR, 8, TextStyle.FULL, ptBR, "agosto"},
+ {MONTH_OF_YEAR, 9, TextStyle.FULL, ptBR, "setembro"},
+ {MONTH_OF_YEAR, 10, TextStyle.FULL, ptBR, "outubro"},
+ {MONTH_OF_YEAR, 11, TextStyle.FULL, ptBR, "novembro"},
+ {MONTH_OF_YEAR, 12, TextStyle.FULL, ptBR, "dezembro"},
+
+ };
+ }
+
+ @Test(dataProvider = "Text")
+ public void test_getText(TemporalField field, Number value, TextStyle style, Locale locale, String expected) {
+ DateTimeFormatter fmt = getFormatter(field, style).withLocale(locale);
+ assertEquals(fmt.format(ZonedDateTime.now().with(field, value.longValue())), expected);
+ }
+
+}
diff --git a/ojluni/src/test/java/time/test/java/time/format/TestNarrowMonthNamesAndDayNames.java b/ojluni/src/test/java/time/test/java/time/format/TestNarrowMonthNamesAndDayNames.java
new file mode 100644
index 0000000..07eb6f6
--- /dev/null
+++ b/ojluni/src/test/java/time/test/java/time/format/TestNarrowMonthNamesAndDayNames.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * @test
+ * @modules jdk.localedata
+ * @bug 8146750
+ * @summary Test Narrow and NarrowStandalone month names are retrieved correctly.
+ */
+package test.java.time.format;
+
+import static org.testng.Assert.assertEquals;
+
+import java.time.DayOfWeek;
+import java.time.Month;
+import java.time.format.TextStyle;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+public class TestNarrowMonthNamesAndDayNames {
+
+ static {
+ System.setProperty("java.locale.providers", "COMPAT");
+ }
+
+ private static final List<Month> MONTHVALUES = Arrays.asList(Month.values());
+ private static final List<DayOfWeek> DAYVALUES = Arrays.asList(DayOfWeek.values());
+ private static final List<TextStyle> TEXTSTYLELIST = Arrays.asList(TextStyle.NARROW,
+ TextStyle.NARROW_STANDALONE);
+ private static final List<Locale> LOCARR = Arrays.asList(Locale.US,
+ Locale.GERMANY,
+ Locale.FRANCE,
+ new Locale("no", "NO"));
+
+ /**
+ * Locale en_US, de_DE, fr_FR, no_NO will have same Narrow and
+ * Narrow_Standalone month Names for COMPAT Provider.
+ */
+ @DataProvider(name = "MonthNarrows")
+ public Object[][] monthNameData() {
+ return new Object[][]{{new String[]{
+ "J",
+ "F",
+ "M",
+ "A",
+ "M",
+ "J",
+ "J",
+ "A",
+ "S",
+ "O",
+ "N",
+ "D"
+ }},};
+ }
+
+ //-----------------------------------------------------------------------
+ // Check Narrow and Narrow_standalone month name values
+ //-----------------------------------------------------------------------
+ @Test(dataProvider = "MonthNarrows")
+ public void compareMonthNarrowValues(String[] monthNarrowExpected) {
+ LOCARR.forEach((loc) -> {
+ TEXTSTYLELIST.forEach((style) -> {
+ MONTHVALUES.forEach((value) -> {
+ String result = value.getDisplayName(style, loc);
+ int index = value.ordinal();
+ assertEquals(result, monthNarrowExpected[index], "Test failed"
+ + " for COMPAT Provider for locale "
+ + loc + " for style " + style.name()
+ + " with Month value " + value.name());
+ });
+ });
+ });
+ }
+
+ /**
+ * Locale en_US, de_DE, fr_FR, no_NO will have different Narrow and
+ * Narrow_Standalone Day Names for COMPAT Provider.
+ */
+ @DataProvider(name = "DayNarrows")
+ public Object[][] dayNameData() {
+ return new Object[][]{
+ {Locale.US, new String[]{"M", "T", "W", "T", "F", "S", "S"}},
+ {Locale.GERMANY, new String[]{"M", "D", "M", "D", "F", "S", "S"}},
+ {Locale.FRANCE, new String[]{"L", "M", "M", "J", "V", "S", "D"}},
+ {new Locale("no", "NO"), new String[]{"M", "T", "O", "T", "F", "L", "S"}},};
+ }
+
+ //-----------------------------------------------------------------------
+ // Check Narrow and Narrow_standalone Day name values
+ //-----------------------------------------------------------------------
+ @Test(dataProvider = "DayNarrows")
+ public void compareDayNarrowValues(Locale locale, String[] dayNarrowExpected) {
+ TEXTSTYLELIST.forEach((style) -> {
+ DAYVALUES.forEach((value) -> {
+ String result = value.getDisplayName(style, locale);
+ int index = value.ordinal();
+ assertEquals(result, dayNarrowExpected[index], "Test failed"
+ + " for COMPAT Provider for locale "
+ + locale + " for style " + style.name()
+ + " with Day value " + value.name());
+ });
+ });
+ }
+}
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 310f008..95b4a6b 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
@@ -25,6 +25,7 @@
*
* @test
* @bug 8206120
+ * @modules jdk.localedata
*/
package test.java.time.format;
@@ -85,14 +86,9 @@
// Chronology, Format Locale, Numbering Locale, ChronoLocalDate, expected string
{ JAPANESE, Locale.JAPANESE, Locale.JAPANESE, JAPANESE.date(IsoDate),
"\u5e73\u621025\u5e742\u670811\u65e5\u6708\u66dc\u65e5" }, // Japanese Heisei 25-02-11
- // Android-changed: requesting arabic numbering actually produces arabic digits. Also
- // new CLDR patterns include the era. Test Arabic locale with ASCII digits below.
{ HIJRAH, ARABIC, ARABIC, HIJRAH.date(IsoDate),
"\u0627\u0644\u0627\u062b\u0646\u064a\u0646\u060c \u0661 \u0631\u0628\u064a\u0639 "
+ "\u0627\u0644\u0622\u062e\u0631 \u0661\u0664\u0663\u0664 \u0647\u0640" }, // Hijrah AH 1434-04-01 (Mon)
- { HIJRAH, ARABIC, Locale.ENGLISH, HIJRAH.date(IsoDate),
- "\u0627\u0644\u0627\u062b\u0646\u064a\u0646\u060c 1 \u0631\u0628\u064a\u0639 "
- + "\u0627\u0644\u0622\u062e\u0631 1434 \u0647\u0640" }, // Hijrah AH 1434-04-01 (Mon)
{ MINGUO, Locale.TAIWAN, Locale.TAIWAN, MINGUO.date(IsoDate),
"\u6c11\u570b102\u5e742\u670811\u65e5 \u661f\u671f\u4e00" }, // Minguo ROC 102-02-11 (Mon)
{ BUDDHIST, thTH, thTH, BUDDHIST.date(IsoDate),
@@ -138,7 +134,7 @@
{ HIJRAH, ARABIC, "\u0627\u0644\u062a\u0642\u0648\u064a\u0645 "
+ "\u0627\u0644\u0625\u0633\u0644\u0627\u0645\u064a "
- + "(\u0623\u0645 \u0627\u0644\u0642\u0631\u0649)" }, // JDK-8015986
+ + "(\u0623\u0645 \u0627\u0644\u0642\u0631\u0649)" },
};
}
@@ -198,7 +194,7 @@
String mdStr = "-01-01";
DateTimeFormatter dtf = new DateTimeFormatterBuilder()
.appendPattern("GGGG y-M-d")
- .toFormatter()
+ .toFormatter(Locale.ROOT)
.withChronology(chrono);
DateTimeFormatter dtfLenient = dtf.withResolverStyle(ResolverStyle.LENIENT);
assertEquals(LocalDate.parse(lenient+mdStr, dtfLenient), LocalDate.parse(strict+mdStr, dtf));
diff --git a/ojluni/src/test/java/time/test/java/time/format/TestTextParser.java b/ojluni/src/test/java/time/test/java/time/format/TestTextParser.java
index 721f337..b6126a6 100644
--- a/ojluni/src/test/java/time/test/java/time/format/TestTextParser.java
+++ b/ojluni/src/test/java/time/test/java/time/format/TestTextParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -69,9 +69,12 @@
import java.text.ParsePosition;
import java.time.DayOfWeek;
import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeFormatterBuilder;
import java.time.format.TextStyle;
import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalField;
+import java.time.temporal.TemporalQueries;
+import java.time.temporal.ChronoField;
import java.util.Locale;
import org.testng.annotations.DataProvider;
@@ -82,8 +85,6 @@
*/
@Test
public class TestTextParser extends AbstractTestPrinterParser {
- static final Locale RUSSIAN = new Locale("ru");
- static final Locale FINNISH = new Locale("fi");
//-----------------------------------------------------------------------
@DataProvider(name="error")
@@ -203,21 +204,6 @@
};
}
- // Test data is dependent on localized resources.
- @DataProvider(name="parseStandaloneText")
- Object[][] providerStandaloneText() {
- // Locale, TemporalField, TextStyle, expected value, input text
- return new Object[][] {
- // Android-changed: CLDR provides russian days/months in lower-case and with a fullstop.
- {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE, 1, "\u044f\u043d\u0432\u0430\u0440\u044c" },
- {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE, 12, "\u0434\u0435\u043a\u0430\u0431\u0440\u044c" },
- {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, 1, "\u044f\u043d\u0432." },
- {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, 12, "\u0434\u0435\u043a." },
- {FINNISH, DAY_OF_WEEK, TextStyle.FULL_STANDALONE, 2, "tiistai"},
- {FINNISH, DAY_OF_WEEK, TextStyle.SHORT_STANDALONE, 2, "ti"},
- };
- }
-
@DataProvider(name="parseDayOfWeekText")
Object[][] providerDayOfWeekData() {
return new Object[][] {
@@ -225,25 +211,9 @@
{Locale.US, "e", "1", DayOfWeek.SUNDAY},
{Locale.US, "ee", "01", DayOfWeek.SUNDAY},
{Locale.US, "c", "1", DayOfWeek.SUNDAY},
-
- {Locale.UK, "e", "1", DayOfWeek.MONDAY},
- {Locale.UK, "ee", "01", DayOfWeek.MONDAY},
- {Locale.UK, "c", "1", DayOfWeek.MONDAY},
};
}
- // Test data is dependent on localized resources.
- @DataProvider(name="parseLenientText")
- Object[][] providerLenientText() {
- // Locale, TemporalField, expected value, input text
- return new Object[][] {
- // Android-changed: CLDR provides russian months in lower-case and with a fullstop.
- {RUSSIAN, MONTH_OF_YEAR, 1, "\u044f\u043d\u0432\u0430\u0440\u044f" }, // full format
- {RUSSIAN, MONTH_OF_YEAR, 1, "\u044f\u043d\u0432\u0430\u0440\u044c" }, // full standalone
- {RUSSIAN, MONTH_OF_YEAR, 1, "\u044f\u043d\u0432." }, // short format
- {RUSSIAN, MONTH_OF_YEAR, 1, "\u044f\u043d\u0432." }, // short standalone
- };
- }
@Test(dataProvider="parseText")
public void test_parseText(TemporalField field, TextStyle style, int value, String input) throws Exception {
@@ -259,14 +229,6 @@
assertEquals(pos.getIndex(), input.length());
}
- @Test(dataProvider="parseStandaloneText")
- public void test_parseStandaloneText(Locale locale, TemporalField field, TextStyle style, int expectedValue, String input) {
- DateTimeFormatter formatter = getFormatter(field, style).withLocale(locale);
- ParsePosition pos = new ParsePosition(0);
- assertEquals(formatter.parseUnresolved(input, pos).getLong(field), (long) expectedValue);
- assertEquals(pos.getIndex(), input.length());
- }
-
@Test(dataProvider="parseDayOfWeekText")
public void test_parseDayOfWeekText(Locale locale, String pattern, String input, DayOfWeek expected) {
DateTimeFormatter formatter = getPatternFormatter(pattern).withLocale(locale);
@@ -364,25 +326,6 @@
}
//-----------------------------------------------------------------------
- public void test_parse_french_short_strict_full_noMatch() throws Exception {
- setStrict(true);
- ParsePosition pos = new ParsePosition(0);
- getFormatter(MONTH_OF_YEAR, TextStyle.SHORT).withLocale(Locale.FRENCH)
- .parseUnresolved("janvier", pos);
- assertEquals(pos.getErrorIndex(), 0);
- }
-
- public void test_parse_french_short_strict_short_match() throws Exception {
- setStrict(true);
- ParsePosition pos = new ParsePosition(0);
- assertEquals(getFormatter(MONTH_OF_YEAR, TextStyle.SHORT).withLocale(Locale.FRENCH)
- .parseUnresolved("janv.", pos)
- .getLong(MONTH_OF_YEAR),
- 1L);
- assertEquals(pos.getIndex(), 5);
- }
-
- //-----------------------------------------------------------------------
public void test_parse_full_lenient_full_match() throws Exception {
setStrict(false);
ParsePosition pos = new ParsePosition(0);
@@ -426,13 +369,4 @@
assertEquals(pos.getIndex(), 1);
}
- @Test(dataProvider="parseLenientText")
- public void test_parseLenientText(Locale locale, TemporalField field, int expectedValue, String input) {
- setStrict(false);
- ParsePosition pos = new ParsePosition(0);
- DateTimeFormatter formatter = getFormatter(field).withLocale(locale);
- assertEquals(formatter.parseUnresolved(input, pos).getLong(field), (long) expectedValue);
- assertEquals(pos.getIndex(), input.length());
- }
-
}
diff --git a/ojluni/src/test/java/time/test/java/time/format/TestTextParserWithLocale.java b/ojluni/src/test/java/time/test/java/time/format/TestTextParserWithLocale.java
new file mode 100644
index 0000000..ab5bdf2
--- /dev/null
+++ b/ojluni/src/test/java/time/test/java/time/format/TestTextParserWithLocale.java
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of JSR-310 nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * @test
+ * @modules jdk.localedata
+ */
+
+package test.java.time.format;
+
+import java.text.ParsePosition;
+import java.time.chrono.ChronoLocalDate;
+import java.time.chrono.JapaneseChronology;
+import java.time.chrono.HijrahDate;
+import java.time.chrono.JapaneseDate;
+import java.time.chrono.MinguoDate;
+import java.time.chrono.ThaiBuddhistDate;
+import java.time.DayOfWeek;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.TextStyle;
+import java.time.format.SignStyle;
+import java.time.temporal.ChronoField;
+import java.time.temporal.TemporalField;
+import java.util.Locale;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+
+import static java.time.temporal.ChronoField.DAY_OF_MONTH;
+import static java.time.temporal.ChronoField.DAY_OF_WEEK;
+import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
+import static org.testng.Assert.assertEquals;
+
+/**
+ * Test TextPrinterParser.
+ */
+@Test
+public class TestTextParserWithLocale extends AbstractTestPrinterParser {
+ static final Locale RUSSIAN = new Locale("ru");
+ static final Locale FINNISH = new Locale("fi");
+
+ @DataProvider(name="parseDayOfWeekText")
+ Object[][] providerDayOfWeekData() {
+ return new Object[][] {
+ // Locale, pattern, input text, expected DayOfWeek
+ {Locale.US, "e", "1", DayOfWeek.SUNDAY},
+ {Locale.US, "ee", "01", DayOfWeek.SUNDAY},
+ {Locale.US, "c", "1", DayOfWeek.SUNDAY},
+
+ {Locale.UK, "e", "1", DayOfWeek.MONDAY},
+ {Locale.UK, "ee", "01", DayOfWeek.MONDAY},
+ {Locale.UK, "c", "1", DayOfWeek.MONDAY},
+ };
+ }
+
+ @Test(dataProvider="parseDayOfWeekText")
+ public void test_parseDayOfWeekText(Locale locale, String pattern, String input, DayOfWeek expected) {
+ DateTimeFormatter formatter = getPatternFormatter(pattern).withLocale(locale);
+ ParsePosition pos = new ParsePosition(0);
+ assertEquals(DayOfWeek.from(formatter.parse(input, pos)), expected);
+ assertEquals(pos.getIndex(), input.length());
+ }
+
+ //--------------------------------------------------------------------
+ // Test data is dependent on localized resources.
+ @DataProvider(name="parseStandaloneText")
+ Object[][] providerStandaloneText() {
+ // Locale, TemporalField, TextStyle, expected value, input text
+ return new Object[][] {
+ {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE, 1, "\u044f\u043d\u0432\u0430\u0440\u044c"},
+ {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE, 12, "\u0434\u0435\u043a\u0430\u0431\u0440\u044c"},
+ {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, 1, "\u044f\u043d\u0432."},
+ {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, 12, "\u0434\u0435\u043a."},
+ {FINNISH, DAY_OF_WEEK, TextStyle.FULL_STANDALONE, 2, "tiistai"},
+ {FINNISH, DAY_OF_WEEK, TextStyle.SHORT_STANDALONE, 2, "ti"},
+ };
+ }
+
+ // Test data is dependent on localized resources.
+ @DataProvider(name="parseLenientText")
+ Object[][] providerLenientText() {
+ // Locale, TemporalField, expected value, input text
+ return new Object[][] {
+ {RUSSIAN, MONTH_OF_YEAR, 1, "\u044f\u043d\u0432\u0430\u0440\u044f"}, // full format
+ {RUSSIAN, MONTH_OF_YEAR, 1, "\u044f\u043d\u0432\u0430\u0440\u044c"}, // full standalone
+ {RUSSIAN, MONTH_OF_YEAR, 1, "\u044f\u043d\u0432."}, // short format
+ {RUSSIAN, MONTH_OF_YEAR, 1, "\u044f\u043d\u0432."}, // short standalone
+ };
+ }
+
+ @Test(dataProvider="parseStandaloneText")
+ public void test_parseStandaloneText(Locale locale, TemporalField field, TextStyle style, int expectedValue, String input) {
+ DateTimeFormatter formatter = getFormatter(field, style).withLocale(locale);
+ ParsePosition pos = new ParsePosition(0);
+ assertEquals(formatter.parseUnresolved(input, pos).getLong(field), (long) expectedValue);
+ assertEquals(pos.getIndex(), input.length());
+ }
+
+ //-----------------------------------------------------------------------
+ public void test_parse_french_short_strict_full_noMatch() throws Exception {
+ setStrict(true);
+ ParsePosition pos = new ParsePosition(0);
+ getFormatter(MONTH_OF_YEAR, TextStyle.SHORT).withLocale(Locale.FRENCH)
+ .parseUnresolved("janvier", pos);
+ assertEquals(pos.getErrorIndex(), 0);
+ }
+
+ public void test_parse_french_short_strict_short_match() throws Exception {
+ setStrict(true);
+ ParsePosition pos = new ParsePosition(0);
+ assertEquals(getFormatter(MONTH_OF_YEAR, TextStyle.SHORT).withLocale(Locale.FRENCH)
+ .parseUnresolved("janv.", pos)
+ .getLong(MONTH_OF_YEAR),
+ 1L);
+ assertEquals(pos.getIndex(), 5);
+ }
+
+ //-----------------------------------------------------------------------
+
+ @Test(dataProvider="parseLenientText")
+ public void test_parseLenientText(Locale locale, TemporalField field, int expectedValue, String input) {
+ setStrict(false);
+ ParsePosition pos = new ParsePosition(0);
+ DateTimeFormatter formatter = getFormatter(field).withLocale(locale);
+ assertEquals(formatter.parseUnresolved(input, pos).getLong(field), (long) expectedValue);
+ assertEquals(pos.getIndex(), input.length());
+ }
+
+
+ //-----------------------------------------------------------------------
+ @DataProvider(name="parseChronoLocalDate")
+ Object[][] provider_chronoLocalDate() {
+ return new Object[][] {
+ { HijrahDate.now() },
+ { JapaneseDate.now() },
+ { MinguoDate.now() },
+ { ThaiBuddhistDate.now() }};
+ }
+
+ private static final DateTimeFormatter fmt_chrono =
+ new DateTimeFormatterBuilder()
+ .optionalStart()
+ .appendChronologyId()
+ .appendLiteral(' ')
+ .optionalEnd()
+ .optionalStart()
+ .appendText(ChronoField.ERA, TextStyle.SHORT)
+ .appendLiteral(' ')
+ .optionalEnd()
+ .appendValue(ChronoField.YEAR_OF_ERA, 1, 9, SignStyle.NORMAL)
+ .appendLiteral('-')
+ .appendValue(ChronoField.MONTH_OF_YEAR, 1, 2, SignStyle.NEVER)
+ .appendLiteral('-')
+ .appendValue(ChronoField.DAY_OF_MONTH, 1, 2, SignStyle.NEVER)
+ .toFormatter();
+
+ @Test(dataProvider="parseChronoLocalDate")
+ public void test_chronoLocalDate(ChronoLocalDate date) throws Exception {
+ System.out.printf(" %s, [fmt=%s]%n", date, fmt_chrono.format(date));
+ assertEquals(date, fmt_chrono.parse(fmt_chrono.format(date), ChronoLocalDate::from));
+
+ DateTimeFormatter fmt = DateTimeFormatter.ofPattern("[GGG ]yyy-MM-dd")
+ .withChronology(date.getChronology());
+ System.out.printf(" %s, [fmt=%s]%n", date.toString(), fmt.format(date));
+ assertEquals(date, fmt.parse(fmt.format(date), ChronoLocalDate::from));
+ }
+}
diff --git a/ojluni/src/test/java/time/test/java/time/format/TestTextPrinter.java b/ojluni/src/test/java/time/test/java/time/format/TestTextPrinter.java
index 19e6421..379d6a2 100644
--- a/ojluni/src/test/java/time/test/java/time/format/TestTextPrinter.java
+++ b/ojluni/src/test/java/time/test/java/time/format/TestTextPrinter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -84,8 +84,6 @@
*/
@Test
public class TestTextPrinter extends AbstractTestPrinterParser {
- static final Locale RUSSIAN = new Locale("ru");
- static final Locale FINNISH = new Locale("fi");
//-----------------------------------------------------------------------
@Test(expectedExceptions=DateTimeException.class)
@@ -213,33 +211,6 @@
{Locale.US, "e", "1", DayOfWeek.SUNDAY},
{Locale.US, "ee", "01", DayOfWeek.SUNDAY},
{Locale.US, "c", "1", DayOfWeek.SUNDAY},
-
- {Locale.UK, "e", "1", DayOfWeek.MONDAY},
- {Locale.UK, "ee", "01", DayOfWeek.MONDAY},
- {Locale.UK, "c", "1", DayOfWeek.MONDAY},
- };
- }
-
- @DataProvider(name="print_JapaneseChronology")
- Object[][] provider_japaneseEra() {
- return new Object[][] {
- {ERA, TextStyle.FULL, 2, "Heisei"}, // Note: CLDR doesn't define "wide" Japanese era names.
- {ERA, TextStyle.SHORT, 2, "Heisei"},
- {ERA, TextStyle.NARROW, 2, "H"},
- };
- };
-
- // Test data is dependent on localized resources.
- @DataProvider(name="print_standalone")
- Object[][] provider_StandaloneNames() {
- return new Object[][] {
- // standalone names for 2013-01-01 (Tue)
- // Locale, TemporalField, TextStyle, expected text
- // Android-changed: CLDR uses lower case for russian month names.
- {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE, "\u044f\u043d\u0432\u0430\u0440\u044c"},
- {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, "\u044f\u043d\u0432."},
- {FINNISH, DAY_OF_WEEK, TextStyle.FULL_STANDALONE, "tiistai"},
- {FINNISH, DAY_OF_WEEK, TextStyle.SHORT_STANDALONE, "ti"},
};
}
@@ -256,30 +227,6 @@
assertEquals(text, expected);
}
- @Test(dataProvider="print_JapaneseChronology")
- public void test_formatJapaneseEra(TemporalField field, TextStyle style, int value, String expected) throws Exception {
- LocalDate ld = LocalDate.of(2013, 1, 31);
- getFormatter(field, style).withChronology(JapaneseChronology.INSTANCE).formatTo(ld, buf);
- assertEquals(buf.toString(), expected);
- }
-
- @Test(dataProvider="print_standalone")
- public void test_standaloneNames(Locale locale, TemporalField field, TextStyle style, String expected) {
- getFormatter(field, style).withLocale(locale).formatTo(LocalDate.of(2013, 1, 1), buf);
- assertEquals(buf.toString(), expected);
- }
-
- //-----------------------------------------------------------------------
- public void test_print_french_long() throws Exception {
- getFormatter(MONTH_OF_YEAR, TextStyle.FULL).withLocale(Locale.FRENCH).formatTo(LocalDate.of(2012, 1, 1), buf);
- assertEquals(buf.toString(), "janvier");
- }
-
- public void test_print_french_short() throws Exception {
- getFormatter(MONTH_OF_YEAR, TextStyle.SHORT).withLocale(Locale.FRENCH).formatTo(LocalDate.of(2012, 1, 1), buf);
- assertEquals(buf.toString(), "janv.");
- }
-
//-----------------------------------------------------------------------
public void test_toString1() throws Exception {
assertEquals(getFormatter(MONTH_OF_YEAR, TextStyle.FULL).toString(), "Text(MonthOfYear)");
diff --git a/ojluni/src/test/java/time/test/java/time/format/TestTextPrinterWithLocale.java b/ojluni/src/test/java/time/test/java/time/format/TestTextPrinterWithLocale.java
new file mode 100644
index 0000000..9c4d7d9
--- /dev/null
+++ b/ojluni/src/test/java/time/test/java/time/format/TestTextPrinterWithLocale.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of JSR-310 nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * @test
+ * @modules jdk.localedata
+ */
+
+package test.java.time.format;
+
+import static java.time.temporal.ChronoField.DAY_OF_MONTH;
+import static java.time.temporal.ChronoField.DAY_OF_WEEK;
+import static java.time.temporal.ChronoField.ERA;
+import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
+import static java.time.temporal.IsoFields.QUARTER_OF_YEAR;
+import static org.testng.Assert.assertEquals;
+
+import java.time.DateTimeException;
+import java.time.DayOfWeek;
+import java.time.LocalDate;
+import java.time.chrono.JapaneseChronology;
+import java.time.format.DateTimeFormatter;
+import java.time.format.TextStyle;
+import java.time.temporal.TemporalField;
+import java.util.Locale;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import test.java.time.temporal.MockFieldValue;
+
+/**
+ * Test TextPrinterParserWithLocale.
+ */
+@Test
+public class TestTextPrinterWithLocale extends AbstractTestPrinterParser {
+ static final Locale RUSSIAN = new Locale("ru");
+ static final Locale FINNISH = new Locale("fi");
+
+ //-----------------------------------------------------------------------
+ @DataProvider(name="print_DayOfWeekData")
+ Object[][] providerDayOfWeekData() {
+ return new Object[][] {
+ // Locale, pattern, expected text, input DayOfWeek
+ {Locale.US, "e", "1", DayOfWeek.SUNDAY},
+ {Locale.US, "ee", "01", DayOfWeek.SUNDAY},
+ {Locale.US, "c", "1", DayOfWeek.SUNDAY},
+
+ {Locale.UK, "e", "1", DayOfWeek.MONDAY},
+ {Locale.UK, "ee", "01", DayOfWeek.MONDAY},
+ {Locale.UK, "c", "1", DayOfWeek.MONDAY},
+ };
+ }
+
+ // Test data is dependent on localized resources.
+ @DataProvider(name="print_standalone")
+ Object[][] provider_StandaloneNames() {
+ return new Object[][] {
+ // standalone names for 2013-01-01 (Tue)
+ // Locale, TemporalField, TextStyle, expected text
+ {RUSSIAN, MONTH_OF_YEAR, TextStyle.FULL_STANDALONE, "\u044f\u043d\u0432\u0430\u0440\u044c"},
+ {RUSSIAN, MONTH_OF_YEAR, TextStyle.SHORT_STANDALONE, "\u044f\u043d\u0432."},
+ {FINNISH, DAY_OF_WEEK, TextStyle.FULL_STANDALONE, "tiistai"},
+ {FINNISH, DAY_OF_WEEK, TextStyle.SHORT_STANDALONE, "ti"},
+ };
+ }
+
+ @Test(dataProvider="print_DayOfWeekData")
+ public void test_formatDayOfWeek(Locale locale, String pattern, String expected, DayOfWeek dayOfWeek) {
+ DateTimeFormatter formatter = getPatternFormatter(pattern).withLocale(locale);
+ String text = formatter.format(dayOfWeek);
+ assertEquals(text, expected);
+ }
+
+ @Test(dataProvider="print_standalone")
+ public void test_standaloneNames(Locale locale, TemporalField field, TextStyle style, String expected) {
+ getFormatter(field, style).withLocale(locale).formatTo(LocalDate.of(2013, 1, 1), buf);
+ assertEquals(buf.toString(), expected);
+ }
+
+ //-----------------------------------------------------------------------
+ public void test_print_french_long() throws Exception {
+ getFormatter(MONTH_OF_YEAR, TextStyle.FULL).withLocale(Locale.FRENCH).formatTo(LocalDate.of(2012, 1, 1), buf);
+ assertEquals(buf.toString(), "janvier");
+ }
+
+ public void test_print_french_short() throws Exception {
+ getFormatter(MONTH_OF_YEAR, TextStyle.SHORT).withLocale(Locale.FRENCH).formatTo(LocalDate.of(2012, 1, 1), buf);
+ assertEquals(buf.toString(), "janv.");
+ }
+
+ @DataProvider(name="print_JapaneseChronology")
+ Object[][] provider_japaneseEra() {
+ return new Object[][] {
+ {ERA, TextStyle.FULL, 2, "Heisei"}, // Note: CLDR doesn't define "wide" Japanese era names.
+ {ERA, TextStyle.SHORT, 2, "Heisei"},
+ {ERA, TextStyle.NARROW, 2, "H"},
+ };
+ };
+
+ @Test(dataProvider="print_JapaneseChronology")
+ public void test_formatJapaneseEra(TemporalField field, TextStyle style, int value, String expected) throws Exception {
+ LocalDate ld = LocalDate.of(2013, 1, 31);
+ getFormatter(field, style).withChronology(JapaneseChronology.INSTANCE).formatTo(ld, buf);
+ assertEquals(buf.toString(), expected);
+ }
+}
diff --git a/ojluni/src/test/java/time/test/java/time/format/TestUnicodeExtension.java b/ojluni/src/test/java/time/test/java/time/format/TestUnicodeExtension.java
new file mode 100644
index 0000000..4b71f06
--- /dev/null
+++ b/ojluni/src/test/java/time/test/java/time/format/TestUnicodeExtension.java
@@ -0,0 +1,859 @@
+/*
+ * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8176841 8202537
+ * @summary Tests java.time classes deals with Unicode extensions
+ * correctly.
+ * @modules jdk.localedata
+ */
+package test.java.time.format;
+
+import static org.testng.Assert.assertEquals;
+
+import java.time.DayOfWeek;
+import java.time.ZonedDateTime;
+import java.time.ZoneId;
+import java.time.chrono.Chronology;
+import java.time.chrono.HijrahChronology;
+import java.time.chrono.IsoChronology;
+import java.time.chrono.JapaneseChronology;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.FormatStyle;
+import java.time.temporal.ChronoField;
+import java.time.temporal.TemporalField;
+import java.time.temporal.WeekFields;
+import java.util.Locale;
+import java.util.TimeZone;
+
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * Test JavaTime with BCP47 U extensions
+ */
+@Test
+public class TestUnicodeExtension {
+ private static TimeZone defaultTZ;
+
+ private static final Chronology JAPANESE = JapaneseChronology.INSTANCE;
+ private static final Chronology HIJRAH = HijrahChronology.INSTANCE;
+
+ private static final ZoneId ASIATOKYO = ZoneId.of("Asia/Tokyo");
+ private static final ZoneId AMLA = ZoneId.of("America/Los_Angeles");
+
+ private static final Locale JPTYO = Locale.forLanguageTag("en-u-tz-jptyo");
+ private static final Locale JCAL = Locale.forLanguageTag("en-u-ca-japanese");
+ private static final Locale HCAL = Locale.forLanguageTag("en-u-ca-islamic-umalqura");
+
+ private static final Locale FW_SUN = Locale.forLanguageTag("en-US-u-fw-sun");
+ private static final Locale FW_MON = Locale.forLanguageTag("en-US-u-fw-mon");
+ private static final Locale FW_TUE = Locale.forLanguageTag("en-US-u-fw-tue");
+ private static final Locale FW_WED = Locale.forLanguageTag("en-US-u-fw-wed");
+ private static final Locale FW_THU = Locale.forLanguageTag("en-US-u-fw-thu");
+ private static final Locale FW_FRI = Locale.forLanguageTag("en-US-u-fw-fri");
+ private static final Locale FW_SAT = Locale.forLanguageTag("en-US-u-fw-sat");
+
+ private static final Locale RG_GB = Locale.forLanguageTag("en-US-u-rg-gbzzzz");
+
+ private static final ZonedDateTime ZDT = ZonedDateTime.of(2017, 8, 10, 15, 15, 0, 0, AMLA);
+
+ private static final String PATTERN = "GGGG MMMM-dd-uu HH:mm:ss zzzz";
+
+ @BeforeTest
+ public void beforeTest() {
+ defaultTZ = TimeZone.getDefault();
+ TimeZone.setDefault(TimeZone.getTimeZone(AMLA));
+ }
+
+ @AfterTest
+ public void afterTest() {
+ TimeZone.setDefault(defaultTZ);
+ }
+
+ @DataProvider(name="localizedBy")
+ Object[][] localizedBy() {
+ return new Object[][] {
+ // Locale, Chrono override, Zone override, Expected Chrono, Expected Zone,
+ // Expected formatted string
+ {Locale.JAPAN, null, null, null, null,
+ "2017\u5e748\u670810\u65e5\u6728\u66dc\u65e5 15\u664215\u520600\u79d2 \u30a2\u30e1\u30ea\u30ab\u592a\u5e73\u6d0b\u590f\u6642\u9593"
+ },
+ {Locale.JAPAN, JAPANESE, null, JAPANESE, null,
+ "\u5e73\u621029\u5e748\u670810\u65e5\u6728\u66dc\u65e5 15\u664215\u520600\u79d2 \u30a2\u30e1\u30ea\u30ab\u592a\u5e73\u6d0b\u590f\u6642\u9593"
+ },
+ {Locale.JAPAN, JAPANESE, ASIATOKYO, JAPANESE, ASIATOKYO,
+ "\u5e73\u621029\u5e748\u670811\u65e5\u91d1\u66dc\u65e5 7\u664215\u520600\u79d2 \u65e5\u672c\u6a19\u6e96\u6642"
+ },
+
+ {JCAL, null, null, JAPANESE, null,
+ "Thursday, August 10, 29 Heisei at 3:15:00 PM Pacific Daylight Time"
+ },
+ {JCAL, HIJRAH, null, JAPANESE, null,
+ "Thursday, August 10, 29 Heisei at 3:15:00 PM Pacific Daylight Time"
+ },
+ {HCAL, JAPANESE, null, HIJRAH, null,
+ "Thursday, Dhu\u02bbl-Qi\u02bbdah 18, 1438 AH at 3:15:00 PM Pacific Daylight Time"
+ },
+
+
+ {JPTYO, null, null, null, ASIATOKYO,
+ "Friday, August 11, 2017 at 7:15:00 AM Japan Standard Time"
+ },
+ {JPTYO, null, AMLA, null, ASIATOKYO,
+ "Friday, August 11, 2017 at 7:15:00 AM Japan Standard Time"
+ },
+ // invalid tz
+ {Locale.forLanguageTag("en-US-u-tz-jpzzz"), null, null, null, null,
+ "Thursday, August 10, 2017 at 3:15:00 PM Pacific Daylight Time"
+ },
+ {Locale.forLanguageTag("en-US-u-tz-jpzzz"), null, AMLA, null, AMLA,
+ "Thursday, August 10, 2017 at 3:15:00 PM Pacific Daylight Time"
+ },
+
+ {RG_GB, null, null, null, null,
+ // Android-changed: Android doesn't support "rg" extension yet.
+ // "Thursday, 10 August 2017 at 15:15:00 Pacific Daylight Time"
+ "Thursday, August 10, 2017 at 3:15:00 PM Pacific Daylight Time"
+ },
+
+ // DecimalStyle
+ {Locale.forLanguageTag("en-US-u-nu-thai"), null, null, null, null,
+ "Thursday, August \u0e51\u0e50, \u0e52\u0e50\u0e51\u0e57 at \u0e53:\u0e51\u0e55:\u0e50\u0e50 PM Pacific Daylight Time"
+ },
+ // DecimalStyle, "nu" vs "rg"
+ {Locale.forLanguageTag("en-US-u-nu-thai-rg-uszzzz"), null, null, null, null,
+ "Thursday, August \u0e51\u0e50, \u0e52\u0e50\u0e51\u0e57 at \u0e53:\u0e51\u0e55:\u0e50\u0e50 PM Pacific Daylight Time"
+ },
+ // DecimalStyle, invalid
+ {Locale.forLanguageTag("en-US-u-nu-foo"), null, null, null, null,
+ "Thursday, August 10, 2017 at 3:15:00 PM Pacific Daylight Time"
+ },
+ };
+ }
+
+ @DataProvider(name="withLocale")
+ Object[][] withLocale() {
+ return new Object[][] {
+ // Locale, Chrono override, Zone override, Expected Chrono, Expected Zone,
+ // Expected formatted string
+ {Locale.JAPAN, null, null, null, null,
+ "2017\u5e748\u670810\u65e5\u6728\u66dc\u65e5 15\u664215\u520600\u79d2 \u30a2\u30e1\u30ea\u30ab\u592a\u5e73\u6d0b\u590f\u6642\u9593"
+ },
+ {Locale.JAPAN, JAPANESE, null, JAPANESE, null,
+ "\u5e73\u621029\u5e748\u670810\u65e5\u6728\u66dc\u65e5 15\u664215\u520600\u79d2 \u30a2\u30e1\u30ea\u30ab\u592a\u5e73\u6d0b\u590f\u6642\u9593"
+ },
+ {Locale.JAPAN, JAPANESE, ASIATOKYO, JAPANESE, ASIATOKYO,
+ "\u5e73\u621029\u5e748\u670811\u65e5\u91d1\u66dc\u65e5 7\u664215\u520600\u79d2 \u65e5\u672c\u6a19\u6e96\u6642"
+ },
+
+ {JCAL, null, null, null, null,
+ "Thursday, August 10, 2017 at 3:15:00 PM Pacific Daylight Time"
+ },
+ {JCAL, HIJRAH, null, HIJRAH, null,
+ "Thursday, Dhu\u02bbl-Qi\u02bbdah 18, 1438 AH at 3:15:00 PM Pacific Daylight Time"
+ },
+ {HCAL, JAPANESE, null, JAPANESE, null,
+ "Thursday, August 10, 29 Heisei at 3:15:00 PM Pacific Daylight Time"
+ },
+
+
+ {JPTYO, null, null, null, null,
+ "Thursday, August 10, 2017 at 3:15:00 PM Pacific Daylight Time"
+ },
+ {JPTYO, null, AMLA, null, AMLA,
+ "Thursday, August 10, 2017 at 3:15:00 PM Pacific Daylight Time"
+ },
+ // invalid tz
+ {Locale.forLanguageTag("en-US-u-tz-jpzzz"), null, null, null, null,
+ "Thursday, August 10, 2017 at 3:15:00 PM Pacific Daylight Time"
+ },
+ {Locale.forLanguageTag("en-US-u-tz-jpzzz"), null, null, null, null,
+ "Thursday, August 10, 2017 at 3:15:00 PM Pacific Daylight Time"
+ },
+
+ {RG_GB, null, null, null, null,
+ // Android-changed: Android doesn't support "rg" extension yet.
+ // "Thursday, 10 August 2017 at 15:15:00 Pacific Daylight Time"
+ "Thursday, August 10, 2017 at 3:15:00 PM Pacific Daylight Time"
+ },
+
+ // DecimalStyle
+ {Locale.forLanguageTag("en-US-u-nu-thai"), null, null, null, null,
+ "Thursday, August 10, 2017 at 3:15:00 PM Pacific Daylight Time"
+ },
+ // DecimalStyle, "nu" vs "rg"
+ {Locale.forLanguageTag("en-US-u-nu-thai-rg-uszzzz"), null, null, null, null,
+ "Thursday, August 10, 2017 at 3:15:00 PM Pacific Daylight Time"
+ },
+ // DecimalStyle, invalid
+ {Locale.forLanguageTag("en-US-u-nu-foo"), null, null, null, null,
+ "Thursday, August 10, 2017 at 3:15:00 PM Pacific Daylight Time"
+ },
+ };
+ }
+
+ @DataProvider(name="firstDayOfWeek")
+ Object[][] firstDayOfWeek () {
+ return new Object[][] {
+ // Locale, Expected DayOfWeek,
+ {Locale.US, DayOfWeek.SUNDAY},
+ {FW_SUN, DayOfWeek.SUNDAY},
+ {FW_MON, DayOfWeek.MONDAY},
+ {FW_TUE, DayOfWeek.TUESDAY},
+ {FW_WED, DayOfWeek.WEDNESDAY},
+ {FW_THU, DayOfWeek.THURSDAY},
+ {FW_FRI, DayOfWeek.FRIDAY},
+ {FW_SAT, DayOfWeek.SATURDAY},
+
+ // invalid case
+ {Locale.forLanguageTag("en-US-u-fw-xxx"), DayOfWeek.SUNDAY},
+
+ // region override
+ {RG_GB, DayOfWeek.MONDAY},
+ {Locale.forLanguageTag("zh-CN-u-rg-eszzzz"), DayOfWeek.MONDAY},
+
+ // "fw" and "rg".
+ {Locale.forLanguageTag("en-US-u-fw-wed-rg-gbzzzz"), DayOfWeek.WEDNESDAY},
+ {Locale.forLanguageTag("en-US-u-fw-xxx-rg-gbzzzz"), DayOfWeek.MONDAY},
+ {Locale.forLanguageTag("en-US-u-fw-xxx-rg-zzzz"), DayOfWeek.SUNDAY},
+ };
+ }
+
+ @DataProvider(name="minDaysInFirstWeek")
+ Object[][] minDaysInFrstWeek () {
+ return new Object[][] {
+ // Locale, Expected minDay,
+ {Locale.US, 1},
+
+ // region override
+ {RG_GB, 4},
+ {Locale.forLanguageTag("zh-CN-u-rg-eszzzz"), 4},
+ };
+ }
+
+ @DataProvider(name="ofPattern")
+ Object[][] ofPattern() {
+ return new Object[][] {
+ // Locale, Expected Chrono, Expected Zone,
+ // Expected formatted string
+ {JCAL, null, null,
+ "Anno Domini August-10-17 15:15:00 Pacific Daylight Time"
+ },
+ {HCAL, null, null,
+ "Anno Domini August-10-17 15:15:00 Pacific Daylight Time"
+ },
+
+ {JPTYO, null, null,
+ "Anno Domini August-10-17 15:15:00 Pacific Daylight Time"
+ },
+ {Locale.forLanguageTag("en-US-u-tz-jpzzz"), null, null,
+ "Anno Domini August-10-17 15:15:00 Pacific Daylight Time"
+ },
+
+ {RG_GB, null, null,
+ "Anno Domini August-10-17 15:15:00 Pacific Daylight Time"
+ },
+
+ };
+ }
+
+ @DataProvider(name="shortTZID")
+ Object[][] shortTZID() {
+ return new Object[][] {
+ // LDML's short ID, Expected Zone,
+ {"adalv", "Europe/Andorra"},
+ {"aedxb", "Asia/Dubai"},
+ {"afkbl", "Asia/Kabul"},
+ {"aganu", "America/Antigua"},
+ {"aiaxa", "America/Anguilla"},
+ {"altia", "Europe/Tirane"},
+ {"amevn", "Asia/Yerevan"},
+ {"ancur", "America/Curacao"},
+ {"aolad", "Africa/Luanda"},
+ {"aqcas", "Antarctica/Casey"},
+ {"aqdav", "Antarctica/Davis"},
+ {"aqddu", "Antarctica/DumontDUrville"},
+ {"aqmaw", "Antarctica/Mawson"},
+ {"aqmcm", "Antarctica/McMurdo"},
+ {"aqplm", "Antarctica/Palmer"},
+ {"aqrot", "Antarctica/Rothera"},
+ {"aqsyw", "Antarctica/Syowa"},
+ {"aqtrl", "Antarctica/Troll"},
+ {"aqvos", "Antarctica/Vostok"},
+ {"arbue", "America/Buenos_Aires"},
+ {"arcor", "America/Cordoba"},
+ {"arctc", "America/Catamarca"},
+ {"arirj", "America/Argentina/La_Rioja"},
+ {"arjuj", "America/Jujuy"},
+ {"arluq", "America/Argentina/San_Luis"},
+ {"armdz", "America/Mendoza"},
+ {"arrgl", "America/Argentina/Rio_Gallegos"},
+ {"arsla", "America/Argentina/Salta"},
+ {"artuc", "America/Argentina/Tucuman"},
+ {"aruaq", "America/Argentina/San_Juan"},
+ {"arush", "America/Argentina/Ushuaia"},
+ {"asppg", "Pacific/Pago_Pago"},
+ {"atvie", "Europe/Vienna"},
+ {"auadl", "Australia/Adelaide"},
+ {"aubhq", "Australia/Broken_Hill"},
+ {"aubne", "Australia/Brisbane"},
+ {"audrw", "Australia/Darwin"},
+ {"aueuc", "Australia/Eucla"},
+ {"auhba", "Australia/Hobart"},
+ {"aukns", "Australia/Currie"},
+ {"auldc", "Australia/Lindeman"},
+ {"auldh", "Australia/Lord_Howe"},
+ {"aumel", "Australia/Melbourne"},
+ {"aumqi", "Antarctica/Macquarie"},
+ {"auper", "Australia/Perth"},
+ {"ausyd", "Australia/Sydney"},
+ {"awaua", "America/Aruba"},
+ {"azbak", "Asia/Baku"},
+ {"basjj", "Europe/Sarajevo"},
+ {"bbbgi", "America/Barbados"},
+ {"bddac", "Asia/Dhaka"},
+ {"bebru", "Europe/Brussels"},
+ {"bfoua", "Africa/Ouagadougou"},
+ {"bgsof", "Europe/Sofia"},
+ {"bhbah", "Asia/Bahrain"},
+ {"bibjm", "Africa/Bujumbura"},
+ {"bjptn", "Africa/Porto-Novo"},
+ {"bmbda", "Atlantic/Bermuda"},
+ {"bnbwn", "Asia/Brunei"},
+ {"bolpb", "America/La_Paz"},
+ {"bqkra", "America/Kralendijk"},
+ {"braux", "America/Araguaina"},
+ {"brbel", "America/Belem"},
+ {"brbvb", "America/Boa_Vista"},
+ {"brcgb", "America/Cuiaba"},
+ {"brcgr", "America/Campo_Grande"},
+ {"brern", "America/Eirunepe"},
+ {"brfen", "America/Noronha"},
+ {"brfor", "America/Fortaleza"},
+ {"brmao", "America/Manaus"},
+ {"brmcz", "America/Maceio"},
+ {"brpvh", "America/Porto_Velho"},
+ {"brrbr", "America/Rio_Branco"},
+ {"brrec", "America/Recife"},
+ {"brsao", "America/Sao_Paulo"},
+ {"brssa", "America/Bahia"},
+ {"brstm", "America/Santarem"},
+ {"bsnas", "America/Nassau"},
+ {"btthi", "Asia/Thimphu"},
+ {"bwgbe", "Africa/Gaborone"},
+ {"bymsq", "Europe/Minsk"},
+ {"bzbze", "America/Belize"},
+ {"cacfq", "America/Creston"},
+ {"caedm", "America/Edmonton"},
+ {"caffs", "America/Rainy_River"},
+ {"cafne", "America/Fort_Nelson"},
+ {"caglb", "America/Glace_Bay"},
+ {"cagoo", "America/Goose_Bay"},
+ {"cahal", "America/Halifax"},
+ {"caiql", "America/Iqaluit"},
+ {"camon", "America/Moncton"},
+ {"capnt", "America/Pangnirtung"},
+ {"careb", "America/Resolute"},
+ {"careg", "America/Regina"},
+ {"casjf", "America/St_Johns"},
+ {"canpg", "America/Nipigon"},
+ {"cathu", "America/Thunder_Bay"},
+ {"cator", "America/Toronto"},
+ {"cavan", "America/Vancouver"},
+ {"cawnp", "America/Winnipeg"},
+ {"caybx", "America/Blanc-Sablon"},
+ {"caycb", "America/Cambridge_Bay"},
+ {"cayda", "America/Dawson"},
+ {"caydq", "America/Dawson_Creek"},
+ {"cayek", "America/Rankin_Inlet"},
+ {"cayev", "America/Inuvik"},
+ {"cayxy", "America/Whitehorse"},
+ {"cayyn", "America/Swift_Current"},
+ {"cayzf", "America/Yellowknife"},
+ {"cayzs", "America/Coral_Harbour"},
+ {"cccck", "Indian/Cocos"},
+ {"cdfbm", "Africa/Lubumbashi"},
+ {"cdfih", "Africa/Kinshasa"},
+ {"cfbgf", "Africa/Bangui"},
+ {"cgbzv", "Africa/Brazzaville"},
+ {"chzrh", "Europe/Zurich"},
+ {"ciabj", "Africa/Abidjan"},
+ {"ckrar", "Pacific/Rarotonga"},
+ {"clipc", "Pacific/Easter"},
+ {"clscl", "America/Santiago"},
+ {"cmdla", "Africa/Douala"},
+ {"cnsha", "Asia/Shanghai"},
+ {"cnurc", "Asia/Urumqi"},
+ {"cobog", "America/Bogota"},
+ {"crsjo", "America/Costa_Rica"},
+ {"cst6cdt", "CST6CDT"},
+ {"cuhav", "America/Havana"},
+ {"cvrai", "Atlantic/Cape_Verde"},
+ {"cxxch", "Indian/Christmas"},
+ {"cynic", "Asia/Nicosia"},
+ {"czprg", "Europe/Prague"},
+ {"deber", "Europe/Berlin"},
+ {"debsngn", "Europe/Busingen"},
+ {"djjib", "Africa/Djibouti"},
+ {"dkcph", "Europe/Copenhagen"},
+ {"dmdom", "America/Dominica"},
+ {"dosdq", "America/Santo_Domingo"},
+ {"dzalg", "Africa/Algiers"},
+ {"ecgps", "Pacific/Galapagos"},
+ {"ecgye", "America/Guayaquil"},
+ {"eetll", "Europe/Tallinn"},
+ {"egcai", "Africa/Cairo"},
+ {"eheai", "Africa/El_Aaiun"},
+ {"erasm", "Africa/Asmera"},
+ {"esceu", "Africa/Ceuta"},
+ {"eslpa", "Atlantic/Canary"},
+ {"esmad", "Europe/Madrid"},
+ {"est5edt", "EST5EDT"},
+ {"etadd", "Africa/Addis_Ababa"},
+ {"fihel", "Europe/Helsinki"},
+ {"fimhq", "Europe/Mariehamn"},
+ {"fjsuv", "Pacific/Fiji"},
+ {"fkpsy", "Atlantic/Stanley"},
+ {"fmksa", "Pacific/Kosrae"},
+ {"fmpni", "Pacific/Ponape"},
+ {"fmtkk", "Pacific/Truk"},
+ {"fotho", "Atlantic/Faeroe"},
+ {"frpar", "Europe/Paris"},
+ {"galbv", "Africa/Libreville"},
+ {"gaza", "Asia/Gaza"},
+ {"gblon", "Europe/London"},
+ {"gdgnd", "America/Grenada"},
+ {"getbs", "Asia/Tbilisi"},
+ {"gfcay", "America/Cayenne"},
+ {"gggci", "Europe/Guernsey"},
+ {"ghacc", "Africa/Accra"},
+ {"gigib", "Europe/Gibraltar"},
+ {"gldkshvn", "America/Danmarkshavn"},
+ {"glgoh", "America/Godthab"},
+ {"globy", "America/Scoresbysund"},
+ {"glthu", "America/Thule"},
+ {"gmbjl", "Africa/Banjul"},
+ {"gncky", "Africa/Conakry"},
+ {"gpbbr", "America/Guadeloupe"},
+ {"gpmsb", "America/Marigot"},
+ {"gpsbh", "America/St_Barthelemy"},
+ {"gqssg", "Africa/Malabo"},
+ {"grath", "Europe/Athens"},
+ {"gsgrv", "Atlantic/South_Georgia"},
+ {"gtgua", "America/Guatemala"},
+ {"gugum", "Pacific/Guam"},
+ {"gwoxb", "Africa/Bissau"},
+ {"gygeo", "America/Guyana"},
+ {"hebron", "Asia/Hebron"},
+ {"hkhkg", "Asia/Hong_Kong"},
+ {"hntgu", "America/Tegucigalpa"},
+ {"hrzag", "Europe/Zagreb"},
+ {"htpap", "America/Port-au-Prince"},
+ {"hubud", "Europe/Budapest"},
+ {"iddjj", "Asia/Jayapura"},
+ {"idjkt", "Asia/Jakarta"},
+ {"idmak", "Asia/Makassar"},
+ {"idpnk", "Asia/Pontianak"},
+ {"iedub", "Europe/Dublin"},
+ {"imdgs", "Europe/Isle_of_Man"},
+ {"inccu", "Asia/Calcutta"},
+ {"iodga", "Indian/Chagos"},
+ {"iqbgw", "Asia/Baghdad"},
+ {"irthr", "Asia/Tehran"},
+ {"isrey", "Atlantic/Reykjavik"},
+ {"itrom", "Europe/Rome"},
+ {"jeruslm", "Asia/Jerusalem"},
+ {"jesth", "Europe/Jersey"},
+ {"jmkin", "America/Jamaica"},
+ {"joamm", "Asia/Amman"},
+ {"jptyo", "Asia/Tokyo"},
+ {"kenbo", "Africa/Nairobi"},
+ {"kgfru", "Asia/Bishkek"},
+ {"khpnh", "Asia/Phnom_Penh"},
+ {"kicxi", "Pacific/Kiritimati"},
+ {"kipho", "Pacific/Enderbury"},
+ {"kitrw", "Pacific/Tarawa"},
+ {"kmyva", "Indian/Comoro"},
+ {"knbas", "America/St_Kitts"},
+ {"kpfnj", "Asia/Pyongyang"},
+ {"krsel", "Asia/Seoul"},
+ {"kwkwi", "Asia/Kuwait"},
+ {"kygec", "America/Cayman"},
+ {"kzaau", "Asia/Aqtau"},
+ {"kzakx", "Asia/Aqtobe"},
+ {"kzala", "Asia/Almaty"},
+ {"kzkzo", "Asia/Qyzylorda"},
+ {"kzura", "Asia/Oral"},
+ {"lavte", "Asia/Vientiane"},
+ {"lbbey", "Asia/Beirut"},
+ {"lccas", "America/St_Lucia"},
+ {"livdz", "Europe/Vaduz"},
+ {"lkcmb", "Asia/Colombo"},
+ {"lrmlw", "Africa/Monrovia"},
+ {"lsmsu", "Africa/Maseru"},
+ {"ltvno", "Europe/Vilnius"},
+ {"lulux", "Europe/Luxembourg"},
+ {"lvrix", "Europe/Riga"},
+ {"lytip", "Africa/Tripoli"},
+ {"macas", "Africa/Casablanca"},
+ {"mcmon", "Europe/Monaco"},
+ {"mdkiv", "Europe/Chisinau"},
+ {"metgd", "Europe/Podgorica"},
+ {"mgtnr", "Indian/Antananarivo"},
+ {"mhkwa", "Pacific/Kwajalein"},
+ {"mhmaj", "Pacific/Majuro"},
+ {"mkskp", "Europe/Skopje"},
+ {"mlbko", "Africa/Bamako"},
+ {"mmrgn", "Asia/Rangoon"},
+ {"mncoq", "Asia/Choibalsan"},
+ {"mnhvd", "Asia/Hovd"},
+ {"mnuln", "Asia/Ulaanbaatar"},
+ {"momfm", "Asia/Macau"},
+ {"mpspn", "Pacific/Saipan"},
+ {"mqfdf", "America/Martinique"},
+ {"mrnkc", "Africa/Nouakchott"},
+ {"msmni", "America/Montserrat"},
+ {"mst7mdt", "MST7MDT"},
+ {"mtmla", "Europe/Malta"},
+ {"muplu", "Indian/Mauritius"},
+ {"mvmle", "Indian/Maldives"},
+ {"mwblz", "Africa/Blantyre"},
+ {"mxchi", "America/Chihuahua"},
+ {"mxcun", "America/Cancun"},
+ {"mxhmo", "America/Hermosillo"},
+ {"mxmam", "America/Matamoros"},
+ {"mxmex", "America/Mexico_City"},
+ {"mxmid", "America/Merida"},
+ {"mxmty", "America/Monterrey"},
+ {"mxmzt", "America/Mazatlan"},
+ {"mxoji", "America/Ojinaga"},
+ {"mxpvr", "America/Bahia_Banderas"},
+ {"mxstis", "America/Santa_Isabel"},
+ {"mxtij", "America/Tijuana"},
+ {"mykch", "Asia/Kuching"},
+ {"mykul", "Asia/Kuala_Lumpur"},
+ {"mzmpm", "Africa/Maputo"},
+ {"nawdh", "Africa/Windhoek"},
+ {"ncnou", "Pacific/Noumea"},
+ {"nenim", "Africa/Niamey"},
+ {"nfnlk", "Pacific/Norfolk"},
+ {"nglos", "Africa/Lagos"},
+ {"nimga", "America/Managua"},
+ {"nlams", "Europe/Amsterdam"},
+ {"noosl", "Europe/Oslo"},
+ {"npktm", "Asia/Katmandu"},
+ {"nrinu", "Pacific/Nauru"},
+ {"nuiue", "Pacific/Niue"},
+ {"nzakl", "Pacific/Auckland"},
+ {"nzcht", "Pacific/Chatham"},
+ {"ommct", "Asia/Muscat"},
+ {"papty", "America/Panama"},
+ {"pelim", "America/Lima"},
+ {"pfgmr", "Pacific/Gambier"},
+ {"pfnhv", "Pacific/Marquesas"},
+ {"pfppt", "Pacific/Tahiti"},
+ {"pgpom", "Pacific/Port_Moresby"},
+ {"pgraw", "Pacific/Bougainville"},
+ {"phmnl", "Asia/Manila"},
+ {"pkkhi", "Asia/Karachi"},
+ {"plwaw", "Europe/Warsaw"},
+ {"pmmqc", "America/Miquelon"},
+ {"pnpcn", "Pacific/Pitcairn"},
+ {"prsju", "America/Puerto_Rico"},
+ {"pst8pdt", "PST8PDT"},
+ {"ptfnc", "Atlantic/Madeira"},
+ {"ptlis", "Europe/Lisbon"},
+ {"ptpdl", "Atlantic/Azores"},
+ {"pwror", "Pacific/Palau"},
+ {"pyasu", "America/Asuncion"},
+ {"qadoh", "Asia/Qatar"},
+ {"rereu", "Indian/Reunion"},
+ {"robuh", "Europe/Bucharest"},
+ {"rsbeg", "Europe/Belgrade"},
+ {"ruchita", "Asia/Chita"},
+ {"rudyr", "Asia/Anadyr"},
+ {"rugdx", "Asia/Magadan"},
+ {"ruikt", "Asia/Irkutsk"},
+ {"rukgd", "Europe/Kaliningrad"},
+ {"rukhndg", "Asia/Khandyga"},
+ {"rukra", "Asia/Krasnoyarsk"},
+ {"rukuf", "Europe/Samara"},
+ {"rumow", "Europe/Moscow"},
+ {"runoz", "Asia/Novokuznetsk"},
+ {"ruoms", "Asia/Omsk"},
+ {"ruovb", "Asia/Novosibirsk"},
+ {"rupkc", "Asia/Kamchatka"},
+ {"rusred", "Asia/Srednekolymsk"},
+ {"ruunera", "Asia/Ust-Nera"},
+ {"ruuus", "Asia/Sakhalin"},
+ {"ruvog", "Europe/Volgograd"},
+ {"ruvvo", "Asia/Vladivostok"},
+ {"ruyek", "Asia/Yekaterinburg"},
+ {"ruyks", "Asia/Yakutsk"},
+ {"rwkgl", "Africa/Kigali"},
+ {"saruh", "Asia/Riyadh"},
+ {"sbhir", "Pacific/Guadalcanal"},
+ {"scmaw", "Indian/Mahe"},
+ {"sdkrt", "Africa/Khartoum"},
+ {"sesto", "Europe/Stockholm"},
+ {"sgsin", "Asia/Singapore"},
+ {"shshn", "Atlantic/St_Helena"},
+ {"silju", "Europe/Ljubljana"},
+ {"sjlyr", "Arctic/Longyearbyen"},
+ {"skbts", "Europe/Bratislava"},
+ {"slfna", "Africa/Freetown"},
+ {"smsai", "Europe/San_Marino"},
+ {"sndkr", "Africa/Dakar"},
+ {"somgq", "Africa/Mogadishu"},
+ {"srpbm", "America/Paramaribo"},
+ {"ssjub", "Africa/Juba"},
+ {"sttms", "Africa/Sao_Tome"},
+ {"svsal", "America/El_Salvador"},
+ {"sxphi", "America/Lower_Princes"},
+ {"sydam", "Asia/Damascus"},
+ {"szqmn", "Africa/Mbabane"},
+ {"tcgdt", "America/Grand_Turk"},
+ {"tdndj", "Africa/Ndjamena"},
+ {"tfpfr", "Indian/Kerguelen"},
+ {"tglfw", "Africa/Lome"},
+ {"thbkk", "Asia/Bangkok"},
+ {"tjdyu", "Asia/Dushanbe"},
+ {"tkfko", "Pacific/Fakaofo"},
+ {"tldil", "Asia/Dili"},
+ {"tmasb", "Asia/Ashgabat"},
+ {"tntun", "Africa/Tunis"},
+ {"totbu", "Pacific/Tongatapu"},
+ {"trist", "Europe/Istanbul"},
+ {"ttpos", "America/Port_of_Spain"},
+ {"tvfun", "Pacific/Funafuti"},
+ {"twtpe", "Asia/Taipei"},
+ {"tzdar", "Africa/Dar_es_Salaam"},
+ {"uaiev", "Europe/Kiev"},
+ {"uaozh", "Europe/Zaporozhye"},
+ {"uasip", "Europe/Simferopol"},
+ {"uauzh", "Europe/Uzhgorod"},
+ {"ugkla", "Africa/Kampala"},
+ {"umawk", "Pacific/Wake"},
+ {"umjon", "Pacific/Johnston"},
+ {"ummdy", "Pacific/Midway"},
+// {"unk", "Etc/Unknown"},
+ {"usadk", "America/Adak"},
+ {"usaeg", "America/Indiana/Marengo"},
+ {"usanc", "America/Anchorage"},
+ {"usboi", "America/Boise"},
+ {"uschi", "America/Chicago"},
+ {"usden", "America/Denver"},
+ {"usdet", "America/Detroit"},
+ {"ushnl", "Pacific/Honolulu"},
+ {"usind", "America/Indianapolis"},
+ {"usinvev", "America/Indiana/Vevay"},
+ {"usjnu", "America/Juneau"},
+ {"usknx", "America/Indiana/Knox"},
+ {"uslax", "America/Los_Angeles"},
+ {"uslui", "America/Louisville"},
+ {"usmnm", "America/Menominee"},
+ {"usmtm", "America/Metlakatla"},
+ {"usmoc", "America/Kentucky/Monticello"},
+ {"usndcnt", "America/North_Dakota/Center"},
+ {"usndnsl", "America/North_Dakota/New_Salem"},
+ {"usnyc", "America/New_York"},
+ {"usoea", "America/Indiana/Vincennes"},
+ {"usome", "America/Nome"},
+ {"usphx", "America/Phoenix"},
+ {"ussit", "America/Sitka"},
+ {"ustel", "America/Indiana/Tell_City"},
+ {"uswlz", "America/Indiana/Winamac"},
+ {"uswsq", "America/Indiana/Petersburg"},
+ {"usxul", "America/North_Dakota/Beulah"},
+ {"usyak", "America/Yakutat"},
+ {"utc", "Etc/UTC"},
+ {"utce01", "Etc/GMT-1"},
+ {"utce02", "Etc/GMT-2"},
+ {"utce03", "Etc/GMT-3"},
+ {"utce04", "Etc/GMT-4"},
+ {"utce05", "Etc/GMT-5"},
+ {"utce06", "Etc/GMT-6"},
+ {"utce07", "Etc/GMT-7"},
+ {"utce08", "Etc/GMT-8"},
+ {"utce09", "Etc/GMT-9"},
+ {"utce10", "Etc/GMT-10"},
+ {"utce11", "Etc/GMT-11"},
+ {"utce12", "Etc/GMT-12"},
+ {"utce13", "Etc/GMT-13"},
+ {"utce14", "Etc/GMT-14"},
+ {"utcw01", "Etc/GMT+1"},
+ {"utcw02", "Etc/GMT+2"},
+ {"utcw03", "Etc/GMT+3"},
+ {"utcw04", "Etc/GMT+4"},
+ {"utcw05", "Etc/GMT+5"},
+ {"utcw06", "Etc/GMT+6"},
+ {"utcw07", "Etc/GMT+7"},
+ {"utcw08", "Etc/GMT+8"},
+ {"utcw09", "Etc/GMT+9"},
+ {"utcw10", "Etc/GMT+10"},
+ {"utcw11", "Etc/GMT+11"},
+ {"utcw12", "Etc/GMT+12"},
+ {"uymvd", "America/Montevideo"},
+ {"uzskd", "Asia/Samarkand"},
+ {"uztas", "Asia/Tashkent"},
+ {"vavat", "Europe/Vatican"},
+ {"vcsvd", "America/St_Vincent"},
+ {"veccs", "America/Caracas"},
+ {"vgtov", "America/Tortola"},
+ {"vistt", "America/St_Thomas"},
+ {"vnsgn", "Asia/Saigon"},
+ {"vuvli", "Pacific/Efate"},
+ {"wfmau", "Pacific/Wallis"},
+ {"wsapw", "Pacific/Apia"},
+ {"yeade", "Asia/Aden"},
+ {"ytmam", "Indian/Mayotte"},
+ {"zajnb", "Africa/Johannesburg"},
+ {"zmlun", "Africa/Lusaka"},
+ {"zwhre", "Africa/Harare"},
+
+ };
+ }
+
+ @DataProvider(name="getLocalizedDateTimePattern")
+ Object[][] getLocalizedDateTimePattern() {
+ return new Object[][] {
+ // Locale, Expected pattern,
+ {Locale.US, FormatStyle.FULL, "EEEE, MMMM d, y 'at' h:mm:ss a zzzz"},
+ {Locale.US, FormatStyle.LONG, "MMMM d, y 'at' h:mm:ss a z"},
+ {Locale.US, FormatStyle.MEDIUM, "MMM d, y, h:mm:ss a"},
+ {Locale.US, FormatStyle.SHORT, "M/d/yy, h:mm a"},
+ {RG_GB, FormatStyle.FULL, "EEEE, d MMMM y 'at' HH:mm:ss zzzz"},
+ {RG_GB, FormatStyle.LONG, "d MMMM y 'at' HH:mm:ss z"},
+ {RG_GB, FormatStyle.MEDIUM, "d MMM y, HH:mm:ss"},
+ {RG_GB, FormatStyle.SHORT, "dd/MM/y, HH:mm"},
+ };
+ }
+
+ @DataProvider(name="getDisplayName")
+ Object[][] getDisplayName() {
+ return new Object[][] {
+ // Locale, field, Expected name,
+ {Locale.US, ChronoField.AMPM_OF_DAY, "AM/PM"},
+ // Android-changed: Android uses CLDR data.
+ // {RG_GB, ChronoField.AMPM_OF_DAY, "am/pm"},
+ {RG_GB, ChronoField.AMPM_OF_DAY, "AM/PM"},
+ };
+ }
+
+ @Test(dataProvider="localizedBy")
+ public void test_localizedBy(Locale locale, Chronology chrono, ZoneId zone,
+ Chronology chronoExpected, ZoneId zoneExpected,
+ String formatExpected) {
+ DateTimeFormatter dtf =
+ DateTimeFormatter.ofLocalizedDateTime(FormatStyle.FULL, FormatStyle.FULL)
+ .withChronology(chrono).withZone(zone).localizedBy(locale);
+ assertEquals(dtf.getChronology(), chronoExpected);
+ assertEquals(dtf.getZone(), zoneExpected);
+ String formatted = dtf.format(ZDT);
+ assertEquals(formatted, formatExpected);
+ assertEquals(dtf.parse(formatted, ZonedDateTime::from),
+ zoneExpected != null ? ZDT.withZoneSameInstant(zoneExpected) : ZDT);
+ }
+
+ @Test(dataProvider="withLocale")
+ public void test_withLocale(Locale locale, Chronology chrono, ZoneId zone,
+ Chronology chronoExpected, ZoneId zoneExpected,
+ String formatExpected) {
+ DateTimeFormatter dtf =
+ DateTimeFormatter.ofLocalizedDateTime(FormatStyle.FULL, FormatStyle.FULL)
+ .withChronology(chrono).withZone(zone).withLocale(locale);
+ assertEquals(dtf.getChronology(), chronoExpected);
+ assertEquals(dtf.getZone(), zoneExpected);
+ String formatted = dtf.format(ZDT);
+ assertEquals(formatted, formatExpected);
+ assertEquals(dtf.parse(formatted, ZonedDateTime::from),
+ zoneExpected != null ? ZDT.withZoneSameInstant(zoneExpected) : ZDT);
+ }
+
+ @Test(dataProvider="firstDayOfWeek")
+ public void test_firstDayOfWeek(Locale locale, DayOfWeek dowExpected) {
+ DayOfWeek dow = WeekFields.of(locale).getFirstDayOfWeek();
+ assertEquals(dow, dowExpected);
+ }
+
+ @Test(dataProvider="minDaysInFirstWeek")
+ public void test_minDaysInFirstWeek(Locale locale, int minDaysExpected) {
+ int minDays = WeekFields.of(locale).getMinimalDaysInFirstWeek();
+ assertEquals(minDays, minDaysExpected);
+ }
+
+ @Test(dataProvider="ofPattern")
+ public void test_ofPattern(Locale locale,
+ Chronology chronoExpected, ZoneId zoneExpected,
+ String formatExpected) {
+ DateTimeFormatter dtf =
+ DateTimeFormatter.ofPattern(PATTERN, locale);
+ assertEquals(dtf.getChronology(), chronoExpected);
+ assertEquals(dtf.getZone(), zoneExpected);
+ String formatted = dtf.format(ZDT);
+ assertEquals(formatted, formatExpected);
+ assertEquals(dtf.parse(formatted, ZonedDateTime::from),
+ zoneExpected != null ? ZDT.withZoneSameInstant(zoneExpected) : ZDT);
+ }
+
+ @Test(dataProvider="ofPattern")
+ public void test_toFormatter(Locale locale,
+ Chronology chronoExpected, ZoneId zoneExpected,
+ String formatExpected) {
+ DateTimeFormatter dtf =
+ new DateTimeFormatterBuilder().appendPattern(PATTERN).toFormatter(locale);
+ assertEquals(dtf.getChronology(), chronoExpected);
+ assertEquals(dtf.getZone(), zoneExpected);
+ String formatted = dtf.format(ZDT);
+ assertEquals(formatted, formatExpected);
+ assertEquals(dtf.parse(formatted, ZonedDateTime::from),
+ zoneExpected != null ? ZDT.withZoneSameInstant(zoneExpected) : ZDT);
+ }
+
+ @Test(dataProvider="shortTZID")
+ public void test_shortTZID(String shortID, String expectedZone) {
+ Locale l = Locale.forLanguageTag("en-US-u-tz-" + shortID);
+ DateTimeFormatter dtf =
+ DateTimeFormatter.ofLocalizedDateTime(FormatStyle.FULL, FormatStyle.FULL)
+ .localizedBy(l);
+ assertEquals(dtf.getZone(), ZoneId.of(expectedZone));
+ }
+
+ // Android-changed: Android doesn't support "rg" extension yet.
+ @Test(dataProvider="getLocalizedDateTimePattern", enabled = false)
+ public void test_getLocalizedDateTimePattern(Locale l, FormatStyle s, String expectedPattern) {
+ DateTimeFormatterBuilder dtfb = new DateTimeFormatterBuilder();
+ assertEquals(dtfb.getLocalizedDateTimePattern(s, s, IsoChronology.INSTANCE, l),
+ expectedPattern);
+ }
+
+ @Test(dataProvider="getDisplayName")
+ public void test_getDisplayName(Locale l, TemporalField f, String expectedName) {
+ assertEquals(f.getDisplayName(l), expectedName);
+ }
+}
diff --git a/ojluni/src/test/java/time/test/java/time/format/TestZoneOffsetParser.java b/ojluni/src/test/java/time/test/java/time/format/TestZoneOffsetParser.java
index 68e84a2..3242554 100644
--- a/ojluni/src/test/java/time/test/java/time/format/TestZoneOffsetParser.java
+++ b/ojluni/src/test/java/time/test/java/time/format/TestZoneOffsetParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -296,7 +296,7 @@
@DataProvider(name="bigOffsets")
Object[][] provider_bigOffsets() {
return new Object[][] {
- {"+HH", "+59", 59 * 3600},
+ {"+HH", "+19", 19 * 3600},
{"+HH", "-19", -(19 * 3600)},
{"+HHMM", "+1801", 18 * 3600 + 1 * 60},
diff --git a/ojluni/src/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java b/ojluni/src/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java
index 619889b..03a2f2e 100644
--- a/ojluni/src/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java
+++ b/ojluni/src/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -42,14 +42,14 @@
import java.util.Random;
import java.util.Set;
import java.util.TimeZone;
-import jdk.testlibrary.RandomFactory;
+import jdk.test.lib.RandomFactory;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
/*
* @test
- * @bug 8081022
+ * @bug 8081022 8151876 8166875 8189784 8206980
* @key randomness
*/
@@ -79,6 +79,25 @@
.with(ChronoField.SECOND_OF_DAY, r.nextInt(86400));
// Android-changed: loop over locales first to speed up test. TimeZoneNames are cached
// per locale, but the cache only holds the most recently used locales.
+ /*
+ for (String zid : zids) {
+ if (zid.equals("ROC") || zid.startsWith("Etc/GMT")) {
+ continue; // TBD: match jdk behavior?
+ }
+ zdt = zdt.withZoneSameLocal(ZoneId.of(zid));
+ TimeZone tz = TimeZone.getTimeZone(zid);
+ boolean isDST = tz.inDaylightTime(new Date(zdt.toInstant().toEpochMilli()));
+ for (Locale locale : locales) {
+ boolean isDST = tz.inDaylightTime(new Date(zdt.toInstant().toEpochMilli()));
+ String longDisplayName = tz.getDisplayName(isDST, TimeZone.LONG, locale);
+ String shortDisplayName = tz.getDisplayName(isDST, TimeZone.SHORT, locale);
+ if ((longDisplayName.startsWith("GMT+") && shortDisplayName.startsWith("GMT+"))
+ || (longDisplayName.startsWith("GMT-") && shortDisplayName.startsWith("GMT-"))) {
+ printText(locale, zdt, TextStyle.FULL, tz, tz.getID());
+ printText(locale, zdt, TextStyle.SHORT, tz, tz.getID());
+ continue;
+ }
+ */
for (Locale locale : locales) {
// Android-changed: "ji" isn't correctly aliased to "yi", see http//b/8634320.
if (locale.getLanguage().equals("ji")) {
@@ -101,9 +120,9 @@
}
boolean isDST = tz.inDaylightTime(new Date(zdt.toInstant().toEpochMilli()));
printText(locale, zdt, TextStyle.FULL, tz,
- tz.getDisplayName(isDST, TimeZone.LONG, locale));
+ tz.getDisplayName(isDST, TimeZone.LONG, locale));
printText(locale, zdt, TextStyle.SHORT, tz,
- tz.getDisplayName(isDST, TimeZone.SHORT, locale));
+ tz.getDisplayName(isDST, TimeZone.SHORT, locale));
}
}
}
@@ -157,6 +176,7 @@
private static Set<ZoneId> preferred = new HashSet<>(Arrays.asList(new ZoneId[] {
ZoneId.of("EST", ZoneId.SHORT_IDS),
ZoneId.of("Asia/Taipei"),
+ ZoneId.of("Asia/Macau"),
ZoneId.of("CET"),
}));
@@ -188,8 +208,9 @@
// {"America/New_York", "Eastern Standard Time", none, Locale.ENGLISH, TextStyle.FULL},
// {"EST", "Eastern Standard Time", preferred, Locale.ENGLISH, TextStyle.FULL},
// {"Europe/Paris", "Central European Time", none, Locale.ENGLISH, TextStyle.FULL},
- // {"CET", "Central European Time", preferred, Locale.UK, TextStyle.FULL},
+// {"CET", "Central European Time", preferred, Locale.ENGLISH, TextStyle.FULL}, no three-letter ID in CLDR
// {"Asia/Shanghai", "China Standard Time", none, Locale.ENGLISH, TextStyle.FULL},
+ {"Asia/Macau", "China Standard Time", preferred, Locale.ENGLISH, TextStyle.FULL},
// {"Asia/Taipei", "China Standard Time", preferred, Locale.ENGLISH, TextStyle.FULL},
// {"America/Chicago", "CST", none, Locale.ENGLISH, TextStyle.SHORT},
// {"Asia/Taipei", "CST", preferred, Locale.ENGLISH, TextStyle.SHORT},
@@ -197,6 +218,13 @@
{"Australia/South", "ACST", preferred_s, new Locale("en", "AU"), TextStyle.SHORT},
// {"America/Chicago", "CDT", none, Locale.ENGLISH, TextStyle.SHORT},
// {"Asia/Shanghai", "CDT", preferred_s, Locale.ENGLISH, TextStyle.SHORT},
+ // {"America/Juneau", "AKST", none, Locale.ENGLISH, TextStyle.SHORT},
+ // {"America/Juneau", "AKDT", none, Locale.ENGLISH, TextStyle.SHORT},
+ {"Pacific/Honolulu", "HST", none, Locale.ENGLISH, TextStyle.SHORT},
+ // {"America/Halifax", "AST", none, Locale.ENGLISH, TextStyle.SHORT},
+ {"Z", "Z", none, Locale.ENGLISH, TextStyle.SHORT},
+ {"Z", "Z", none, Locale.US, TextStyle.SHORT},
+ {"Z", "Z", none, Locale.CANADA, TextStyle.SHORT},
};
}
diff --git a/ojluni/src/test/java/time/test/java/time/format/ZoneName.java b/ojluni/src/test/java/time/test/java/time/format/ZoneName.java
index 2c49446..35a2a08 100644
--- a/ojluni/src/test/java/time/test/java/time/format/ZoneName.java
+++ b/ojluni/src/test/java/time/test/java/time/format/ZoneName.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -20,13 +20,20 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
package test.java.time.format;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
+/**
+ * A helper class to map a zone name to metazone and back to the
+ * appropriate zone id for the particular locale.
+ * <p>
+ * The zid<->metazone mappings are based on CLDR metaZones.xml.
+ * The alias mappings are based on Link entries in tzdb data files and
+ * CLDR's supplementalMetadata.xml.
+ */
class ZoneName {
public static String toZid(String zid, Locale locale) {
@@ -54,699 +61,922 @@
}
private static final String[] zidMap = new String[] {
- "Asia/Bangkok", "Indochina", "Asia/Saigon",
- "Pacific/Pago_Pago", "Samoa", "Pacific/Apia",
- "Africa/Blantyre", "Africa_Central", "Africa/Maputo",
- "America/Argentina/San_Juan", "Argentina", "America/Buenos_Aires",
- "America/Cancun", "America_Central", "America/Chicago",
- "Pacific/Nauru", "Nauru", "Pacific/Nauru",
- "America/Atikokan", "America_Eastern", "America/New_York",
- "Africa/Asmara", "Africa_Eastern", "Africa/Nairobi",
- "Europe/Berlin", "Europe_Central", "Europe/Paris",
- "Asia/Kolkata", "India", "Asia/Calcutta",
- "Australia/Darwin", "Australia_Central", "Australia/Adelaide",
- "America/Guayaquil", "Ecuador", "America/Guayaquil",
- "Europe/Vienna", "Europe_Central", "Europe/Paris",
- "Atlantic/St_Helena", "GMT", "Atlantic/Reykjavik",
- "Europe/London", "GMT", "Atlantic/Reykjavik",
- "Europe/Moscow", "Moscow", "Europe/Moscow",
- "America/St_Vincent", "Atlantic", "America/Halifax",
- "America/Bogota", "Colombia", "America/Bogota",
- "America/Marigot", "Atlantic", "America/Halifax",
- "Europe/Sarajevo", "Europe_Central", "Europe/Paris",
- "America/Hermosillo", "America_Mountain", "America/Denver",
- "America/Winnipeg", "America_Central", "America/Chicago",
- "America/Rainy_River", "America_Central", "America/Chicago",
- "Indian/Mahe", "Seychelles", "Indian/Mahe",
- "Africa/Freetown", "GMT", "Atlantic/Reykjavik",
- "America/Grand_Turk", "America_Eastern", "America/New_York",
- "America/Argentina/Ushuaia", "Argentina", "America/Buenos_Aires",
- "Atlantic/Azores", "Azores", "Atlantic/Azores",
- "Asia/Harbin", "China", "Asia/Shanghai",
- "America/Cuiaba", "Amazon", "America/Manaus",
- "Asia/Bahrain", "Arabian", "Asia/Riyadh",
- "Asia/Katmandu", "Nepal", "Asia/Katmandu",
- "Pacific/Galapagos", "Galapagos", "Pacific/Galapagos",
- "Asia/Brunei", "Brunei", "Asia/Brunei",
- "Africa/Kigali", "Africa_Central", "Africa/Maputo",
- "Asia/Makassar", "Indonesia_Central", "Asia/Makassar",
- "Africa/Maputo", "Africa_Central", "Africa/Maputo",
- "Asia/Kamchatka", "Magadan", "Asia/Magadan",
- "Atlantic/Faroe", "Europe_Western", "Atlantic/Canary",
- "America/El_Salvador", "America_Central", "America/Chicago",
- "Asia/Saigon", "Indochina", "Asia/Saigon",
- "Africa/Kinshasa", "Africa_Western", "Africa/Lagos",
- "Europe/Oslo", "Europe_Central", "Europe/Paris",
- "Asia/Hong_Kong", "Hong_Kong", "Asia/Hong_Kong",
- "Pacific/Midway", "Samoa", "Pacific/Apia",
- "Africa/Douala", "Africa_Western", "Africa/Lagos",
- "Europe/San_Marino", "Europe_Central", "Europe/Paris",
- "Pacific/Chuuk", "Truk", "Pacific/Truk",
- "Africa/Gaborone", "Africa_Central", "Africa/Maputo",
- "Africa/Tunis", "Europe_Central", "Europe/Paris",
- "Africa/Khartoum", "Africa_Eastern", "Africa/Nairobi",
- "Europe/Isle_of_Man", "GMT", "Atlantic/Reykjavik",
- "Europe/Skopje", "Europe_Central", "Europe/Paris",
- "America/Merida", "America_Central", "America/Chicago",
- "Antarctica/DumontDUrville", "DumontDUrville", "Antarctica/DumontDUrville",
- "Atlantic/Reykjavik", "GMT", "Atlantic/Reykjavik",
- "Indian/Mauritius", "Mauritius", "Indian/Mauritius",
- "Africa/Malabo", "Africa_Western", "Africa/Lagos",
- "Africa/Juba", "Africa_Eastern", "Africa/Nairobi",
- "America/Resolute", "America_Central", "America/Chicago",
+ // From metaZones.xml
"Africa/Abidjan", "GMT", "Atlantic/Reykjavik",
- "Antarctica/McMurdo", "New_Zealand", "Pacific/Auckland",
- "Asia/Thimphu", "Bhutan", "Asia/Thimphu",
- "Europe/Zaporozhye", "Europe_Eastern", "Europe/Bucharest",
- "Antarctica/Davis", "Davis", "Antarctica/Davis",
- "Indian/Antananarivo", "Africa_Eastern", "Africa/Nairobi",
- "Africa/Harare", "Africa_Central", "Africa/Maputo",
- "Pacific/Marquesas", "Marquesas", "Pacific/Marquesas",
- "Africa/Tripoli", "Europe_Eastern", "Europe/Bucharest",
- "America/North_Dakota/Beulah", "America_Central", "America/Chicago",
- "America/Buenos_Aires", "Argentina", "America/Buenos_Aires",
- "America/Tortola", "Atlantic", "America/Halifax",
- "Asia/Kuwait", "Arabian", "Asia/Riyadh",
- "Europe/Rome", "Europe_Central", "Europe/Paris",
- "America/Eirunepe", "Amazon", "America/Manaus",
- "Australia/Hobart", "Australia_Eastern", "Australia/Sydney",
- "America/Thule", "Atlantic", "America/Halifax",
- "Asia/Beirut", "Europe_Eastern", "Europe/Bucharest",
- "America/Bahia_Banderas", "America_Central", "America/Chicago",
- "Africa/Dar_es_Salaam", "Africa_Eastern", "Africa/Nairobi",
- "America/Argentina/Tucuman", "Argentina", "America/Buenos_Aires",
- "America/Paramaribo", "Suriname", "America/Paramaribo",
- "Africa/Kampala", "Africa_Eastern", "Africa/Nairobi",
- "Pacific/Port_Moresby", "Papua_New_Guinea", "Pacific/Port_Moresby",
- "America/Mendoza", "Argentina", "America/Buenos_Aires",
- "Asia/Dushanbe", "Tajikistan", "Asia/Dushanbe",
- "Asia/Qyzylorda", "Kazakhstan_Eastern", "Asia/Almaty",
- "Antarctica/Vostok", "Vostok", "Antarctica/Vostok",
- "Pacific/Majuro", "Marshall_Islands", "Pacific/Majuro",
- "Asia/Tehran", "Iran", "Asia/Tehran",
- "Asia/Hovd", "Hovd", "Asia/Hovd",
- "Antarctica/Rothera", "Rothera", "Antarctica/Rothera",
- "Africa/Brazzaville", "Africa_Western", "Africa/Lagos",
- "Europe/Tirane", "Europe_Central", "Europe/Paris",
- "Asia/Urumqi", "China", "Asia/Shanghai",
- "Asia/Krasnoyarsk", "Krasnoyarsk", "Asia/Krasnoyarsk",
- "America/Tegucigalpa", "America_Central", "America/Chicago",
- "Asia/Vientiane", "Indochina", "Asia/Saigon",
- "Asia/Pontianak", "Indonesia_Western", "Asia/Jakarta",
- "America/Bahia", "Brasilia", "America/Sao_Paulo",
- "Asia/Choibalsan", "Choibalsan", "Asia/Choibalsan",
- "America/Regina", "America_Central", "America/Chicago",
- "Africa/Cairo", "Europe_Eastern", "Europe/Bucharest",
- "Asia/Irkutsk", "Irkutsk", "Asia/Irkutsk",
- "Europe/Luxembourg", "Europe_Central", "Europe/Paris",
- "America/St_Kitts", "Atlantic", "America/Halifax",
- "America/Manaus", "Amazon", "America/Manaus",
- "America/Noronha", "Noronha", "America/Noronha",
- "Pacific/Gambier", "Gambier", "Pacific/Gambier",
- "America/Edmonton", "America_Mountain", "America/Denver",
- "Pacific/Palau", "Palau", "Pacific/Palau",
- "America/Lower_Princes", "Atlantic", "America/Halifax",
- "Africa/Ouagadougou", "GMT", "Atlantic/Reykjavik",
- "Asia/Yerevan", "Armenia", "Asia/Yerevan",
- "America/Montevideo", "Uruguay", "America/Montevideo",
- "Europe/Minsk", "Europe_Eastern", "Europe/Bucharest",
- "Europe/Amsterdam", "Europe_Central", "Europe/Paris",
- "Pacific/Efate", "Vanuatu", "Pacific/Efate",
- "Asia/Manila", "Philippines", "Asia/Manila",
- "America/Dawson", "America_Pacific", "America/Los_Angeles",
- "America/Argentina/Cordoba", "Argentina", "America/Buenos_Aires",
- "Australia/Melbourne", "Australia_Eastern", "Australia/Sydney",
- "Asia/Rangoon", "Myanmar", "Asia/Rangoon",
- "America/Los_Angeles", "America_Pacific", "America/Los_Angeles",
- "Africa/Casablanca", "Europe_Western", "Atlantic/Canary",
- "Africa/Porto-Novo", "Africa_Western", "Africa/Lagos",
- "Asia/Macau", "China", "Asia/Shanghai",
- "America/Boa_Vista", "Amazon", "America/Manaus",
- "Europe/Guernsey", "GMT", "Atlantic/Reykjavik",
- "Africa/Monrovia", "GMT", "Atlantic/Reykjavik",
- "America/Godthab", "Greenland_Western", "America/Godthab",
- "Africa/Ceuta", "Europe_Central", "Europe/Paris",
- "Asia/Oral", "Kazakhstan_Western", "Asia/Aqtobe",
- "America/Yakutat", "Alaska", "America/Juneau",
- "Indian/Mayotte", "Africa_Eastern", "Africa/Nairobi",
- "America/Denver", "America_Mountain", "America/Denver",
- "America/New_York", "America_Eastern", "America/New_York",
- "Pacific/Rarotonga", "Cook", "Pacific/Rarotonga",
- "America/Louisville", "America_Eastern", "America/New_York",
- "Africa/El_Aaiun", "Europe_Western", "Atlantic/Canary",
- "Africa/Sao_Tome", "GMT", "Atlantic/Reykjavik",
- "Pacific/Fiji", "Fiji", "Pacific/Fiji",
- "Asia/Damascus", "Europe_Eastern", "Europe/Bucharest",
- "Asia/Ulaanbaatar", "Mongolia", "Asia/Ulaanbaatar",
- "America/Cayman", "America_Eastern", "America/New_York",
- "America/Tijuana", "America_Pacific", "America/Los_Angeles",
- "Atlantic/Bermuda", "Atlantic", "America/Halifax",
- "Australia/Sydney", "Australia_Eastern", "Australia/Sydney",
- "Asia/Aden", "Arabian", "Asia/Riyadh",
- "Australia/Eucla", "Australia_CentralWestern", "Australia/Eucla",
- "America/Indiana/Petersburg", "America_Eastern", "America/New_York",
- "America/Panama", "America_Eastern", "America/New_York",
- "Europe/Istanbul", "Europe_Eastern", "Europe/Bucharest",
- "America/Kralendijk", "Atlantic", "America/Halifax",
- "America/Catamarca", "Argentina", "America/Buenos_Aires",
- "America/Nassau", "America_Eastern", "America/New_York",
- "Europe/Paris", "Europe_Central", "Europe/Paris",
- "Asia/Jakarta", "Indonesia_Western", "Asia/Jakarta",
- "Australia/Lindeman", "Australia_Eastern", "Australia/Sydney",
- "America/Sao_Paulo", "Brasilia", "America/Sao_Paulo",
- "America/Juneau", "Alaska", "America/Juneau",
- "America/Grenada", "Atlantic", "America/Halifax",
- "America/Cayenne", "French_Guiana", "America/Cayenne",
- "Antarctica/Casey", "Australia_Western", "Australia/Perth",
- "Africa/Algiers", "Europe_Central", "Europe/Paris",
- "America/Miquelon", "Pierre_Miquelon", "America/Miquelon",
- "Asia/Tokyo", "Japan", "Asia/Tokyo",
- "Africa/Windhoek", "Africa_Western", "Africa/Lagos",
- "Africa/Bujumbura", "Africa_Central", "Africa/Maputo",
- "America/Guatemala", "America_Central", "America/Chicago",
- "Africa/Dakar", "GMT", "Atlantic/Reykjavik",
- "Asia/Bishkek", "Kyrgystan", "Asia/Bishkek",
- "America/Guadeloupe", "Atlantic", "America/Halifax",
- "Africa/Ndjamena", "Africa_Western", "Africa/Lagos",
- "Europe/Simferopol", "Europe_Eastern", "Europe/Bucharest",
- "America/Santa_Isabel", "America_Pacific", "America/Los_Angeles",
- "Asia/Dubai", "Gulf", "Asia/Dubai",
- "America/Maceio", "Brasilia", "America/Sao_Paulo",
- "America/Anchorage", "Alaska", "America/Juneau",
- "Australia/Currie", "Australia_Eastern", "Australia/Sydney",
- "Africa/Djibouti", "Africa_Eastern", "Africa/Nairobi",
- "Europe/Budapest", "Europe_Central", "Europe/Paris",
- "America/Argentina/Salta", "Argentina", "America/Buenos_Aires",
- "Asia/Calcutta", "India", "Asia/Calcutta",
- "America/Indiana/Winamac", "America_Eastern", "America/New_York",
- "Asia/Yekaterinburg", "Yekaterinburg", "Asia/Yekaterinburg",
- "America/Santiago", "Chile", "America/Santiago",
- "Asia/Aqtobe", "Kazakhstan_Western", "Asia/Aqtobe",
- "Asia/Dili", "East_Timor", "Asia/Dili",
- "America/Detroit", "America_Eastern", "America/New_York",
- "Africa/Libreville", "Africa_Western", "Africa/Lagos",
- "Pacific/Ponape", "Ponape", "Pacific/Ponape",
- "Pacific/Wallis", "Wallis", "Pacific/Wallis",
- "Asia/Vladivostok", "Vladivostok", "Asia/Vladivostok",
- "Africa/Lubumbashi", "Africa_Central", "Africa/Maputo",
- "Africa/Asmera", "Africa_Eastern", "Africa/Nairobi",
- "Pacific/Guam", "Chamorro", "Pacific/Saipan",
- "America/Chicago", "America_Central", "America/Chicago",
- "America/Swift_Current", "America_Central", "America/Chicago",
- "America/Coral_Harbour", "America_Eastern", "America/New_York",
- "America/Cambridge_Bay", "America_Mountain", "America/Denver",
- "America/Costa_Rica", "America_Central", "America/Chicago",
- "America/Curacao", "Atlantic", "America/Halifax",
- "America/Recife", "Brasilia", "America/Sao_Paulo",
- "Africa/Bangui", "Africa_Western", "Africa/Lagos",
- "America/Cordoba", "Argentina", "America/Buenos_Aires",
- "Asia/Baghdad", "Arabian", "Asia/Riyadh",
- "America/Shiprock", "America_Mountain", "America/Denver",
- "America/Glace_Bay", "Atlantic", "America/Halifax",
- "America/North_Dakota/Center", "America_Central", "America/Chicago",
- "Europe/Stockholm", "Europe_Central", "Europe/Paris",
- "America/Halifax", "Atlantic", "America/Halifax",
- "Atlantic/Canary", "Europe_Western", "Atlantic/Canary",
- "Europe/Volgograd", "Volgograd", "Europe/Volgograd",
- "America/Moncton", "Atlantic", "America/Halifax",
- "Pacific/Tongatapu", "Tonga", "Pacific/Tongatapu",
- "America/Argentina/Buenos_Aires", "Argentina", "America/Buenos_Aires",
- "Asia/Samarkand", "Uzbekistan", "Asia/Tashkent",
- "Pacific/Apia", "Samoa", "Pacific/Apia",
- "America/Sitka", "Alaska", "America/Juneau",
- "Europe/Warsaw", "Europe_Central", "Europe/Paris",
"Africa/Accra", "GMT", "Atlantic/Reykjavik",
- "Europe/Bratislava", "Europe_Central", "Europe/Paris",
- "Europe/Zurich", "Europe_Central", "Europe/Paris",
- "Indian/Reunion", "Reunion", "Indian/Reunion",
- "America/Mazatlan", "America_Mountain", "America/Denver",
- "Pacific/Tarawa", "Gilbert_Islands", "Pacific/Tarawa",
- "America/Indiana/Knox", "America_Central", "America/Chicago",
- "Asia/Tbilisi", "Georgia", "Asia/Tbilisi",
- "Asia/Novosibirsk", "Novosibirsk", "Asia/Novosibirsk",
- "Atlantic/Faeroe", "Europe_Western", "Atlantic/Canary",
- "Africa/Bissau", "GMT", "Atlantic/Reykjavik",
- "Asia/Amman", "Europe_Eastern", "Europe/Bucharest",
- "Africa/Lagos", "Africa_Western", "Africa/Lagos",
- "Africa/Banjul", "GMT", "Atlantic/Reykjavik",
- "America/Araguaina", "Brasilia", "America/Sao_Paulo",
- "America/Nipigon", "America_Eastern", "America/New_York",
- "Europe/Vilnius", "Europe_Eastern", "Europe/Bucharest",
- "America/Montserrat", "Atlantic", "America/Halifax",
- "Asia/Baku", "Azerbaijan", "Asia/Baku",
- "Africa/Lusaka", "Africa_Central", "Africa/Maputo",
- "Europe/Uzhgorod", "Europe_Eastern", "Europe/Bucharest",
- "America/Argentina/Rio_Gallegos", "Argentina", "America/Buenos_Aires",
- "America/Blanc-Sablon", "Atlantic", "America/Halifax",
- "Asia/Kabul", "Afghanistan", "Asia/Kabul",
- "America/Jamaica", "America_Eastern", "America/New_York",
- "Europe/Vatican", "Europe_Central", "Europe/Paris",
- "Africa/Nouakchott", "GMT", "Atlantic/Reykjavik",
"Africa/Addis_Ababa", "Africa_Eastern", "Africa/Nairobi",
- "Europe/Athens", "Europe_Eastern", "Europe/Bucharest",
- "Atlantic/Madeira", "Europe_Western", "Atlantic/Canary",
- "America/Thunder_Bay", "America_Eastern", "America/New_York",
- "Europe/Brussels", "Europe_Central", "Europe/Paris",
- "Africa/Luanda", "Africa_Western", "Africa/Lagos",
- "Africa/Mogadishu", "Africa_Eastern", "Africa/Nairobi",
- "America/Matamoros", "America_Central", "America/Chicago",
- "Pacific/Norfolk", "Norfolk", "Pacific/Norfolk",
- "America/Scoresbysund", "Greenland_Eastern", "America/Scoresbysund",
- "America/Indianapolis", "America_Eastern", "America/New_York",
- "Pacific/Pitcairn", "Pitcairn", "Pacific/Pitcairn",
- "Asia/Singapore", "Singapore", "Asia/Singapore",
- "America/Port-au-Prince", "America_Eastern", "America/New_York",
- "Pacific/Honolulu", "Hawaii_Aleutian", "Pacific/Honolulu",
- "Antarctica/Syowa", "Syowa", "Antarctica/Syowa",
- "Atlantic/Cape_Verde", "Cape_Verde", "Atlantic/Cape_Verde",
- "America/Asuncion", "Paraguay", "America/Asuncion",
- "America/Martinique", "Atlantic", "America/Halifax",
- "Europe/Gibraltar", "Europe_Central", "Europe/Paris",
- "Africa/Lome", "GMT", "Atlantic/Reykjavik",
- "Australia/Lord_Howe", "Lord_Howe", "Australia/Lord_Howe",
- "America/Argentina/La_Rioja", "Argentina", "America/Buenos_Aires",
- "Europe/Jersey", "GMT", "Atlantic/Reykjavik",
- "America/Kentucky/Louisville", "America_Eastern", "America/New_York",
- "America/Monterrey", "America_Central", "America/Chicago",
- "Europe/Belgrade", "Europe_Central", "Europe/Paris",
- "Asia/Gaza", "Europe_Eastern", "Europe/Bucharest",
- "Asia/Ho_Chi_Minh", "Indochina", "Asia/Saigon",
- "Europe/Prague", "Europe_Central", "Europe/Paris",
- "Indian/Christmas", "Christmas", "Indian/Christmas",
- "Pacific/Fakaofo", "Tokelau", "Pacific/Fakaofo",
- "America/Dominica", "Atlantic", "America/Halifax",
- "America/Ojinaga", "America_Mountain", "America/Denver",
- "Asia/Colombo", "India", "Asia/Calcutta",
- "Asia/Nicosia", "Europe_Eastern", "Europe/Bucharest",
- "Europe/Copenhagen", "Europe_Central", "Europe/Paris",
- "America/Creston", "America_Mountain", "America/Denver",
- "Asia/Ashgabat", "Turkmenistan", "Asia/Ashgabat",
- "Asia/Shanghai", "China", "Asia/Shanghai",
- "Pacific/Easter", "Easter", "Pacific/Easter",
- "Africa/Maseru", "Africa_Southern", "Africa/Johannesburg",
- "America/La_Paz", "Bolivia", "America/La_Paz",
- "Pacific/Truk", "Truk", "Pacific/Truk",
- "America/Inuvik", "America_Mountain", "America/Denver",
- "America/Belem", "Brasilia", "America/Sao_Paulo",
- "Asia/Hebron", "Europe_Eastern", "Europe/Bucharest",
- "Asia/Jerusalem", "Israel", "Asia/Jerusalem",
- "America/Belize", "America_Central", "America/Chicago",
- "America/Rio_Branco", "Amazon", "America/Manaus",
- "America/Dawson_Creek", "America_Mountain", "America/Denver",
- "America/Anguilla", "Atlantic", "America/Halifax",
- "America/Port_of_Spain", "Atlantic", "America/Halifax",
- "America/St_Barthelemy", "Atlantic", "America/Halifax",
- "America/Indiana/Marengo", "America_Eastern", "America/New_York",
- "America/St_Johns", "Newfoundland", "America/St_Johns",
- "Asia/Jayapura", "Indonesia_Eastern", "Asia/Jayapura",
- "Europe/Riga", "Europe_Eastern", "Europe/Bucharest",
- "America/Phoenix", "America_Mountain", "America/Denver",
- "America/Boise", "America_Mountain", "America/Denver",
- "Pacific/Kiritimati", "Line_Islands", "Pacific/Kiritimati",
- "Africa/Johannesburg", "Africa_Southern", "Africa/Johannesburg",
- "America/Pangnirtung", "America_Eastern", "America/New_York",
- "America/Toronto", "America_Eastern", "America/New_York",
- "Australia/Brisbane", "Australia_Eastern", "Australia/Sydney",
- "Asia/Aqtau", "Kazakhstan_Western", "Asia/Aqtobe",
- "America/Vancouver", "America_Pacific", "America/Los_Angeles",
- "Africa/Mbabane", "Africa_Southern", "Africa/Johannesburg",
- "Europe/Vaduz", "Europe_Central", "Europe/Paris",
- "Asia/Karachi", "Pakistan", "Asia/Karachi",
- "Asia/Riyadh", "Arabian", "Asia/Riyadh",
- "Indian/Maldives", "Maldives", "Indian/Maldives",
- "Asia/Anadyr", "Magadan", "Asia/Magadan",
- "Europe/Helsinki", "Europe_Eastern", "Europe/Bucharest",
- "America/Nome", "Alaska", "America/Juneau",
- "Asia/Yakutsk", "Yakutsk", "Asia/Yakutsk",
- "Africa/Conakry", "GMT", "Atlantic/Reykjavik",
- "Asia/Seoul", "Korea", "Asia/Seoul",
- "America/Antigua", "Atlantic", "America/Halifax",
- "Asia/Almaty", "Kazakhstan_Eastern", "Asia/Almaty",
- "America/Fortaleza", "Brasilia", "America/Sao_Paulo",
- "Pacific/Tahiti", "Tahiti", "Pacific/Tahiti",
- "Asia/Kashgar", "China", "Asia/Shanghai",
- "America/Whitehorse", "America_Pacific", "America/Los_Angeles",
- "Europe/Kaliningrad", "Europe_Eastern", "Europe/Bucharest",
- "Pacific/Enderbury", "Phoenix_Islands", "Pacific/Enderbury",
- "America/St_Lucia", "Atlantic", "America/Halifax",
- "Atlantic/Stanley", "Falkland", "Atlantic/Stanley",
- "Asia/Omsk", "Omsk", "Asia/Omsk",
- "America/Menominee", "America_Central", "America/Chicago",
- "Asia/Novokuznetsk", "Novosibirsk", "Asia/Novosibirsk",
- "Asia/Sakhalin", "Sakhalin", "Asia/Sakhalin",
- "Asia/Muscat", "Gulf", "Asia/Dubai",
- "Pacific/Noumea", "New_Caledonia", "Pacific/Noumea",
- "Asia/Phnom_Penh", "Indochina", "Asia/Saigon",
- "Antarctica/Mawson", "Mawson", "Antarctica/Mawson",
- "Indian/Cocos", "Cocos", "Indian/Cocos",
- "Europe/Tallinn", "Europe_Eastern", "Europe/Bucharest",
- "Africa/Nairobi", "Africa_Eastern", "Africa/Nairobi",
- "Europe/Ljubljana", "Europe_Central", "Europe/Paris",
- "America/Montreal", "America_Eastern", "America/New_York",
- "Asia/Kuala_Lumpur", "Malaysia", "Asia/Kuching",
- "Asia/Magadan", "Magadan", "Asia/Magadan",
+ "Africa/Algiers", "Europe_Central", "Europe/Paris",
+ "Africa/Asmara", "Africa_Eastern", "Africa/Nairobi",
+ "Africa/Asmera", "Africa_Eastern", "Africa/Nairobi",
"Africa/Bamako", "GMT", "Atlantic/Reykjavik",
- "Australia/Broken_Hill", "Australia_Central", "Australia/Adelaide",
- "America/Indiana/Indianapolis", "America_Eastern", "America/New_York",
- "Asia/Taipei", "Taipei", "Asia/Taipei",
- "Europe/Samara", "Moscow", "Europe/Moscow",
- "America/Indiana/Vevay", "America_Eastern", "America/New_York",
- "Atlantic/South_Georgia", "South_Georgia", "Atlantic/South_Georgia",
- "Pacific/Wake", "Wake", "Pacific/Wake",
- "Asia/Tashkent", "Uzbekistan", "Asia/Tashkent",
- "America/St_Thomas", "Atlantic", "America/Halifax",
- "America/Argentina/San_Luis", "Argentina_Western", "America/Argentina/San_Luis",
- "Arctic/Longyearbyen", "Europe_Central", "Europe/Paris",
- "Asia/Chongqing", "China", "Asia/Shanghai",
- "Europe/Monaco", "Europe_Central", "Europe/Paris",
- "Asia/Qatar", "Arabian", "Asia/Riyadh",
- "America/Chihuahua", "America_Mountain", "America/Denver",
- "America/Havana", "Cuba", "America/Havana",
- "Pacific/Auckland", "New_Zealand", "Pacific/Auckland",
- "America/Jujuy", "Argentina", "America/Buenos_Aires",
- "America/Goose_Bay", "Atlantic", "America/Halifax",
+ "Africa/Bangui", "Africa_Western", "Africa/Lagos",
+ "Africa/Banjul", "GMT", "Atlantic/Reykjavik",
+ "Africa/Bissau", "GMT", "Atlantic/Reykjavik",
+ "Africa/Blantyre", "Africa_Central", "Africa/Maputo",
+ "Africa/Brazzaville", "Africa_Western", "Africa/Lagos",
+ "Africa/Bujumbura", "Africa_Central", "Africa/Maputo",
+ "Africa/Cairo", "Europe_Eastern", "Europe/Bucharest",
+ "Africa/Casablanca", "Europe_Western", "Atlantic/Canary",
+ "Africa/Ceuta", "Europe_Central", "Europe/Paris",
+ "Africa/Conakry", "GMT", "Atlantic/Reykjavik",
+ "Africa/Dakar", "GMT", "Atlantic/Reykjavik",
+ "Africa/Dar_es_Salaam", "Africa_Eastern", "Africa/Nairobi",
+ "Africa/Djibouti", "Africa_Eastern", "Africa/Nairobi",
+ "Africa/Douala", "Africa_Western", "Africa/Lagos",
+ "Africa/El_Aaiun", "Europe_Western", "Atlantic/Canary",
+ "Africa/Freetown", "GMT", "Atlantic/Reykjavik",
+ "Africa/Gaborone", "Africa_Central", "Africa/Maputo",
+ "Africa/Harare", "Africa_Central", "Africa/Maputo",
+ "Africa/Johannesburg", "Africa_Southern", "Africa/Johannesburg",
+ "Africa/Juba", "Africa_Eastern", "Africa/Nairobi",
+ "Africa/Kampala", "Africa_Eastern", "Africa/Nairobi",
+ "Africa/Khartoum", "Africa_Eastern", "Africa/Nairobi",
+ "Africa/Kigali", "Africa_Central", "Africa/Maputo",
+ "Africa/Kinshasa", "Africa_Western", "Africa/Lagos",
+ "Africa/Lagos", "Africa_Western", "Africa/Lagos",
+ "Africa/Libreville", "Africa_Western", "Africa/Lagos",
+ "Africa/Lome", "GMT", "Atlantic/Reykjavik",
+ "Africa/Luanda", "Africa_Western", "Africa/Lagos",
+ "Africa/Lubumbashi", "Africa_Central", "Africa/Maputo",
+ "Africa/Lusaka", "Africa_Central", "Africa/Maputo",
+ "Africa/Malabo", "Africa_Western", "Africa/Lagos",
+ "Africa/Maputo", "Africa_Central", "Africa/Maputo",
+ "Africa/Maseru", "Africa_Southern", "Africa/Johannesburg",
+ "Africa/Mbabane", "Africa_Southern", "Africa/Johannesburg",
+ "Africa/Mogadishu", "Africa_Eastern", "Africa/Nairobi",
+ "Africa/Monrovia", "GMT", "Atlantic/Reykjavik",
+ "Africa/Nairobi", "Africa_Eastern", "Africa/Nairobi",
+ "Africa/Ndjamena", "Africa_Western", "Africa/Lagos",
"Africa/Niamey", "Africa_Western", "Africa/Lagos",
- "Asia/Kathmandu", "Nepal", "Asia/Katmandu",
- "America/Caracas", "Venezuela", "America/Caracas",
- "Indian/Comoro", "Africa_Eastern", "Africa/Nairobi",
- "America/Argentina/Jujuy", "Argentina", "America/Buenos_Aires",
- "America/Guyana", "Guyana", "America/Guyana",
- "America/Indiana/Tell_City", "America_Central", "America/Chicago",
- "America/Metlakatla", "America_Pacific", "America/Los_Angeles",
- "Europe/Mariehamn", "Europe_Eastern", "Europe/Bucharest",
- "Europe/Dublin", "GMT", "Atlantic/Reykjavik",
- "Europe/Lisbon", "Europe_Western", "Atlantic/Canary",
- "America/Puerto_Rico", "Atlantic", "America/Halifax",
- "Asia/Pyongyang", "Korea", "Asia/Seoul",
- "America/North_Dakota/New_Salem", "America_Central", "America/Chicago",
- "Asia/Dhaka", "Bangladesh", "Asia/Dhaka",
- "America/Rankin_Inlet", "America_Central", "America/Chicago",
+ "Africa/Nouakchott", "GMT", "Atlantic/Reykjavik",
+ "Africa/Ouagadougou", "GMT", "Atlantic/Reykjavik",
+ "Africa/Porto-Novo", "Africa_Western", "Africa/Lagos",
+ "Africa/Sao_Tome", "GMT", "Atlantic/Reykjavik",
+ "Africa/Timbuktu", "GMT", "Atlantic/Reykjavik",
+ "Africa/Tripoli", "Europe_Eastern", "Europe/Bucharest",
+ "Africa/Tunis", "Europe_Central", "Europe/Paris",
+ "Africa/Windhoek", "Africa_Western", "Africa/Lagos",
"America/Adak", "Hawaii_Aleutian", "Pacific/Honolulu",
- "America/Campo_Grande", "Amazon", "America/Manaus",
- "Europe/Chisinau", "Europe_Eastern", "Europe/Bucharest",
- "Pacific/Saipan", "Chamorro", "Pacific/Saipan",
- "Pacific/Niue", "Niue", "Pacific/Niue",
- "Europe/Madrid", "Europe_Central", "Europe/Paris",
- "Pacific/Kwajalein", "Marshall_Islands", "Pacific/Majuro",
- "America/Porto_Velho", "Amazon", "America/Manaus",
- "Indian/Kerguelen", "French_Southern", "Indian/Kerguelen",
- "America/Santarem", "Brasilia", "America/Sao_Paulo",
- "Asia/Kuching", "Malaysia", "Asia/Kuching",
- "Australia/Adelaide", "Australia_Central", "Australia/Adelaide",
- "Europe/Bucharest", "Europe_Eastern", "Europe/Bucharest",
- "Australia/Perth", "Australia_Western", "Australia/Perth",
- "Europe/Sofia", "Europe_Eastern", "Europe/Bucharest",
- "Indian/Chagos", "Indian_Ocean", "Indian/Chagos",
- "America/Yellowknife", "America_Mountain", "America/Denver",
- "America/Managua", "America_Central", "America/Chicago",
- "America/Iqaluit", "America_Eastern", "America/New_York",
- "Pacific/Kosrae", "Kosrae", "Pacific/Kosrae",
- "Pacific/Guadalcanal", "Solomon", "Pacific/Guadalcanal",
- "America/Barbados", "Atlantic", "America/Halifax",
- "America/Aruba", "Atlantic", "America/Halifax",
- "Europe/Andorra", "Europe_Central", "Europe/Paris",
- "Pacific/Chatham", "Chatham", "Pacific/Chatham",
- "America/Santo_Domingo", "Atlantic", "America/Halifax",
- "America/Indiana/Vincennes", "America_Eastern", "America/New_York",
- "Europe/Kiev", "Europe_Eastern", "Europe/Bucharest",
- "Pacific/Funafuti", "Tuvalu", "Pacific/Funafuti",
- "America/Mexico_City", "America_Central", "America/Chicago",
- "America/Kentucky/Monticello", "America_Eastern", "America/New_York",
+ "America/Anchorage", "Alaska", "America/Juneau",
+ "America/Anguilla", "Atlantic", "America/Halifax",
+ "America/Antigua", "Atlantic", "America/Halifax",
+ "America/Araguaina", "Brasilia", "America/Sao_Paulo",
+ "America/Argentina/Buenos_Aires", "Argentina", "America/Buenos_Aires",
"America/Argentina/Catamarca", "Argentina", "America/Buenos_Aires",
- "Pacific/Johnston", "Hawaii_Aleutian", "Pacific/Honolulu",
- "Europe/Podgorica", "Europe_Central", "Europe/Paris",
- "Europe/Zagreb", "Europe_Central", "Europe/Paris",
- "Pacific/Pohnpei", "Ponape", "Pacific/Ponape",
- "Antarctica/Palmer", "Chile", "America/Santiago",
+ "America/Argentina/ComodRivadavia", "Argentina", "America/Buenos_Aires",
+ "America/Argentina/Cordoba", "Argentina", "America/Buenos_Aires",
+ "America/Argentina/Jujuy", "Argentina", "America/Buenos_Aires",
+ "America/Argentina/La_Rioja", "Argentina", "America/Buenos_Aires",
"America/Argentina/Mendoza", "Argentina", "America/Buenos_Aires",
- "America/Lima", "Peru", "America/Lima",
- "Antarctica/Macquarie", "Macquarie", "Antarctica/Macquarie",
- "Europe/Malta", "Europe_Central", "Europe/Paris",
+ "America/Argentina/Rio_Gallegos", "Argentina", "America/Buenos_Aires",
+ "America/Argentina/Salta", "Argentina", "America/Buenos_Aires",
+ "America/Argentina/San_Juan", "Argentina", "America/Buenos_Aires",
+ "America/Argentina/San_Luis", "Argentina_Western", "America/Argentina/San_Luis",
+ "America/Argentina/Tucuman", "Argentina", "America/Buenos_Aires",
+ "America/Argentina/Ushuaia", "Argentina", "America/Buenos_Aires",
+ "America/Aruba", "Atlantic", "America/Halifax",
+ "America/Asuncion", "Paraguay", "America/Asuncion",
+ "America/Atikokan", "America_Eastern", "America/New_York",
+ "America/Atka", "Hawaii_Aleutian", "Pacific/Honolulu",
+ "America/Bahia", "Brasilia", "America/Sao_Paulo",
+ "America/Bahia_Banderas", "America_Central", "America/Chicago",
+ "America/Barbados", "Atlantic", "America/Halifax",
+ "America/Belem", "Brasilia", "America/Sao_Paulo",
+ "America/Belize", "America_Central", "America/Chicago",
+ "America/Blanc-Sablon", "Atlantic", "America/Halifax",
+ "America/Boa_Vista", "Amazon", "America/Manaus",
+ "America/Bogota", "Colombia", "America/Bogota",
+ "America/Boise", "America_Mountain", "America/Denver",
+ "America/Buenos_Aires", "Argentina", "America/Buenos_Aires",
+ "America/Cambridge_Bay", "America_Mountain", "America/Denver",
+ "America/Campo_Grande", "Amazon", "America/Manaus",
+ "America/Cancun", "America_Eastern", "America/New_York",
+ "America/Caracas", "Venezuela", "America/Caracas",
+ "America/Catamarca", "Argentina", "America/Buenos_Aires",
+ "America/Cayenne", "French_Guiana", "America/Cayenne",
+ "America/Cayman", "America_Eastern", "America/New_York",
+ "America/Chicago", "America_Central", "America/Chicago",
+ "America/Chihuahua", "Mexico_Pacific", "America/Mazatlan",
+ "America/Coral_Harbour", "America_Eastern", "America/New_York",
+ "America/Cordoba", "Argentina", "America/Buenos_Aires",
+ "America/Costa_Rica", "America_Central", "America/Chicago",
+ "America/Creston", "America_Mountain", "America/Denver",
+ "America/Cuiaba", "Amazon", "America/Manaus",
+ "America/Curacao", "Atlantic", "America/Halifax",
"America/Danmarkshavn", "GMT", "Atlantic/Reykjavik",
+ "America/Dawson", "America_Pacific", "America/Los_Angeles",
+ "America/Dawson_Creek", "America_Mountain", "America/Denver",
+ "America/Denver", "America_Mountain", "America/Denver",
+ "America/Detroit", "America_Eastern", "America/New_York",
+ "America/Dominica", "Atlantic", "America/Halifax",
+ "America/Edmonton", "America_Mountain", "America/Denver",
+ "America/Eirunepe", "Acre", "America/Rio_Branco",
+ "America/El_Salvador", "America_Central", "America/Chicago",
+ "America/Ensenada", "America_Pacific", "America/Los_Angeles",
+ "America/Fort_Nelson", "America_Mountain", "America/Denver",
+ "America/Fort_Wayne", "America_Eastern", "America/New_York",
+ "America/Fortaleza", "Brasilia", "America/Sao_Paulo",
+ "America/Glace_Bay", "Atlantic", "America/Halifax",
+ "America/Godthab", "Greenland_Western", "America/Godthab",
+ "America/Goose_Bay", "Atlantic", "America/Halifax",
+ "America/Grand_Turk", "Atlantic", "America/Halifax",
+ "America/Grenada", "Atlantic", "America/Halifax",
+ "America/Guadeloupe", "Atlantic", "America/Halifax",
+ "America/Guatemala", "America_Central", "America/Chicago",
+ "America/Guayaquil", "Ecuador", "America/Guayaquil",
+ "America/Guyana", "Guyana", "America/Guyana",
+ "America/Halifax", "Atlantic", "America/Halifax",
+ "America/Havana", "Cuba", "America/Havana",
+ "America/Hermosillo", "Mexico_Pacific", "America/Mazatlan",
+ "America/Indiana/Indianapolis", "America_Eastern", "America/New_York",
+ "America/Indiana/Knox", "America_Central", "America/Chicago",
+ "America/Indiana/Marengo", "America_Eastern", "America/New_York",
+ "America/Indiana/Petersburg", "America_Eastern", "America/New_York",
+ "America/Indiana/Tell_City", "America_Central", "America/Chicago",
+ "America/Indiana/Vevay", "America_Eastern", "America/New_York",
+ "America/Indiana/Vincennes", "America_Eastern", "America/New_York",
+ "America/Indiana/Winamac", "America_Eastern", "America/New_York",
+ "America/Indianapolis", "America_Eastern", "America/New_York",
+ "America/Inuvik", "America_Mountain", "America/Denver",
+ "America/Iqaluit", "America_Eastern", "America/New_York",
+ "America/Jamaica", "America_Eastern", "America/New_York",
+ "America/Jujuy", "Argentina", "America/Buenos_Aires",
+ "America/Juneau", "Alaska", "America/Juneau",
+ "America/Kentucky/Louisville", "America_Eastern", "America/New_York",
+ "America/Kentucky/Monticello", "America_Eastern", "America/New_York",
+ "America/Knox_IN", "America_Central", "America/Chicago",
+ "America/Kralendijk", "Atlantic", "America/Halifax",
+ "America/La_Paz", "Bolivia", "America/La_Paz",
+ "America/Lima", "Peru", "America/Lima",
+ "America/Los_Angeles", "America_Pacific", "America/Los_Angeles",
+ "America/Louisville", "America_Eastern", "America/New_York",
+ "America/Lower_Princes", "Atlantic", "America/Halifax",
+ "America/Maceio", "Brasilia", "America/Sao_Paulo",
+ "America/Managua", "America_Central", "America/Chicago",
+ "America/Manaus", "Amazon", "America/Manaus",
+ "America/Marigot", "Atlantic", "America/Halifax",
+ "America/Martinique", "Atlantic", "America/Halifax",
+ "America/Matamoros", "America_Central", "America/Chicago",
+ "America/Mazatlan", "Mexico_Pacific", "America/Mazatlan",
+ "America/Mendoza", "Argentina", "America/Buenos_Aires",
+ "America/Menominee", "America_Central", "America/Chicago",
+ "America/Merida", "America_Central", "America/Chicago",
+ "America/Metlakatla", "Alaska", "America/Juneau",
+ "America/Mexico_City", "America_Central", "America/Chicago",
+ "America/Miquelon", "Pierre_Miquelon", "America/Miquelon",
+ "America/Moncton", "Atlantic", "America/Halifax",
+ "America/Monterrey", "America_Central", "America/Chicago",
+ "America/Montevideo", "Uruguay", "America/Montevideo",
+ "America/Montserrat", "Atlantic", "America/Halifax",
+ "America/Nassau", "America_Eastern", "America/New_York",
+ "America/New_York", "America_Eastern", "America/New_York",
+ "America/Nipigon", "America_Eastern", "America/New_York",
+ "America/Nome", "Alaska", "America/Juneau",
+ "America/Noronha", "Noronha", "America/Noronha",
+ "America/North_Dakota/Beulah", "America_Central", "America/Chicago",
+ "America/North_Dakota/Center", "America_Central", "America/Chicago",
+ "America/North_Dakota/New_Salem", "America_Central", "America/Chicago",
+ "America/Ojinaga", "America_Mountain", "America/Denver",
+ "America/Panama", "America_Eastern", "America/New_York",
+ "America/Pangnirtung", "America_Eastern", "America/New_York",
+ "America/Paramaribo", "Suriname", "America/Paramaribo",
+ "America/Phoenix", "America_Mountain", "America/Denver",
+ "America/Port-au-Prince", "America_Eastern", "America/New_York",
+ "America/Port_of_Spain", "Atlantic", "America/Halifax",
+ "America/Porto_Acre", "Acre", "America/Rio_Branco",
+ "America/Porto_Velho", "Amazon", "America/Manaus",
+ "America/Puerto_Rico", "Atlantic", "America/Halifax",
+ "America/Rainy_River", "America_Central", "America/Chicago",
+ "America/Rankin_Inlet", "America_Central", "America/Chicago",
+ "America/Recife", "Brasilia", "America/Sao_Paulo",
+ "America/Regina", "America_Central", "America/Chicago",
+ "America/Resolute", "America_Central", "America/Chicago",
+ "America/Rio_Branco", "Acre", "America/Rio_Branco",
+ "America/Rosario", "Argentina", "America/Buenos_Aires",
+ "America/Santa_Isabel", "Mexico_Northwest", "America/Santa_Isabel",
+ "America/Santarem", "Brasilia", "America/Sao_Paulo",
+ "America/Santiago", "Chile", "America/Santiago",
+ "America/Santo_Domingo", "Atlantic", "America/Halifax",
+ "America/Sao_Paulo", "Brasilia", "America/Sao_Paulo",
+ "America/Scoresbysund", "Greenland_Eastern", "America/Scoresbysund",
+ "America/Shiprock", "America_Mountain", "America/Denver",
+ "America/Sitka", "Alaska", "America/Juneau",
+ "America/St_Barthelemy", "Atlantic", "America/Halifax",
+ "America/St_Johns", "Newfoundland", "America/St_Johns",
+ "America/St_Kitts", "Atlantic", "America/Halifax",
+ "America/St_Lucia", "Atlantic", "America/Halifax",
+ "America/St_Thomas", "Atlantic", "America/Halifax",
+ "America/St_Vincent", "Atlantic", "America/Halifax",
+ "America/Swift_Current", "America_Central", "America/Chicago",
+ "America/Tegucigalpa", "America_Central", "America/Chicago",
+ "America/Thule", "Atlantic", "America/Halifax",
+ "America/Thunder_Bay", "America_Eastern", "America/New_York",
+ "America/Tijuana", "America_Pacific", "America/Los_Angeles",
+ "America/Toronto", "America_Eastern", "America/New_York",
+ "America/Tortola", "Atlantic", "America/Halifax",
+ "America/Vancouver", "America_Pacific", "America/Los_Angeles",
+ "America/Virgin", "Atlantic", "America/Halifax",
+ "America/Whitehorse", "America_Pacific", "America/Los_Angeles",
+ "America/Winnipeg", "America_Central", "America/Chicago",
+ "America/Yakutat", "Alaska", "America/Juneau",
+ "America/Yellowknife", "America_Mountain", "America/Denver",
+ "Antarctica/Casey", "Australia_Western", "Australia/Perth",
+ "Antarctica/Davis", "Davis", "Antarctica/Davis",
+ "Antarctica/DumontDUrville", "DumontDUrville", "Antarctica/DumontDUrville",
+ "Antarctica/Macquarie", "Macquarie", "Antarctica/Macquarie",
+ "Antarctica/Mawson", "Mawson", "Antarctica/Mawson",
+ "Antarctica/McMurdo", "New_Zealand", "Pacific/Auckland",
+ "Antarctica/Palmer", "Chile", "America/Santiago",
+ "Antarctica/Rothera", "Rothera", "Antarctica/Rothera",
+ "Antarctica/South_Pole", "New_Zealand", "Pacific/Auckland",
+ "Antarctica/Syowa", "Syowa", "Antarctica/Syowa",
+ "Antarctica/Troll", "GMT", "Atlantic/Reykjavik",
+ "Antarctica/Vostok", "Vostok", "Antarctica/Vostok",
+ "Arctic/Longyearbyen", "Europe_Central", "Europe/Paris",
+ "Asia/Aden", "Arabian", "Asia/Riyadh",
+ "Asia/Almaty", "Kazakhstan_Eastern", "Asia/Almaty",
+ "Asia/Amman", "Europe_Eastern", "Europe/Bucharest",
+ "Asia/Anadyr", "Magadan", "Asia/Magadan",
+ "Asia/Aqtau", "Kazakhstan_Western", "Asia/Aqtobe",
+ "Asia/Aqtobe", "Kazakhstan_Western", "Asia/Aqtobe",
+ "Asia/Ashgabat", "Turkmenistan", "Asia/Ashgabat",
+ "Asia/Ashkhabad", "Turkmenistan", "Asia/Ashgabat",
+ "Asia/Baghdad", "Arabian", "Asia/Riyadh",
+ "Asia/Bahrain", "Arabian", "Asia/Riyadh",
+ "Asia/Baku", "Azerbaijan", "Asia/Baku",
+ "Asia/Bangkok", "Indochina", "Asia/Bangkok",
+ "Asia/Beirut", "Europe_Eastern", "Europe/Bucharest",
+ "Asia/Bishkek", "Kyrgystan", "Asia/Bishkek",
+ "Asia/Brunei", "Brunei", "Asia/Brunei",
+ "Asia/Calcutta", "India", "Asia/Calcutta",
+ "Asia/Chita", "Yakutsk", "Asia/Yakutsk",
+ "Asia/Choibalsan", "Choibalsan", "Asia/Choibalsan",
+ "Asia/Chongqing", "China", "Asia/Shanghai",
+ "Asia/Chungking", "China", "Asia/Shanghai",
+ "Asia/Colombo", "India", "Asia/Calcutta",
+ "Asia/Dacca", "Bangladesh", "Asia/Dhaka",
+ "Asia/Damascus", "Europe_Eastern", "Europe/Bucharest",
+ "Asia/Dhaka", "Bangladesh", "Asia/Dhaka",
+ "Asia/Dili", "East_Timor", "Asia/Dili",
+ "Asia/Dubai", "Gulf", "Asia/Dubai",
+ "Asia/Dushanbe", "Tajikistan", "Asia/Dushanbe",
+ "Asia/Gaza", "Europe_Eastern", "Europe/Bucharest",
+ "Asia/Harbin", "China", "Asia/Shanghai",
+ "Asia/Hebron", "Europe_Eastern", "Europe/Bucharest",
+ "Asia/Ho_Chi_Minh", "Indochina", "Asia/Bangkok",
+ "Asia/Hong_Kong", "Hong_Kong", "Asia/Hong_Kong",
+ "Asia/Hovd", "Hovd", "Asia/Hovd",
+ "Asia/Irkutsk", "Irkutsk", "Asia/Irkutsk",
+ "Asia/Istanbul", "Europe_Eastern", "Europe/Bucharest",
+ "Asia/Jakarta", "Indonesia_Western", "Asia/Jakarta",
+ "Asia/Jayapura", "Indonesia_Eastern", "Asia/Jayapura",
+ "Asia/Jerusalem", "Israel", "Asia/Jerusalem",
+ "Asia/Kabul", "Afghanistan", "Asia/Kabul",
+ "Asia/Kamchatka", "Kamchatka", "Asia/Kamchatka",
+ "Asia/Karachi", "Pakistan", "Asia/Karachi",
+ "Asia/Kashgar", "Urumqi", "Asia/Urumqi",
+ "Asia/Kathmandu", "Nepal", "Asia/Katmandu",
+ "Asia/Katmandu", "Nepal", "Asia/Katmandu",
+ "Asia/Khandyga", "Yakutsk", "Asia/Yakutsk",
+ "Asia/Kolkata", "India", "Asia/Calcutta",
+ "Asia/Krasnoyarsk", "Krasnoyarsk", "Asia/Krasnoyarsk",
+ "Asia/Kuala_Lumpur", "Malaysia", "Asia/Kuching",
+ "Asia/Kuching", "Malaysia", "Asia/Kuching",
+ "Asia/Kuwait", "Arabian", "Asia/Riyadh",
+ "Asia/Macao", "China", "Asia/Shanghai",
+ "Asia/Macau", "China", "Asia/Shanghai",
+ "Asia/Magadan", "Magadan", "Asia/Magadan",
+ "Asia/Makassar", "Indonesia_Central", "Asia/Makassar",
+ "Asia/Manila", "Philippines", "Asia/Manila",
+ "Asia/Muscat", "Gulf", "Asia/Dubai",
+ "Asia/Nicosia", "Europe_Eastern", "Europe/Bucharest",
+ "Asia/Novokuznetsk", "Krasnoyarsk", "Asia/Krasnoyarsk",
+ "Asia/Novosibirsk", "Novosibirsk", "Asia/Novosibirsk",
+ "Asia/Omsk", "Omsk", "Asia/Omsk",
+ "Asia/Oral", "Kazakhstan_Western", "Asia/Aqtobe",
+ "Asia/Phnom_Penh", "Indochina", "Asia/Bangkok",
+ "Asia/Pontianak", "Indonesia_Western", "Asia/Jakarta",
+ "Asia/Pyongyang", "Pyongyang", "Asia/Pyongyang",
+ "Asia/Qatar", "Arabian", "Asia/Riyadh",
+ "Asia/Qyzylorda", "Kazakhstan_Eastern", "Asia/Almaty",
+ "Asia/Rangoon", "Myanmar", "Asia/Rangoon",
+ "Asia/Riyadh", "Arabian", "Asia/Riyadh",
+ "Asia/Saigon", "Indochina", "Asia/Bangkok",
+ "Asia/Sakhalin", "Sakhalin", "Asia/Sakhalin",
+ "Asia/Samarkand", "Uzbekistan", "Asia/Tashkent",
+ "Asia/Seoul", "Korea", "Asia/Seoul",
+ "Asia/Shanghai", "China", "Asia/Shanghai",
+ "Asia/Singapore", "Singapore", "Asia/Singapore",
+ "Asia/Srednekolymsk", "Singapore", "Asia/Singapore",
+ "Asia/Taipei", "Taipei", "Asia/Taipei",
+ "Asia/Tashkent", "Uzbekistan", "Asia/Tashkent",
+ "Asia/Tbilisi", "Georgia", "Asia/Tbilisi",
+ "Asia/Tehran", "Iran", "Asia/Tehran",
+ "Asia/Tel_Aviv", "Israel", "Asia/Jerusalem",
+ "Asia/Thimbu", "Bhutan", "Asia/Thimphu",
+ "Asia/Thimphu", "Bhutan", "Asia/Thimphu",
+ "Asia/Tokyo", "Japan", "Asia/Tokyo",
+ "Asia/Ujung_Pandang", "Indonesia_Central", "Asia/Makassar",
+ "Asia/Ulaanbaatar", "Mongolia", "Asia/Ulaanbaatar",
+ "Asia/Ulan_Bator", "Mongolia", "Asia/Ulaanbaatar",
+ "Asia/Urumqi", "Urumqi", "Asia/Urumqi",
+ "Asia/Ust-Nera", "Vladivostok", "Asia/Vladivostok",
+ "Asia/Vientiane", "Indochina", "Asia/Bangkok",
+ "Asia/Vladivostok", "Vladivostok", "Asia/Vladivostok",
+ "Asia/Yakutsk", "Yakutsk", "Asia/Yakutsk",
+ "Asia/Yekaterinburg", "Yekaterinburg", "Asia/Yekaterinburg",
+ "Asia/Yerevan", "Armenia", "Asia/Yerevan",
+ "Atlantic/Azores", "Azores", "Atlantic/Azores",
+ "Atlantic/Bermuda", "Atlantic", "America/Halifax",
+ "Atlantic/Canary", "Europe_Western", "Atlantic/Canary",
+ "Atlantic/Cape_Verde", "Cape_Verde", "Atlantic/Cape_Verde",
+ "Atlantic/Faeroe", "Europe_Western", "Atlantic/Canary",
+ "Atlantic/Faroe", "Europe_Western", "Atlantic/Canary",
+ "Atlantic/Jan_Mayen", "Europe_Central", "Europe/Paris",
+ "Atlantic/Madeira", "Europe_Western", "Atlantic/Canary",
+ "Atlantic/Reykjavik", "GMT", "Atlantic/Reykjavik",
+ "Atlantic/South_Georgia", "South_Georgia", "Atlantic/South_Georgia",
+ "Atlantic/St_Helena", "GMT", "Atlantic/Reykjavik",
+ "Atlantic/Stanley", "Falkland", "Atlantic/Stanley",
+ "Australia/ACT", "Australia_Eastern", "Australia/Sydney",
+ "Australia/Adelaide", "Australia_Central", "Australia/Adelaide",
+ "Australia/Brisbane", "Australia_Eastern", "Australia/Sydney",
+ "Australia/Broken_Hill", "Australia_Central", "Australia/Adelaide",
+ "Australia/Canberra", "Australia_Eastern", "Australia/Sydney",
+ "Australia/Currie", "Australia_Eastern", "Australia/Sydney",
+ "Australia/Darwin", "Australia_Central", "Australia/Adelaide",
+ "Australia/Eucla", "Australia_CentralWestern", "Australia/Eucla",
+ "Australia/Hobart", "Australia_Eastern", "Australia/Sydney",
+ "Australia/LHI", "Lord_Howe", "Australia/Lord_Howe",
+ "Australia/Lindeman", "Australia_Eastern", "Australia/Sydney",
+ "Australia/Lord_Howe", "Lord_Howe", "Australia/Lord_Howe",
+ "Australia/Melbourne", "Australia_Eastern", "Australia/Sydney",
+ "Australia/NSW", "Australia_Eastern", "Australia/Sydney",
+ "Australia/North", "Australia_Central", "Australia/Adelaide",
+ "Australia/Perth", "Australia_Western", "Australia/Perth",
+ "Australia/Queensland", "Australia_Eastern", "Australia/Sydney",
+ "Australia/South", "Australia_Central", "Australia/Adelaide",
+ "Australia/Sydney", "Australia_Eastern", "Australia/Sydney",
+ "Australia/Tasmania", "Australia_Eastern", "Australia/Sydney",
+ "Australia/Victoria", "Australia_Eastern", "Australia/Sydney",
+ "Australia/West", "Australia_Western", "Australia/Perth",
+ "Australia/Yancowinna", "Australia_Central", "Australia/Adelaide",
+ "Brazil/Acre", "Acre", "America/Rio_Branco",
+ "Brazil/DeNoronha", "Noronha", "America/Noronha",
+ "Brazil/East", "Brasilia", "America/Sao_Paulo",
+ "Brazil/West", "Amazon", "America/Manaus",
+ "CST6CDT", "America_Central", "America/Chicago",
+ "Canada/Atlantic", "Atlantic", "America/Halifax",
+ "Canada/Central", "America_Central", "America/Chicago",
+ "Canada/East-Saskatchewan", "America_Central", "America/Chicago",
+ "Canada/Eastern", "America_Eastern", "America/New_York",
+ "Canada/Mountain", "America_Mountain", "America/Denver",
+ "Canada/Newfoundland", "Newfoundland", "America/St_Johns",
+ "Canada/Pacific", "America_Pacific", "America/Los_Angeles",
+ "Canada/Saskatchewan", "America_Central", "America/Chicago",
+ "Canada/Yukon", "America_Pacific", "America/Los_Angeles",
+ "Chile/Continental", "Chile", "America/Santiago",
+ "Chile/EasterIsland", "Easter", "Pacific/Easter",
+ "Cuba", "Cuba", "America/Havana",
+ "EST5EDT", "America_Eastern", "America/New_York",
+ "Egypt", "Europe_Eastern", "Europe/Bucharest",
+ "Eire", "GMT", "Atlantic/Reykjavik",
+ "Europe/Amsterdam", "Europe_Central", "Europe/Paris",
+ "Europe/Andorra", "Europe_Central", "Europe/Paris",
+ "Europe/Athens", "Europe_Eastern", "Europe/Bucharest",
+ "Europe/Belfast", "GMT", "Atlantic/Reykjavik",
+ "Europe/Belgrade", "Europe_Central", "Europe/Paris",
+ "Europe/Berlin", "Europe_Central", "Europe/Paris",
+ "Europe/Bratislava", "Europe_Central", "Europe/Paris",
+ "Europe/Brussels", "Europe_Central", "Europe/Paris",
+ "Europe/Bucharest", "Europe_Eastern", "Europe/Bucharest",
+ "Europe/Budapest", "Europe_Central", "Europe/Paris",
+ "Europe/Busingen", "Europe_Central", "Europe/Paris",
+ "Europe/Chisinau", "Europe_Eastern", "Europe/Bucharest",
+ "Europe/Copenhagen", "Europe_Central", "Europe/Paris",
+ "Europe/Dublin", "GMT", "Atlantic/Reykjavik",
+ "Europe/Gibraltar", "Europe_Central", "Europe/Paris",
+ "Europe/Guernsey", "GMT", "Atlantic/Reykjavik",
+ "Europe/Helsinki", "Europe_Eastern", "Europe/Bucharest",
+ "Europe/Isle_of_Man", "GMT", "Atlantic/Reykjavik",
+ "Europe/Istanbul", "Europe_Eastern", "Europe/Bucharest",
+ "Europe/Jersey", "GMT", "Atlantic/Reykjavik",
+ "Europe/Kaliningrad", "Europe_Eastern", "Europe/Bucharest",
+ "Europe/Kiev", "Europe_Eastern", "Europe/Bucharest",
+ "Europe/Lisbon", "Europe_Western", "Atlantic/Canary",
+ "Europe/Ljubljana", "Europe_Central", "Europe/Paris",
+ "Europe/London", "GMT", "Atlantic/Reykjavik",
+ "Europe/Luxembourg", "Europe_Central", "Europe/Paris",
+ "Europe/Madrid", "Europe_Central", "Europe/Paris",
+ "Europe/Malta", "Europe_Central", "Europe/Paris",
+ "Europe/Mariehamn", "Europe_Eastern", "Europe/Bucharest",
+ "Europe/Minsk", "Europe_Further_Eastern", "Europe/Minsk",
+ "Europe/Monaco", "Europe_Central", "Europe/Paris",
+ "Europe/Moscow", "Moscow", "Europe/Moscow",
+ "Europe/Nicosia", "Europe_Eastern", "Europe/Bucharest",
+ "Europe/Oslo", "Europe_Central", "Europe/Paris",
+ "Europe/Paris", "Europe_Central", "Europe/Paris",
+ "Europe/Podgorica", "Europe_Central", "Europe/Paris",
+ "Europe/Prague", "Europe_Central", "Europe/Paris",
+ "Europe/Riga", "Europe_Eastern", "Europe/Bucharest",
+ "Europe/Rome", "Europe_Central", "Europe/Paris",
+ "Europe/Samara", "Samara", "Europe/Samara",
+ "Europe/San_Marino", "Europe_Central", "Europe/Paris",
+ "Europe/Sarajevo", "Europe_Central", "Europe/Paris",
+ "Europe/Simferopol", "Moscow", "Europe/Moscow",
+ "Europe/Skopje", "Europe_Central", "Europe/Paris",
+ "Europe/Sofia", "Europe_Eastern", "Europe/Bucharest",
+ "Europe/Stockholm", "Europe_Central", "Europe/Paris",
+ "Europe/Tallinn", "Europe_Eastern", "Europe/Bucharest",
+ "Europe/Tirane", "Europe_Central", "Europe/Paris",
+ "Europe/Tiraspol", "Europe_Eastern", "Europe/Bucharest",
+ "Europe/Uzhgorod", "Europe_Eastern", "Europe/Bucharest",
+ "Europe/Vaduz", "Europe_Central", "Europe/Paris",
+ "Europe/Vatican", "Europe_Central", "Europe/Paris",
+ "Europe/Vienna", "Europe_Central", "Europe/Paris",
+ "Europe/Vilnius", "Europe_Eastern", "Europe/Bucharest",
+ "Europe/Volgograd", "Moscow", "Europe/Moscow",
+ "Europe/Warsaw", "Europe_Central", "Europe/Paris",
+ "Europe/Zagreb", "Europe_Central", "Europe/Paris",
+ "Europe/Zaporozhye", "Europe_Eastern", "Europe/Bucharest",
+ "Europe/Zurich", "Europe_Central", "Europe/Paris",
+ "GB", "GMT", "Atlantic/Reykjavik",
+ "GB-Eire", "GMT", "Atlantic/Reykjavik",
+ "Hongkong", "Hong_Kong", "Asia/Hong_Kong",
+ "Iceland", "GMT", "Atlantic/Reykjavik",
+ "Indian/Antananarivo", "Africa_Eastern", "Africa/Nairobi",
+ "Indian/Chagos", "Indian_Ocean", "Indian/Chagos",
+ "Indian/Christmas", "Christmas", "Indian/Christmas",
+ "Indian/Cocos", "Cocos", "Indian/Cocos",
+ "Indian/Comoro", "Africa_Eastern", "Africa/Nairobi",
+ "Indian/Kerguelen", "French_Southern", "Indian/Kerguelen",
+ "Indian/Mahe", "Seychelles", "Indian/Mahe",
+ "Indian/Maldives", "Maldives", "Indian/Maldives",
+ "Indian/Mauritius", "Mauritius", "Indian/Mauritius",
+ "Indian/Mayotte", "Africa_Eastern", "Africa/Nairobi",
+ "Indian/Reunion", "Reunion", "Indian/Reunion",
+ "Iran", "Iran", "Asia/Tehran",
+ "Israel", "Israel", "Asia/Jerusalem",
+ "Jamaica", "America_Eastern", "America/New_York",
+ "Japan", "Japan", "Asia/Tokyo",
+ "Kwajalein", "Marshall_Islands", "Pacific/Majuro",
+ "Libya", "Europe_Eastern", "Europe/Bucharest",
+ "MST7MDT", "America_Mountain", "America/Denver",
+ "Mexico/BajaNorte", "America_Pacific", "America/Los_Angeles",
+ "Mexico/BajaSur", "Mexico_Pacific", "America/Mazatlan",
+ "Mexico/General", "America_Central", "America/Chicago",
+ "NZ", "New_Zealand", "Pacific/Auckland",
+ "NZ-CHAT", "Chatham", "Pacific/Chatham",
+ "Navajo", "America_Mountain", "America/Denver",
+ "PRC", "China", "Asia/Shanghai",
+ "PST8PDT", "America_Pacific", "America/Los_Angeles",
+ "Pacific/Apia", "Apia", "Pacific/Apia",
+ "Pacific/Auckland", "New_Zealand", "Pacific/Auckland",
+ "Pacific/Bougainville", "New_Zealand", "Pacific/Auckland",
+ "Pacific/Chatham", "Chatham", "Pacific/Chatham",
+ "Pacific/Chuuk", "Truk", "Pacific/Truk",
+ "Pacific/Easter", "Easter", "Pacific/Easter",
+ "Pacific/Efate", "Vanuatu", "Pacific/Efate",
+ "Pacific/Enderbury", "Phoenix_Islands", "Pacific/Enderbury",
+ "Pacific/Fakaofo", "Tokelau", "Pacific/Fakaofo",
+ "Pacific/Fiji", "Fiji", "Pacific/Fiji",
+ "Pacific/Funafuti", "Tuvalu", "Pacific/Funafuti",
+ "Pacific/Galapagos", "Galapagos", "Pacific/Galapagos",
+ "Pacific/Gambier", "Gambier", "Pacific/Gambier",
+ "Pacific/Guadalcanal", "Solomon", "Pacific/Guadalcanal",
+ "Pacific/Guam", "Chamorro", "Pacific/Saipan",
+ "Pacific/Honolulu", "Hawaii_Aleutian", "Pacific/Honolulu",
+ "Pacific/Johnston", "Hawaii_Aleutian", "Pacific/Honolulu",
+ "Pacific/Kiritimati", "Line_Islands", "Pacific/Kiritimati",
+ "Pacific/Kosrae", "Kosrae", "Pacific/Kosrae",
+ "Pacific/Kwajalein", "Marshall_Islands", "Pacific/Majuro",
+ "Pacific/Majuro", "Marshall_Islands", "Pacific/Majuro",
+ "Pacific/Marquesas", "Marquesas", "Pacific/Marquesas",
+ "Pacific/Midway", "Samoa", "Pacific/Pago_Pago",
+ "Pacific/Nauru", "Nauru", "Pacific/Nauru",
+ "Pacific/Niue", "Niue", "Pacific/Niue",
+ "Pacific/Norfolk", "Norfolk", "Pacific/Norfolk",
+ "Pacific/Noumea", "New_Caledonia", "Pacific/Noumea",
+ "Pacific/Pago_Pago", "Samoa", "Pacific/Pago_Pago",
+ "Pacific/Palau", "Palau", "Pacific/Palau",
+ "Pacific/Pitcairn", "Pitcairn", "Pacific/Pitcairn",
+ "Pacific/Pohnpei", "Ponape", "Pacific/Ponape",
+ "Pacific/Ponape", "Ponape", "Pacific/Ponape",
+ "Pacific/Port_Moresby", "Papua_New_Guinea", "Pacific/Port_Moresby",
+ "Pacific/Rarotonga", "Cook", "Pacific/Rarotonga",
+ "Pacific/Saipan", "Chamorro", "Pacific/Saipan",
+ "Pacific/Samoa", "Samoa", "Pacific/Pago_Pago",
+ "Pacific/Tahiti", "Tahiti", "Pacific/Tahiti",
+ "Pacific/Tarawa", "Gilbert_Islands", "Pacific/Tarawa",
+ "Pacific/Tongatapu", "Tonga", "Pacific/Tongatapu",
+ "Pacific/Truk", "Truk", "Pacific/Truk",
+ "Pacific/Wake", "Wake", "Pacific/Wake",
+ "Pacific/Wallis", "Wallis", "Pacific/Wallis",
+ "Pacific/Yap", "Truk", "Pacific/Truk",
+ "Poland", "Europe_Central", "Europe/Paris",
+ "Portugal", "Europe_Western", "Atlantic/Canary",
+ "ROK", "Korea", "Asia/Seoul",
+ "Singapore", "Singapore", "Asia/Singapore",
+ "Turkey", "Europe_Eastern", "Europe/Bucharest",
+ "US/Alaska", "Alaska", "America/Juneau",
+ "US/Aleutian", "Hawaii_Aleutian", "Pacific/Honolulu",
+ "US/Arizona", "America_Mountain", "America/Denver",
+ "US/Central", "America_Central", "America/Chicago",
+ "US/East-Indiana", "America_Eastern", "America/New_York",
+ "US/Eastern", "America_Eastern", "America/New_York",
+ "US/Hawaii", "Hawaii_Aleutian", "Pacific/Honolulu",
+ "US/Indiana-Starke", "America_Central", "America/Chicago",
+ "US/Michigan", "America_Eastern", "America/New_York",
+ "US/Mountain", "America_Mountain", "America/Denver",
+ "US/Pacific", "America_Pacific", "America/Los_Angeles",
+ "US/Samoa", "Samoa", "Pacific/Pago_Pago",
+ "W-SU", "Moscow", "Europe/Moscow",
+
+ // From tzdb
+ "Africa/Khartoum", "Africa_Central", "Africa/Maputo", // tzdata2017c
+ "Africa/Windhoek", "Africa_Central", "Africa/Maputo", // tzdata2017c
+ "Africa/Sao_Tome", "Africa_Western", "Africa/Lagos", // tzdata2018c
};
private static final String[] mzoneMap = new String[] {
- "America_Eastern", "TC", "America/Grand_Turk",
- "America_Eastern", "BS", "America/Nassau",
- "America_Eastern", "CA", "America/Toronto",
- "America_Eastern", "KY", "America/Cayman",
- "America_Eastern", "PA", "America/Panama",
- "America_Eastern", "JM", "America/Jamaica",
- "America_Pacific", "CA", "America/Vancouver",
- "America_Pacific", "MX", "America/Tijuana",
- "Europe_Western", "FO", "Atlantic/Faeroe",
- "Arabian", "YE", "Asia/Aden",
- "Arabian", "BH", "Asia/Bahrain",
- "Arabian", "KW", "Asia/Kuwait",
- "Arabian", "QA", "Asia/Qatar",
- "Arabian", "IQ", "Asia/Baghdad",
- "Korea", "KP", "Asia/Pyongyang",
- "Africa_Central", "ZW", "Africa/Harare",
- "Africa_Central", "ZM", "Africa/Lusaka",
- "Africa_Central", "MW", "Africa/Blantyre",
+ // From metaZones.xml
+ "Africa_Central", "BI", "Africa/Bujumbura",
"Africa_Central", "BW", "Africa/Gaborone",
"Africa_Central", "CD", "Africa/Lubumbashi",
- "Africa_Central", "BI", "Africa/Bujumbura",
+ "Africa_Central", "MW", "Africa/Blantyre",
"Africa_Central", "RW", "Africa/Kigali",
- "Africa_Western", "CF", "Africa/Bangui",
+ "Africa_Central", "ZM", "Africa/Lusaka",
+ "Africa_Central", "ZW", "Africa/Harare",
+ "Africa_Eastern", "DJ", "Africa/Djibouti",
+ "Africa_Eastern", "ER", "Africa/Asmera",
+ "Africa_Eastern", "ET", "Africa/Addis_Ababa",
+ "Africa_Eastern", "KM", "Indian/Comoro",
+ "Africa_Eastern", "MG", "Indian/Antananarivo",
+ "Africa_Eastern", "SO", "Africa/Mogadishu",
+ "Africa_Eastern", "TZ", "Africa/Dar_es_Salaam",
+ "Africa_Eastern", "UG", "Africa/Kampala",
+ "Africa_Eastern", "YT", "Indian/Mayotte",
+ "Africa_Southern", "LS", "Africa/Maseru",
+ "Africa_Southern", "SZ", "Africa/Mbabane",
"Africa_Western", "AO", "Africa/Luanda",
- "Africa_Western", "NE", "Africa/Niamey",
+ "Africa_Western", "BJ", "Africa/Porto-Novo",
"Africa_Western", "CD", "Africa/Kinshasa",
- "Africa_Western", "CM", "Africa/Douala",
+ "Africa_Western", "CF", "Africa/Bangui",
"Africa_Western", "CG", "Africa/Brazzaville",
- "Africa_Western", "GQ", "Africa/Malabo",
- "Africa_Western", "TD", "Africa/Ndjamena",
+ "Africa_Western", "CM", "Africa/Douala",
"Africa_Western", "GA", "Africa/Libreville",
- "Atlantic", "PR", "America/Puerto_Rico",
- "Atlantic", "AN", "America/Curacao",
- "Atlantic", "VI", "America/St_Thomas",
- "Atlantic", "GP", "America/Guadeloupe",
- "Atlantic", "TT", "America/Port_of_Spain",
+ "Africa_Western", "GQ", "Africa/Malabo",
+ "Africa_Western", "NE", "Africa/Niamey",
+ "Africa_Western", "TD", "Africa/Ndjamena",
+ "America_Central", "BZ", "America/Belize",
+ "America_Central", "CA", "America/Winnipeg",
+ "America_Central", "CR", "America/Costa_Rica",
+ "America_Central", "GT", "America/Guatemala",
+ "America_Central", "HN", "America/Tegucigalpa",
+ "America_Central", "MX", "America/Mexico_City",
+ "America_Central", "SV", "America/El_Salvador",
+ "America_Eastern", "BS", "America/Nassau",
+ "America_Eastern", "CA", "America/Toronto",
+ "America_Eastern", "HT", "America/Port-au-Prince",
+ "America_Eastern", "JM", "America/Jamaica",
+ "America_Eastern", "KY", "America/Cayman",
+ "America_Eastern", "PA", "America/Panama",
+ "America_Mountain", "CA", "America/Edmonton",
+ "America_Mountain", "MX", "America/Hermosillo",
+ "America_Pacific", "CA", "America/Vancouver",
+ "America_Pacific", "MX", "America/Tijuana",
+ "Arabian", "BH", "Asia/Bahrain",
+ "Arabian", "IQ", "Asia/Baghdad",
+ "Arabian", "KW", "Asia/Kuwait",
+ "Arabian", "QA", "Asia/Qatar",
+ "Arabian", "YE", "Asia/Aden",
"Atlantic", "AG", "America/Antigua",
- "Atlantic", "MF", "America/Marigot",
- "Atlantic", "DM", "America/Dominica",
- "Atlantic", "VG", "America/Tortola",
- "Atlantic", "MQ", "America/Martinique",
- "Atlantic", "GL", "America/Thule",
"Atlantic", "AI", "America/Anguilla",
+ "Atlantic", "AN", "America/Curacao",
+ "Atlantic", "AW", "America/Aruba",
"Atlantic", "BB", "America/Barbados",
"Atlantic", "BM", "Atlantic/Bermuda",
"Atlantic", "BQ", "America/Kralendijk",
- "Atlantic", "LC", "America/St_Lucia",
- "Atlantic", "MS", "America/Montserrat",
- "Atlantic", "SX", "America/Lower_Princes",
+ "Atlantic", "DM", "America/Dominica",
"Atlantic", "GD", "America/Grenada",
- "Atlantic", "VC", "America/St_Vincent",
+ "Atlantic", "GL", "America/Thule",
+ "Atlantic", "GP", "America/Guadeloupe",
"Atlantic", "KN", "America/St_Kitts",
- "Atlantic", "AW", "America/Aruba",
- "GMT", "GM", "Africa/Banjul",
- "GMT", "LR", "Africa/Monrovia",
- "GMT", "ML", "Africa/Bamako",
- "GMT", "SH", "Atlantic/St_Helena",
- "GMT", "TG", "Africa/Lome",
- "GMT", "GB", "Europe/London",
- "GMT", "MR", "Africa/Nouakchott",
- "GMT", "GN", "Africa/Conakry",
- "GMT", "SL", "Africa/Freetown",
- "GMT", "BF", "Africa/Ouagadougou",
- "GMT", "ST", "Africa/Sao_Tome",
- "GMT", "SN", "Africa/Dakar",
- "GMT", "CI", "Africa/Abidjan",
- "GMT", "IE", "Europe/Dublin",
- "GMT", "GH", "Africa/Accra",
- "Chile", "AQ", "Antarctica/Palmer",
- "America_Central", "CR", "America/Costa_Rica",
- "America_Central", "HN", "America/Tegucigalpa",
- "America_Central", "CA", "America/Winnipeg",
- "America_Central", "SV", "America/El_Salvador",
- "America_Central", "MX", "America/Mexico_City",
- "America_Central", "BZ", "America/Belize",
- "America_Central", "GT", "America/Guatemala",
- "America_Mountain", "CA", "America/Edmonton",
- "America_Mountain", "MX", "America/Hermosillo",
- "New_Zealand", "AQ", "Antarctica/McMurdo",
- "India", "LK", "Asia/Colombo",
- "Gulf", "OM", "Asia/Muscat",
- "China", "MO", "Asia/Macau",
- "Africa_Eastern", "ER", "Africa/Asmera",
- "Africa_Eastern", "TZ", "Africa/Dar_es_Salaam",
- "Africa_Eastern", "SO", "Africa/Mogadishu",
- "Africa_Eastern", "DJ", "Africa/Djibouti",
- "Africa_Eastern", "MG", "Indian/Antananarivo",
- "Africa_Eastern", "KM", "Indian/Comoro",
- "Africa_Eastern", "UG", "Africa/Kampala",
- "Africa_Eastern", "YT", "Indian/Mayotte",
- "Africa_Eastern", "ET", "Africa/Addis_Ababa",
+ "Atlantic", "LC", "America/St_Lucia",
+ "Atlantic", "MF", "America/Marigot",
+ "Atlantic", "MQ", "America/Martinique",
+ "Atlantic", "MS", "America/Montserrat",
+ "Atlantic", "PR", "America/Puerto_Rico",
+ "Atlantic", "SX", "America/Lower_Princes",
+ "Atlantic", "TT", "America/Port_of_Spain",
+ "Atlantic", "VC", "America/St_Vincent",
+ "Atlantic", "VG", "America/Tortola",
+ "Atlantic", "VI", "America/St_Thomas",
"Chamorro", "GU", "Pacific/Guam",
- "Africa_Southern", "LS", "Africa/Maseru",
- "Africa_Southern", "SZ", "Africa/Mbabane",
- "Indochina", "KH", "Asia/Phnom_Penh",
- "Indochina", "TH", "Asia/Bangkok",
- "Indochina", "LA", "Asia/Vientiane",
+ "Chile", "AQ", "Antarctica/Palmer",
+ "Europe_Central", "AD", "Europe/Andorra",
+ "Europe_Central", "AL", "Europe/Tirane",
"Europe_Central", "AT", "Europe/Vienna",
- "Europe_Central", "SK", "Europe/Bratislava",
"Europe_Central", "BA", "Europe/Sarajevo",
- "Europe_Central", "CZ", "Europe/Prague",
"Europe_Central", "BE", "Europe/Brussels",
- "Europe_Central", "RS", "Europe/Belgrade",
- "Europe_Central", "SE", "Europe/Stockholm",
- "Europe_Central", "MT", "Europe/Malta",
- "Europe_Central", "IT", "Europe/Rome",
- "Europe_Central", "LU", "Europe/Luxembourg",
+ "Europe_Central", "CH", "Europe/Zurich",
+ "Europe_Central", "CZ", "Europe/Prague",
+ "Europe_Central", "DE", "Europe/Berlin",
+ "Europe_Central", "DK", "Europe/Copenhagen",
+ "Europe_Central", "ES", "Europe/Madrid",
+ "Europe_Central", "GI", "Europe/Gibraltar",
+ "Europe_Central", "HR", "Europe/Zagreb",
"Europe_Central", "HU", "Europe/Budapest",
- "Europe_Central", "NO", "Europe/Oslo",
+ "Europe_Central", "IT", "Europe/Rome",
+ "Europe_Central", "LI", "Europe/Vaduz",
+ "Europe_Central", "LU", "Europe/Luxembourg",
+ "Europe_Central", "MC", "Europe/Monaco",
"Europe_Central", "ME", "Europe/Podgorica",
"Europe_Central", "MK", "Europe/Skopje",
+ "Europe_Central", "MT", "Europe/Malta",
"Europe_Central", "NL", "Europe/Amsterdam",
- "Europe_Central", "LI", "Europe/Vaduz",
+ "Europe_Central", "NO", "Europe/Oslo",
"Europe_Central", "PL", "Europe/Warsaw",
- "Europe_Central", "ES", "Europe/Madrid",
- "Europe_Central", "TN", "Africa/Tunis",
+ "Europe_Central", "RS", "Europe/Belgrade",
+ "Europe_Central", "SE", "Europe/Stockholm",
"Europe_Central", "SI", "Europe/Ljubljana",
- "Europe_Central", "DE", "Europe/Berlin",
- "Europe_Central", "GI", "Europe/Gibraltar",
- "Europe_Central", "CH", "Europe/Zurich",
- "Europe_Central", "MC", "Europe/Monaco",
- "Europe_Central", "VA", "Europe/Vatican",
- "Europe_Central", "HR", "Europe/Zagreb",
- "Europe_Central", "AL", "Europe/Tirane",
- "Europe_Central", "AD", "Europe/Andorra",
- "Europe_Central", "DK", "Europe/Copenhagen",
+ "Europe_Central", "SK", "Europe/Bratislava",
"Europe_Central", "SM", "Europe/San_Marino",
- "Europe_Eastern", "SY", "Asia/Damascus",
- "Europe_Eastern", "FI", "Europe/Helsinki",
+ "Europe_Central", "TN", "Africa/Tunis",
+ "Europe_Central", "VA", "Europe/Vatican",
+ "Europe_Central", "XK", "Europe/Belgrade",
"Europe_Eastern", "AX", "Europe/Mariehamn",
"Europe_Eastern", "BG", "Europe/Sofia",
+ "Europe_Eastern", "CY", "Asia/Nicosia",
"Europe_Eastern", "EG", "Africa/Cairo",
- "Europe_Eastern", "LB", "Asia/Beirut",
+ "Europe_Eastern", "FI", "Europe/Helsinki",
"Europe_Eastern", "GR", "Europe/Athens",
"Europe_Eastern", "JO", "Asia/Amman",
- "Europe_Eastern", "CY", "Asia/Nicosia",
+ "Europe_Eastern", "LB", "Asia/Beirut",
+ "Europe_Eastern", "SY", "Asia/Damascus",
+ "Europe_Further_Eastern", "RU", "Europe/Kaliningrad",
+ "Europe_Western", "FO", "Atlantic/Faeroe",
+ "GMT", "BF", "Africa/Ouagadougou",
+ "GMT", "CI", "Africa/Abidjan",
+ "GMT", "GB", "Europe/London",
+ "GMT", "GH", "Africa/Accra",
+ "GMT", "GM", "Africa/Banjul",
+ "GMT", "GN", "Africa/Conakry",
+ "GMT", "IE", "Europe/Dublin",
+ "GMT", "ML", "Africa/Bamako",
+ "GMT", "MR", "Africa/Nouakchott",
+ "GMT", "SH", "Atlantic/St_Helena",
+ "GMT", "SL", "Africa/Freetown",
+ "GMT", "SN", "Africa/Dakar",
+ "GMT", "ST", "Africa/Sao_Tome",
+ "GMT", "TG", "Africa/Lome",
+ "Gulf", "OM", "Asia/Muscat",
+ "India", "LK", "Asia/Colombo",
+ "Indochina", "KH", "Asia/Phnom_Penh",
+ "Indochina", "LA", "Asia/Vientiane",
+ "Korea", "KP", "Asia/Pyongyang",
+ "New_Zealand", "AQ", "Antarctica/McMurdo",
+
+ // From tzdb
+ "Africa_Western", "ST", "Africa/Sao_Tome", // tzdata2018c
};
private static final String[] aliasMap = new String[] {
- "Mexico/BajaNorte", "America/Tijuana",
- "Antarctica/South_Pole", "Antarctica/McMurdo",
- "US/Michigan", "America/Detroit",
- "America/Porto_Acre", "America/Rio_Branco",
- "US/Alaska", "America/Anchorage",
- "Asia/Ujung_Pandang", "Asia/Makassar",
- "Canada/Atlantic", "America/Halifax",
- "W-SU", "Europe/Moscow",
- "Kwajalein", "Pacific/Kwajalein",
- "Europe/Bratislava", "Europe/Prague",
- "Canada/Central", "America/Winnipeg",
- "Canada/Mountain", "America/Edmonton",
- "Iceland", "Atlantic/Reykjavik",
- "Asia/Ulan_Bator", "Asia/Ulaanbaatar",
- "UTC", "Etc/UTC",
- "Europe/Guernsey", "Europe/London",
- "Singapore", "Asia/Singapore",
- "Atlantic/Faeroe", "Atlantic/Faroe",
- "Greenwich", "Etc/GMT",
- "America/Fort_Wayne", "America/Indiana/Indianapolis",
- "Etc/Universal", "Etc/UTC",
- "Chile/EasterIsland", "Pacific/Easter",
- "Pacific/Samoa", "Pacific/Pago_Pago",
- "Europe/Nicosia", "Asia/Nicosia",
- "Etc/Zulu", "Etc/UTC",
- "Asia/Ashkhabad", "Asia/Ashgabat",
- "America/Louisville", "America/Kentucky/Louisville",
- "Australia/North", "Australia/Darwin",
- "America/Atka", "America/Adak",
- "America/Marigot", "America/Guadeloupe",
- "Brazil/DeNoronha", "America/Noronha",
- "Turkey", "Europe/Istanbul",
- "Zulu", "Etc/UTC",
- "Europe/Vatican", "Europe/Rome",
- "Israel", "Asia/Jerusalem",
- "America/Rosario", "America/Argentina/Cordoba",
- "Jamaica", "America/Jamaica",
- "Asia/Katmandu", "Asia/Kathmandu",
- "Canada/East-Saskatchewan", "America/Regina",
- "ROK", "Asia/Seoul",
- "Asia/Macao", "Asia/Macau",
- "Australia/South", "Australia/Adelaide",
- "US/Arizona", "America/Phoenix",
- "Australia/Yancowinna", "Australia/Broken_Hill",
- "Canada/Pacific", "America/Vancouver",
- "Libya", "Africa/Tripoli",
- "Japan", "Asia/Tokyo",
- "Arctic/Longyearbyen", "Europe/Oslo",
+ // From supplementalMetadata.xml
"Africa/Timbuktu", "Africa/Bamako",
- "America/Indianapolis", "America/Indiana/Indianapolis",
- "Etc/Greenwich", "Etc/GMT",
- "Australia/ACT", "Australia/Sydney",
- "GMT", "Etc/GMT",
- "Mexico/BajaSur", "America/Mazatlan",
- "Cuba", "America/Havana",
- "Brazil/West", "America/Manaus",
- "Asia/Saigon", "Asia/Ho_Chi_Minh",
- "America/Jujuy", "America/Argentina/Jujuy",
- "Australia/Victoria", "Australia/Melbourne",
- "America/Catamarca", "America/Argentina/Catamarca",
- "America/Ensenada", "America/Tijuana",
- "Europe/San_Marino", "Europe/Rome",
- "Europe/Isle_of_Man", "Europe/London",
- "Mexico/General", "America/Mexico_City",
- "US/Hawaii", "Pacific/Honolulu",
- "Europe/Mariehamn", "Europe/Helsinki",
- "US/Indiana-Starke", "America/Indiana/Knox",
- "Australia/NSW", "Australia/Sydney",
- "Australia/West", "Australia/Perth",
- "Brazil/Acre", "America/Rio_Branco",
- "Australia/Tasmania", "Australia/Hobart",
- "Atlantic/Jan_Mayen", "Europe/Oslo",
- "America/Buenos_Aires", "America/Argentina/Buenos_Aires",
- "Europe/Jersey", "Europe/London",
- "Brazil/East", "America/Sao_Paulo",
- "America/Virgin", "America/St_Thomas",
- "Navajo", "America/Denver",
- "GB", "Europe/London",
- "Poland", "Europe/Warsaw",
- "Pacific/Yap", "Pacific/Chuuk",
- "America/Argentina/ComodRivadavia", "America/Argentina/Catamarca",
- "Asia/Calcutta", "Asia/Kolkata",
- "America/Mendoza", "America/Argentina/Mendoza",
- "Universal", "Etc/UTC",
- "Australia/Queensland", "Australia/Brisbane",
- "Asia/Dacca", "Asia/Dhaka",
- "US/Pacific", "America/Los_Angeles",
- "Asia/Chungking", "Asia/Chongqing",
- "Pacific/Truk", "Pacific/Chuuk",
- "ROC", "Asia/Taipei",
- "US/Aleutian", "America/Adak",
- "Pacific/Ponape", "Pacific/Pohnpei",
- "Canada/Yukon", "America/Whitehorse",
- "PRC", "Asia/Shanghai",
- "Africa/Asmera", "Africa/Asmara",
- "GB-Eire", "Europe/London",
- "America/St_Barthelemy", "America/Guadeloupe",
- "US/Central", "America/Chicago",
- "Egypt", "Africa/Cairo",
- "Chile/Continental", "America/Santiago",
- "Portugal", "Europe/Lisbon",
- "Europe/Tiraspol", "Europe/Chisinau",
- "America/Coral_Harbour", "America/Atikokan",
- "Europe/Belfast", "Europe/London",
- "America/Cordoba", "America/Argentina/Cordoba",
+ "America/Montreal", "America/Toronto",
"America/Shiprock", "America/Denver",
- "NZ-CHAT", "Pacific/Chatham",
- "Eire", "Europe/Dublin",
- "US/East-Indiana", "America/Indiana/Indianapolis",
- "Australia/Canberra", "Australia/Sydney",
- "Canada/Newfoundland", "America/St_Johns",
- "UCT", "Etc/UCT",
- "Australia/LHI", "Australia/Lord_Howe",
- "Iran", "Asia/Tehran",
- "US/Eastern", "America/New_York",
- "Canada/Eastern", "America/Toronto",
- "US/Samoa", "Pacific/Pago_Pago",
+ "Antarctica/South_Pole", "Pacific/Auckland",
+ "Asia/Chongqing", "Asia/Shanghai",
+ "Asia/Harbin", "Asia/Shanghai",
+ "Asia/Kashgar", "Asia/Urumqi",
+ "Atlantic/Jan_Mayen", "Europe/Oslo",
+ "EST", "America/Indianapolis",
+ "Europe/Belfast", "Europe/London",
+ "HST", "Pacific/Honolulu",
+ "MST", "America/Phoenix",
+ "Pacific/Yap", "Pacific/Truk",
+ "SystemV/AST4", "America/Puerto_Rico",
+ "SystemV/AST4ADT", "America/Halifax",
+ "SystemV/CST6", "America/Regina",
+ "SystemV/CST6CDT", "America/Chicago",
+ "SystemV/EST5", "America/Indianapolis",
+ "SystemV/EST5EDT", "America/New_York",
+ "SystemV/HST10", "Pacific/Honolulu",
+ "SystemV/MST7", "America/Phoenix",
+ "SystemV/MST7MDT", "America/Denver",
+ "SystemV/PST8", "Pacific/Pitcairn",
+ "SystemV/PST8PDT", "America/Los_Angeles",
+ "SystemV/YST9", "Pacific/Gambier",
+ "SystemV/YST9YDT", "America/Anchorage",
+
+ // From tzdb
+ "Africa/Addis_Ababa", "Africa/Nairobi",
+ "Africa/Asmara", "Africa/Nairobi",
+ "Africa/Asmera", "Africa/Nairobi",
+ "Africa/Bamako", "Africa/Abidjan",
+ "Africa/Bangui", "Africa/Lagos",
+ "Africa/Banjul", "Africa/Abidjan",
+ "Africa/Blantyre", "Africa/Maputo",
+ "Africa/Brazzaville", "Africa/Lagos",
+ "Africa/Bujumbura", "Africa/Maputo",
+ "Africa/Conakry", "Africa/Abidjan",
+ "Africa/Dakar", "Africa/Abidjan",
+ "Africa/Dar_es_Salaam", "Africa/Nairobi",
+ "Africa/Djibouti", "Africa/Nairobi",
+ "Africa/Douala", "Africa/Lagos",
+ "Africa/Freetown", "Africa/Abidjan",
+ "Africa/Gaborone", "Africa/Maputo",
+ "Africa/Harare", "Africa/Maputo",
+ "Africa/Kampala", "Africa/Nairobi",
+ "Africa/Kigali", "Africa/Maputo",
+ "Africa/Kinshasa", "Africa/Lagos",
+ "Africa/Libreville", "Africa/Lagos",
+ "Africa/Lome", "Africa/Abidjan",
+ "Africa/Luanda", "Africa/Lagos",
+ "Africa/Lubumbashi", "Africa/Maputo",
+ "Africa/Lusaka", "Africa/Maputo",
+ "Africa/Malabo", "Africa/Lagos",
+ "Africa/Maseru", "Africa/Johannesburg",
+ "Africa/Mbabane", "Africa/Johannesburg",
+ "Africa/Mogadishu", "Africa/Nairobi",
+ "Africa/Niamey", "Africa/Lagos",
+ "Africa/Nouakchott", "Africa/Abidjan",
+ "Africa/Ouagadougou", "Africa/Abidjan",
+ "Africa/Porto-Novo", "Africa/Lagos",
+ "Africa/Timbuktu", "Africa/Abidjan",
+ "America/Anguilla", "America/Port_of_Spain",
+ "America/Antigua", "America/Port_of_Spain",
+ "America/Argentina/ComodRivadavia", "America/Argentina/Catamarca",
+ "America/Aruba", "America/Curacao",
+ "America/Atka", "America/Adak",
+ "America/Buenos_Aires", "America/Argentina/Buenos_Aires",
+ "America/Catamarca", "America/Argentina/Catamarca",
+ "America/Cayman", "America/Panama",
+ "America/Coral_Harbour", "America/Atikokan",
+ "America/Cordoba", "America/Argentina/Cordoba",
+ "America/Dominica", "America/Port_of_Spain",
+ "America/Ensenada", "America/Tijuana",
+ "America/Fort_Wayne", "America/Indiana/Indianapolis",
+ "America/Godthab", "America/Nuuk",
+ "America/Grenada", "America/Port_of_Spain",
+ "America/Guadeloupe", "America/Port_of_Spain",
+ "America/Indianapolis", "America/Indiana/Indianapolis",
+ "America/Jujuy", "America/Argentina/Jujuy",
"America/Knox_IN", "America/Indiana/Knox",
- "Canada/Saskatchewan", "America/Regina",
- "Asia/Thimbu", "Asia/Thimphu",
- "US/Mountain", "America/Denver",
- "NZ", "Pacific/Auckland",
+ "America/Kralendijk", "America/Curacao",
+ "America/Louisville", "America/Kentucky/Louisville",
+ "America/Lower_Princes", "America/Curacao",
+ "America/Marigot", "America/Port_of_Spain",
+ "America/Mendoza", "America/Argentina/Mendoza",
+ "America/Montreal", "America/Toronto",
+ "America/Montserrat", "America/Port_of_Spain",
+ "America/Porto_Acre", "America/Rio_Branco",
+ "America/Rosario", "America/Argentina/Cordoba",
+ "America/Santa_Isabel", "America/Tijuana",
+ "America/Shiprock", "America/Denver",
+ "America/St_Barthelemy", "America/Port_of_Spain",
+ "America/St_Kitts", "America/Port_of_Spain",
+ "America/St_Lucia", "America/Port_of_Spain",
+ "America/St_Thomas", "America/Port_of_Spain",
+ "America/St_Vincent", "America/Port_of_Spain",
+ "America/Tortola", "America/Port_of_Spain",
+ "America/Virgin", "America/Port_of_Spain",
+ "Antarctica/McMurdo", "Pacific/Auckland",
+ "Antarctica/South_Pole", "Pacific/Auckland",
+ "Arctic/Longyearbyen", "Europe/Oslo",
+ "Asia/Aden", "Asia/Riyadh",
+ "Asia/Ashkhabad", "Asia/Ashgabat",
+ "Asia/Bahrain", "Asia/Qatar",
+ "Asia/Calcutta", "Asia/Kolkata",
+ "Asia/Chongqing", "Asia/Shanghai",
+ "Asia/Chungking", "Asia/Shanghai",
+ "Asia/Dacca", "Asia/Dhaka",
+ "Asia/Harbin", "Asia/Shanghai",
+ "Asia/Istanbul", "Europe/Istanbul",
+ "Asia/Kashgar", "Asia/Urumqi",
+ "Asia/Katmandu", "Asia/Kathmandu",
+ "Asia/Kuwait", "Asia/Riyadh",
+ "Asia/Macao", "Asia/Macau",
+ "Asia/Muscat", "Asia/Dubai",
+ "Asia/Phnom_Penh", "Asia/Bangkok",
+ "Asia/Rangoon", "Asia/Yangon",
+ "Asia/Saigon", "Asia/Ho_Chi_Minh",
"Asia/Tel_Aviv", "Asia/Jerusalem",
+ "Asia/Thimbu", "Asia/Thimphu",
+ "Asia/Ujung_Pandang", "Asia/Makassar",
+ "Asia/Ulan_Bator", "Asia/Ulaanbaatar",
+ "Asia/Vientiane", "Asia/Bangkok",
+ "Atlantic/Faeroe", "Atlantic/Faroe",
+ "Atlantic/Jan_Mayen", "Europe/Oslo",
+ "Atlantic/St_Helena", "Africa/Abidjan",
+ "Australia/ACT", "Australia/Sydney",
+ "Australia/Canberra", "Australia/Sydney",
+ "Australia/LHI", "Australia/Lord_Howe",
+ "Australia/NSW", "Australia/Sydney",
+ "Australia/North", "Australia/Darwin",
+ "Australia/Queensland", "Australia/Brisbane",
+ "Australia/South", "Australia/Adelaide",
+ "Australia/Tasmania", "Australia/Hobart",
+ "Australia/Victoria", "Australia/Melbourne",
+ "Australia/West", "Australia/Perth",
+ "Australia/Yancowinna", "Australia/Broken_Hill",
+ "Brazil/Acre", "America/Rio_Branco",
+ "Brazil/DeNoronha", "America/Noronha",
+ "Brazil/East", "America/Sao_Paulo",
+ "Brazil/West", "America/Manaus",
+ "Canada/Atlantic", "America/Halifax",
+ "Canada/Central", "America/Winnipeg",
+ "Canada/Eastern", "America/Toronto",
+ "Canada/Mountain", "America/Edmonton",
+ "Canada/Newfoundland", "America/St_Johns",
+ "Canada/Pacific", "America/Vancouver",
+ "Canada/Saskatchewan", "America/Regina",
+ "Canada/Yukon", "America/Whitehorse",
+ "Chile/Continental", "America/Santiago",
+ "Chile/EasterIsland", "Pacific/Easter",
+ "Cuba", "America/Havana",
+ "Egypt", "Africa/Cairo",
+ "Eire", "Europe/Dublin",
+ "Etc/GMT+0", "Etc/GMT",
+ "Etc/GMT-0", "Etc/GMT",
+ "Etc/GMT0", "Etc/GMT",
+ "Etc/Greenwich", "Etc/GMT",
+ "Etc/Universal", "Etc/UTC",
+ "Etc/Zulu", "Etc/UTC",
+ "Europe/Belfast", "Europe/London",
+ "Europe/Bratislava", "Europe/Prague",
+ "Europe/Busingen", "Europe/Zurich",
+ "Europe/Guernsey", "Europe/London",
+ "Europe/Isle_of_Man", "Europe/London",
+ "Europe/Jersey", "Europe/London",
+ "Europe/Ljubljana", "Europe/Belgrade",
+ "Europe/Mariehamn", "Europe/Helsinki",
+ "Europe/Nicosia", "Asia/Nicosia",
+ "Europe/Podgorica", "Europe/Belgrade",
+ "Europe/San_Marino", "Europe/Rome",
+ "Europe/Sarajevo", "Europe/Belgrade",
+ "Europe/Skopje", "Europe/Belgrade",
+ "Europe/Tiraspol", "Europe/Chisinau",
+ "Europe/Vaduz", "Europe/Zurich",
+ "Europe/Vatican", "Europe/Rome",
+ "Europe/Zagreb", "Europe/Belgrade",
+ "GB", "Europe/London",
+ "GB-Eire", "Europe/London",
+ "GMT", "Etc/GMT",
+ "GMT+0", "Etc/GMT",
+ "GMT-0", "Etc/GMT",
+ "GMT0", "Etc/GMT",
+ "Greenwich", "Etc/GMT",
"Hongkong", "Asia/Hong_Kong",
+ "Iceland", "Atlantic/Reykjavik",
+ "Indian/Antananarivo", "Africa/Nairobi",
+ "Indian/Comoro", "Africa/Nairobi",
+ "Indian/Mayotte", "Africa/Nairobi",
+ "Iran", "Asia/Tehran",
+ "Israel", "Asia/Jerusalem",
+ "Jamaica", "America/Jamaica",
+ "Japan", "Asia/Tokyo",
+ "Kwajalein", "Pacific/Kwajalein",
+ "Libya", "Africa/Tripoli",
+ "Mexico/BajaNorte", "America/Tijuana",
+ "Mexico/BajaSur", "America/Mazatlan",
+ "Mexico/General", "America/Mexico_City",
+ "Mideast/Riyadh87", "Asia/Riyadh87",
+ "Mideast/Riyadh88", "Asia/Riyadh88",
+ "Mideast/Riyadh89", "Asia/Riyadh89",
+ "NZ", "Pacific/Auckland",
+ "NZ-CHAT", "Pacific/Chatham",
+ "Navajo", "America/Denver",
+ "PRC", "Asia/Shanghai",
+ "Pacific/Johnston", "Pacific/Honolulu",
+ "Pacific/Midway", "Pacific/Pago_Pago",
+ "Pacific/Ponape", "Pacific/Pohnpei",
+ "Pacific/Saipan", "Pacific/Guam",
+ "Pacific/Samoa", "Pacific/Pago_Pago",
+ "Pacific/Truk", "Pacific/Chuuk",
+ "Pacific/Yap", "Pacific/Chuuk",
+ "Poland", "Europe/Warsaw",
+ "Portugal", "Europe/Lisbon",
+ "ROC", "Asia/Taipei",
+ "ROK", "Asia/Seoul",
+ "Singapore", "Asia/Singapore",
+ "Turkey", "Europe/Istanbul",
+ "UCT", "Etc/UCT",
+ "US/Alaska", "America/Anchorage",
+ "US/Aleutian", "America/Adak",
+ "US/Arizona", "America/Phoenix",
+ "US/Central", "America/Chicago",
+ "US/East-Indiana", "America/Indiana/Indianapolis",
+ "US/Eastern", "America/New_York",
+ "US/Hawaii", "Pacific/Honolulu",
+ "US/Indiana-Starke", "America/Indiana/Knox",
+ "US/Michigan", "America/Detroit",
+ "US/Mountain", "America/Denver",
+ "US/Pacific", "America/Los_Angeles",
+ "US/Samoa", "Pacific/Pago_Pago",
+ "UTC", "Etc/UTC",
+ "Universal", "Etc/UTC",
+ "W-SU", "Europe/Moscow",
+ "Zulu", "Etc/UTC",
};
private static final Map<String, String> zidToMzone = new HashMap<>();
diff --git a/ojluni/src/test/java/time/test/java/time/temporal/TestChronoField.java b/ojluni/src/test/java/time/test/java/time/temporal/TestChronoField.java
index 4946ccd..df51dbb 100644
--- a/ojluni/src/test/java/time/test/java/time/temporal/TestChronoField.java
+++ b/ojluni/src/test/java/time/test/java/time/temporal/TestChronoField.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -123,7 +123,6 @@
public void test_IsoFields_week_based_year() {
Locale locale = Locale.US;
String name = IsoFields.WEEK_OF_WEEK_BASED_YEAR.getDisplayName(locale);
- // Android-changed: week is lower-case in CLDR.
assertEquals(name, "week");
}
@@ -137,7 +136,6 @@
Locale locale = Locale.US;
TemporalField weekOfYearField = WeekFields.SUNDAY_START.weekOfYear();
String name = weekOfYearField.getDisplayName(locale);
- // Android-changed: week is lower-case in CLDR.
assertEquals(name, "week");
}
diff --git a/ojluni/src/test/java/time/test/java/time/temporal/TestIsoWeekFields.java b/ojluni/src/test/java/time/test/java/time/temporal/TestIsoWeekFields.java
index d79d13f..71916c1 100644
--- a/ojluni/src/test/java/time/test/java/time/temporal/TestIsoWeekFields.java
+++ b/ojluni/src/test/java/time/test/java/time/temporal/TestIsoWeekFields.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -121,6 +121,14 @@
assertEquals(IsoFields.WEEK_BASED_YEAR.isSupportedBy(ThaiBuddhistDate.now()), false);
}
+ @Test
+ public void test_Unit_isSupportedBy_ISO() {
+ assertEquals(IsoFields.WEEK_BASED_YEARS.isSupportedBy(LocalDate.now()),true);
+ assertEquals(IsoFields.WEEK_BASED_YEARS.isSupportedBy(ThaiBuddhistDate.now()),false);
+ assertEquals(IsoFields.QUARTER_YEARS.isSupportedBy(LocalDate.now()),true);
+ assertEquals(IsoFields.QUARTER_YEARS.isSupportedBy(ThaiBuddhistDate.now()),false);
+ }
+
@Test(dataProvider = "fields")
public void test_WBY_range(TemporalField weekField, TemporalField yearField) {
assertEquals(yearField.range(), ValueRange.of(Year.MIN_VALUE, Year.MAX_VALUE));
diff --git a/ojluni/src/test/java/time/test/java/time/zone/TestZoneRules.java b/ojluni/src/test/java/time/test/java/time/zone/TestZoneRules.java
new file mode 100644
index 0000000..03ff71f
--- /dev/null
+++ b/ojluni/src/test/java/time/test/java/time/zone/TestZoneRules.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package test.java.time.zone;
+
+import static org.testng.Assert.assertEquals;
+
+import java.time.Instant;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.ZonedDateTime;
+import java.time.ZoneId;
+import java.time.ZoneOffset;
+import java.time.zone.ZoneOffsetTransition;
+import java.time.zone.ZoneRules;
+
+import org.testng.annotations.Test;
+import org.testng.annotations.DataProvider;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+/**
+ * @summary Test ZoneRules whether the savings are positive in time zones that have
+ * negative savings in the source TZ files. Also, check the transition cutover
+ * time beyond 24:00, which should translate into the next day.
+ *
+ * @bug 8212970
+ */
+@Test
+public class TestZoneRules {
+
+ private static final ZoneId DUBLIN = ZoneId.of("Europe/Dublin");
+ private static final ZoneId PRAGUE = ZoneId.of("Europe/Prague");
+ private static final ZoneId WINDHOEK = ZoneId.of("Africa/Windhoek");
+ private static final ZoneId CASABLANCA = ZoneId.of("Africa/Casablanca");
+
+ private static final ZoneId TOKYO = ZoneId.of("Asia/Tokyo");
+ private static final LocalTime ONE_AM = LocalTime.of(1, 0);
+
+ @DataProvider
+ private Object[][] negativeDST () {
+ return new Object[][] {
+ // ZoneId, localDate, offset, standard offset, isDaylightSavings
+ // Europe/Dublin for the Rule "Eire"
+ // Android-changed: During 1969 - 1971 summers, Europe/Dublin is using GMT+1 as the standard time.
+ // {DUBLIN, LocalDate.of(1970, 6, 23), ZoneOffset.ofHours(1), ZoneOffset.ofHours(0), true},
+ // {DUBLIN, LocalDate.of(1971, 6, 23), ZoneOffset.ofHours(1), ZoneOffset.ofHours(0), true},
+ {DUBLIN, LocalDate.of(1970, 6, 23), ZoneOffset.ofHours(1), ZoneOffset.ofHours(1), false},
+ {DUBLIN, LocalDate.of(1971, 6, 23), ZoneOffset.ofHours(1), ZoneOffset.ofHours(1), false},
+ {DUBLIN, LocalDate.of(1971, 11, 1), ZoneOffset.ofHours(0), ZoneOffset.ofHours(0), false},
+ {DUBLIN, LocalDate.of(2019, 6, 23), ZoneOffset.ofHours(1), ZoneOffset.ofHours(0), true},
+ {DUBLIN, LocalDate.of(2019, 12, 23), ZoneOffset.ofHours(0), ZoneOffset.ofHours(0), false},
+
+ // Europe/Prague which contains fixed negative savings (not a named Rule)
+ {PRAGUE, LocalDate.of(1946, 9, 30), ZoneOffset.ofHours(2), ZoneOffset.ofHours(1), true},
+ {PRAGUE, LocalDate.of(1946, 10, 10), ZoneOffset.ofHours(1), ZoneOffset.ofHours(1), false},
+ {PRAGUE, LocalDate.of(1946, 12, 3), ZoneOffset.ofHours(0), ZoneOffset.ofHours(0), false},
+ {PRAGUE, LocalDate.of(1947, 2, 25), ZoneOffset.ofHours(1), ZoneOffset.ofHours(1), false},
+ {PRAGUE, LocalDate.of(1947, 4, 30), ZoneOffset.ofHours(2), ZoneOffset.ofHours(1), true},
+
+ // Africa/Windhoek for the Rule "Namibia"
+ {WINDHOEK, LocalDate.of(1994, 3, 23), ZoneOffset.ofHours(1), ZoneOffset.ofHours(1), false},
+ {WINDHOEK, LocalDate.of(2016, 9, 23), ZoneOffset.ofHours(2), ZoneOffset.ofHours(1), true},
+
+ // Africa/Casablanca for the Rule "Morocco" Defines negative DST till 2037 as of 2019a.
+ {CASABLANCA, LocalDate.of(1939, 9, 13), ZoneOffset.ofHours(1), ZoneOffset.ofHours(0), true},
+ {CASABLANCA, LocalDate.of(1939, 11, 20), ZoneOffset.ofHours(0), ZoneOffset.ofHours(0), false},
+ {CASABLANCA, LocalDate.of(2018, 6, 18), ZoneOffset.ofHours(1), ZoneOffset.ofHours(0), true},
+ {CASABLANCA, LocalDate.of(2019, 1, 1), ZoneOffset.ofHours(1), ZoneOffset.ofHours(0), true},
+ {CASABLANCA, LocalDate.of(2019, 5, 6), ZoneOffset.ofHours(0), ZoneOffset.ofHours(0), false},
+ {CASABLANCA, LocalDate.of(2037, 10, 5), ZoneOffset.ofHours(0), ZoneOffset.ofHours(0), false},
+ {CASABLANCA, LocalDate.of(2037, 11, 16), ZoneOffset.ofHours(1), ZoneOffset.ofHours(0), true},
+ {CASABLANCA, LocalDate.of(2038, 11, 8), ZoneOffset.ofHours(1), ZoneOffset.ofHours(0), true},
+ };
+ }
+
+ @DataProvider
+ private Object[][] transitionBeyondDay() {
+ return new Object[][] {
+ // ZoneId, LocalDateTime, beforeOffset, afterOffset
+
+ // Asserts that the rule:
+ // Rule Japan 1948 1951 - Sep Sat>=8 25:00 0 S
+ // translates to the next day.
+ {TOKYO, LocalDateTime.of(LocalDate.of(1948, 9, 12), ONE_AM), ZoneOffset.ofHours(10), ZoneOffset.ofHours(9)},
+ {TOKYO, LocalDateTime.of(LocalDate.of(1949, 9, 11), ONE_AM), ZoneOffset.ofHours(10), ZoneOffset.ofHours(9)},
+ {TOKYO, LocalDateTime.of(LocalDate.of(1950, 9, 10), ONE_AM), ZoneOffset.ofHours(10), ZoneOffset.ofHours(9)},
+ {TOKYO, LocalDateTime.of(LocalDate.of(1951, 9, 9), ONE_AM), ZoneOffset.ofHours(10), ZoneOffset.ofHours(9)},
+ };
+ }
+
+ // Android-changed: Android doesn't support negative DST yet.
+ @Test(dataProvider="negativeDST")
+ public void test_NegativeDST(ZoneId zid, LocalDate ld, ZoneOffset offset, ZoneOffset stdOffset, boolean isDST) {
+ Instant i = Instant.from(ZonedDateTime.of(ld, LocalTime.MIN, zid));
+ ZoneRules zr = zid.getRules();
+ assertEquals(zr.getOffset(i), offset);
+ assertEquals(zr.getStandardOffset(i), stdOffset);
+ assertEquals(zr.isDaylightSavings(i), isDST);
+ }
+
+ @Test(dataProvider="transitionBeyondDay")
+ public void test_TransitionBeyondDay(ZoneId zid, LocalDateTime ldt, ZoneOffset before, ZoneOffset after) {
+ ZoneOffsetTransition zot = ZoneOffsetTransition.of(ldt, before, after);
+ ZoneRules zr = zid.getRules();
+ assertTrue(zr.getTransitions().contains(zot));
+ }
+}
diff --git a/ojluni/src/test/java/time/test/java/util/TestFormatter.java b/ojluni/src/test/java/time/test/java/util/TestFormatter.java
index 7b405ca..d2167a6 100644
--- a/ojluni/src/test/java/time/test/java/util/TestFormatter.java
+++ b/ojluni/src/test/java/time/test/java/util/TestFormatter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,7 @@
import java.time.temporal.ChronoField;
import java.time.temporal.TemporalQueries;
import java.time.temporal.TemporalAccessor;
+import java.time.temporal.UnsupportedTemporalTypeException;
import java.util.*;
@@ -46,7 +47,7 @@
/* @test
* @summary Unit test for j.u.Formatter threeten date/time support
- * @bug 8003680 8012638
+ * @bug 8003680 8043387 8012638
*/
@Test
public class TestFormatter {
@@ -161,6 +162,47 @@
if (verbose) {
System.out.printf("%-24s : %s%n", getClassName(dt), out);
}
+
+ // expected usually comes from Calendar which only has milliseconds
+ // precision. So we're going to replace it's N:[nanos] stamp with
+ // the correct value for nanos.
+ if ((dt instanceof TemporalAccessor) && expected != null) {
+ try {
+ // Get millis & nanos from the dt
+ final TemporalAccessor ta = (TemporalAccessor) dt;
+ // Android-changed: Formatter doesn't support nanosecond yet.
+ // TODO: Revert this patch when Formatter is upgraded from 8 to 11 version.
+ // final int nanos = ta.get(ChronoField.NANO_OF_SECOND);
+ final int millis = ta.get(ChronoField.MILLI_OF_SECOND);
+ final int nanos = millis * 1000000;
+ final String nanstr = String.valueOf(nanos);
+ final String mistr = String.valueOf(millis);
+
+ // Compute the value of the N:[nanos] field that we expect
+ // to find in 'out'
+ final StringBuilder sb = new StringBuilder();
+ sb.append("N:[");
+ for (int i=nanstr.length(); i<9; i++) {
+ sb.append('0');
+ }
+ sb.append(nanos).append("]");
+
+ // Compute the truncated value of N:[nanos] field that might
+ // be in 'expected' when expected was built from Calendar.
+ final StringBuilder sbm = new StringBuilder();
+ sbm.append("N:[");
+ for (int i=mistr.length(); i<3; i++) {
+ sbm.append('0');
+ }
+ sbm.append(mistr).append("000000]");
+
+ // if expected contains the truncated value, replace it with
+ // the complete value.
+ expected = expected.replace(sbm.toString(), sb.toString());
+ } catch (UnsupportedTemporalTypeException e) {
+ // nano seconds unsupported - nothing to do...
+ }
+ }
if (expected != null && !out.equals(expected)) {
System.out.printf("%-24s actual: %s%n FAILED; expected: %s%n",
getClassName(dt), out, expected);
@@ -204,11 +246,6 @@
}
}
- private String toZoneIdStr(String expected) {
- // Android-changed: java.util.Calendar and java.time types are formatted identically.
- return expected;
- }
-
private String toZoneOffsetStr(String expected) {
// Android-changed: Android Matcher doesn't support named groups. Also GMT/Z is formatted as
// "GMT+00:00" or "GMT".
@@ -219,8 +256,7 @@
private void testZoneId(Locale locale, ChronoZonedDateTime<?> zdt, Calendar cal) {
String fmtStr = "z:[%tz] z:[%1$Tz] Z:[%1$tZ] Z:[%1$TZ]";
printFmtStr(locale, fmtStr);
- String calOutput = test(fmtStr, locale, null, cal);
- String expected = toZoneIdStr(calOutput);
+ String expected = test(fmtStr, locale, null, cal);
test(fmtStr, locale, expected, zdt);
// get a new cal with fixed tz
Calendar cal0 = Calendar.getInstance();
@@ -236,7 +272,7 @@
// datetime + zid
fmtStr = "c:[%tc] c:[%1$Tc]";
printFmtStr(locale, fmtStr);
- expected = toZoneIdStr(test(fmtStr, locale, null, cal));
+ expected = test(fmtStr, locale, null, cal);
test(fmtStr, locale, expected, zdt);
}
diff --git a/ojluni/src/test/java/util/function/PredicateNotTest.java b/ojluni/src/test/java/util/function/PredicateNotTest.java
index 55b3618..4c3ec25 100644
--- a/ojluni/src/test/java/util/function/PredicateNotTest.java
+++ b/ojluni/src/test/java/util/function/PredicateNotTest.java
@@ -28,15 +28,44 @@
*/
package test.java.util.function;
+// Android-added: workaround for d8 backports.
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+
import java.util.List;
import java.util.function.Predicate;
import org.testng.annotations.Test;
-import static java.util.function.Predicate.not;
+
import static java.util.stream.Collectors.joining;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.fail;
public class PredicateNotTest {
+ // BEGIN Android-added
+ // MethodHandle for invoking Predicate.not() to prevent d8 inserting it's backported
+ // `Predicate.not()` method (b/191859202, OpenJDK 11) and masking test coverage results.
+ static final MethodHandle NOT = initializeNot();
+
+ private static MethodHandle initializeNot()
+ {
+ try {
+ MethodType notType = MethodType.methodType(Predicate.class, Predicate.class);
+ return MethodHandles.lookup().findStatic(Predicate.class, "not", notType);
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }
+
+ static <T> Predicate<T> not(Predicate<? super T> target) {
+ try {
+ return (Predicate<T>) NOT.invoke(target);
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }
+ // END Android-added
+
static class IsEmptyPredicate implements Predicate<String> {
@Override
public boolean test(String s) {
diff --git a/ojluni/src/test/java/util/zip/ZipFile/Zip64SizeTest.java b/ojluni/src/test/java/util/zip/ZipFile/Zip64SizeTest.java
new file mode 100644
index 0000000..b8dba36
--- /dev/null
+++ b/ojluni/src/test/java/util/zip/ZipFile/Zip64SizeTest.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.java.util.zip.ZipFile;
+
+import java.nio.file.FileSystems;
+import java.nio.file.Paths;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.io.*;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipOutputStream;
+
+import static org.testng.Assert.assertTrue;
+
+/**
+ * @test
+ * @bug 8226530
+ * @summary ZIP File System tests that leverage DirectoryStream
+ * @modules java.base
+ * @compile Zip64SizeTest.java
+ * @run testng Zip64SizeTest
+ */
+public class Zip64SizeTest {
+
+ // Android-changed: Speed up the test with a larger buffer
+ // private static final int BUFFER_SIZE = 2048;
+ private static final int BUFFER_SIZE = 1024 * 1024; // 1MB
+ // ZIP file to create
+ // Android-changed: Create file in a temp dir.
+ // private static final String ZIP_FILE_NAME = "Zip64SizeTest.zip";
+ private static final String TMPDIR = System.getProperty("java.io.tmpdir");
+ private static final String ZIP_FILE_NAME = Paths.get(TMPDIR, "Zip64SizeTest.zip").toString();
+ private static final String LARGE_FILE = Paths.get(TMPDIR, "LargeZipEntry.txt").toString();
+ private static final String SMALL_FILE = Paths.get(TMPDIR, "SmallZipEntry.txt").toString();
+ // File that will be created with a size greater than 0xFFFFFFFF
+ private static final String LARGE_FILE_NAME = "LargeZipEntry.txt";
+ // File that will be created with a size less than 0xFFFFFFFF
+ private static final String SMALL_FILE_NAME = "SmallZipEntry.txt";
+ // List of files to be added to the ZIP file
+ // Android-changed: Create file in a temp dir.
+ // private static final List<String> ZIP_ENTRIES = List.of(LARGE_FILE_NAME,
+ // SMALL_FILE_NAME);
+ private static final List<String> ZIP_ENTRIES = List.of(LARGE_FILE, SMALL_FILE);
+ private static final long LARGE_FILE_SIZE = 5L * 1024L * 1024L * 1024L; // 5GB
+ private static final long SMALL_FILE_SIZE = 0x100000L; // 1024L x 1024L;
+
+ /**
+ * Validate that if the size of a ZIP entry exceeds 0xFFFFFFFF, that the
+ * correct size is returned from the ZIP64 Extended information.
+ * @throws IOException
+ */
+ @Test
+ // Android-changed: The test method needs to be public.
+ // private static void validateZipEntrySizes() throws IOException {
+ public void validateZipEntrySizes() throws IOException {
+ createFiles();
+ createZipFile();
+ System.out.println("Validating Zip Entry Sizes");
+ try (ZipFile zip = new ZipFile(ZIP_FILE_NAME)) {
+ ZipEntry ze = zip.getEntry(LARGE_FILE_NAME);
+ System.out.printf("Entry: %s, size= %s%n", ze.getName(), ze.getSize());
+ assertTrue(ze.getSize() == LARGE_FILE_SIZE);
+ ze = zip.getEntry(SMALL_FILE_NAME);
+ System.out.printf("Entry: %s, size= %s%n", ze.getName(), ze.getSize());
+ assertTrue(ze.getSize() == SMALL_FILE_SIZE);
+
+ }
+ }
+
+ /**
+ * Delete the files created for use by the test
+ * @throws IOException if an error occurs deleting the files
+ */
+ private static void deleteFiles() throws IOException {
+ // Android-changed: Path.of() isn't supported yet.
+ // Files.deleteIfExists(Path.of(ZIP_FILE_NAME));
+ // Files.deleteIfExists(Path.of(LARGE_FILE_NAME));
+ // Files.deleteIfExists(Path.of(SMALL_FILE_NAME));
+ Files.deleteIfExists(FileSystems.getDefault().getPath(ZIP_FILE_NAME));
+ Files.deleteIfExists(FileSystems.getDefault().getPath(LARGE_FILE));
+ Files.deleteIfExists(FileSystems.getDefault().getPath(SMALL_FILE));
+ }
+
+ /**
+ * Create the ZIP file adding an entry whose size exceeds 0xFFFFFFFF
+ * @throws IOException if an error occurs creating the ZIP File
+ */
+ private static void createZipFile() throws IOException {
+ try (FileOutputStream fos = new FileOutputStream(ZIP_FILE_NAME);
+ ZipOutputStream zos = new ZipOutputStream(fos)) {
+ System.out.printf("Creating Zip file: %s%n", ZIP_FILE_NAME);
+ for (String srcFile : ZIP_ENTRIES) {
+ System.out.printf("...Adding Entry: %s%n", srcFile);
+ File fileToZip = new File(srcFile);
+ try (FileInputStream fis = new FileInputStream(fileToZip)) {
+ ZipEntry zipEntry = new ZipEntry(fileToZip.getName());
+ zipEntry.setSize(fileToZip.length());
+ zos.putNextEntry(zipEntry);
+ byte[] bytes = new byte[BUFFER_SIZE];
+ int length;
+ while ((length = fis.read(bytes)) >= 0) {
+ zos.write(bytes, 0, length);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Create the files that will be added to the ZIP file
+ * @throws IOException if there is a problem creating the files
+ */
+ private static void createFiles() throws IOException {
+ // Android-changed: Create file in a temp dir.
+ // try (RandomAccessFile largeFile = new RandomAccessFile(LARGE_FILE_NAME, "rw");
+ // RandomAccessFile smallFile = new RandomAccessFile(SMALL_FILE_NAME, "rw")) {
+ try (RandomAccessFile largeFile = new RandomAccessFile(LARGE_FILE, "rw");
+ RandomAccessFile smallFile = new RandomAccessFile(SMALL_FILE, "rw")) {
+ System.out.printf("Creating %s%n", LARGE_FILE_NAME);
+ largeFile.setLength(LARGE_FILE_SIZE);
+ System.out.printf("Creating %s%n", SMALL_FILE_NAME);
+ smallFile.setLength(SMALL_FILE_SIZE);
+ }
+ }
+
+ /**
+ * Make sure the needed test files do not exist prior to executing the test
+ * @throws IOException
+ */
+ @BeforeMethod
+ public void setUp() throws IOException {
+ deleteFiles();
+ }
+
+ /**
+ * Remove the files created for the test
+ * @throws IOException
+ */
+ @AfterMethod
+ public void tearDown() throws IOException {
+ deleteFiles();
+ }
+}
\ No newline at end of file
diff --git a/ojluni/src/tools/build/tools/java.nio-generator/gen_java_nio.py b/ojluni/src/tools/build/tools/java.nio-generator/gen_java_nio.py
new file mode 100755
index 0000000..eec51c4
--- /dev/null
+++ b/ojluni/src/tools/build/tools/java.nio-generator/gen_java_nio.py
@@ -0,0 +1,249 @@
+#!/usr/bin/env python
+#
+# This code is derived from GensrcBuffer.gmk which carries the following copyright.
+#
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+"""
+Prints out the commands for generating the buffer classes in the java.nio package from templates.
+
+Run with "gen_java_nio.py <input directory> <output directory>"
+
+"""
+
+from enum import Enum, auto
+import math
+import os.path
+import argparse
+import sys
+
+PRIMITIVE_BYTE = "byte"
+PRIMITIVE_CHAR = "char"
+PRIMITIVE_SHORT = "short"
+PRIMITIVE_INT = "int"
+PRIMITIVE_LONG = "long"
+PRIMITIVE_FLOAT = "float"
+PRIMITIVE_DOUBLE = "double"
+
+PRIMITIVE_TO_BUFFER_PREFIX = {
+ PRIMITIVE_BYTE: "Byte",
+ PRIMITIVE_CHAR: "Char",
+ PRIMITIVE_SHORT: "Short",
+ PRIMITIVE_INT: "Int",
+ PRIMITIVE_LONG: "Long",
+ PRIMITIVE_FLOAT: "Float",
+ PRIMITIVE_DOUBLE: "Double",
+}
+
+PRIMITIVES = PRIMITIVE_TO_BUFFER_PREFIX.keys()
+
+PRIMITIVE_TO_REFERENCE_TYPE = {
+ PRIMITIVE_BYTE: "Byte",
+ PRIMITIVE_CHAR: "Character",
+ PRIMITIVE_SHORT: "Short",
+ PRIMITIVE_INT: "Integer",
+ PRIMITIVE_LONG: "Long",
+ PRIMITIVE_FLOAT: "Float",
+ PRIMITIVE_DOUBLE: "Double",
+}
+
+PRIMITIVE_TO_BYTES_PER_VALUE = {
+ PRIMITIVE_BYTE: 1,
+ PRIMITIVE_CHAR: 2,
+ PRIMITIVE_SHORT: 2,
+ PRIMITIVE_INT: 4,
+ PRIMITIVE_LONG: 8,
+ PRIMITIVE_FLOAT: 4,
+ PRIMITIVE_DOUBLE: 8,
+}
+
+BYTE_ORDER_DEFAULT = ""
+BYTE_ORDER_LITTLE_ENDIAN = "L"
+BYTE_ORDER_BIG_ENDIAN = "B"
+BYTE_ORDER_UNSWAPPED = "U"
+BYTE_ORDER_SWAPPED = "S"
+
+SPP = "java build.tools.spp.Spp "
+
+def generate_buffer(template_file, output_file, primitive_type,
+ bin_ops="", read_only=False, byte_order=BYTE_ORDER_DEFAULT, append=" > "):
+ # fixRW
+ the_rw_key = "ro" if read_only else "rw"
+
+ # typesAndBits
+ the_a = "a"
+ the_A = "A"
+ the_x = primitive_type[0]
+ the_Type = primitive_type
+ the_type = the_Type.lower()
+ the_Fulltype = PRIMITIVE_TO_REFERENCE_TYPE[primitive_type.lower()]
+ the_fulltype = the_Fulltype.lower()
+ the_category = "integralType"
+ the_streams = ""
+ the_streamtype = ""
+ the_Streamtype = ""
+ the_BPV = PRIMITIVE_TO_BYTES_PER_VALUE[primitive_type.lower()]
+ the_LBPV = math.log2(the_BPV)
+ the_RW = "R" if read_only else ""
+
+ if primitive_type == PRIMITIVE_CHAR:
+ the_streams = "streamableType"
+ the_streamtype = "int"
+ the_Streamtype = "Int"
+ elif primitive_type == PRIMITIVE_INT:
+ the_a = "an"
+ the_A = "An"
+ elif primitive_type == PRIMITIVE_FLOAT or primitive_type == PRIMITIVE_DOUBLE:
+ the_category = "floatingPointType"
+
+ the_Swaptype = the_Type
+ the_memType = the_type
+ the_MemType = the_Type
+ the_fromBits = ""
+ the_toBits = ""
+ if primitive_type == PRIMITIVE_FLOAT:
+ the_fromBits = "Float.intBitsToFloat"
+ the_toBits = "Float.floatToRawIntBits"
+ elif primitive_type == PRIMITIVE_DOUBLE:
+ the_fromBits = "Double.longBitsToDouble"
+ the_toBits = "Double.doubleToRawLongBits"
+
+ the_swap = ""
+
+ command = SPP
+ command = command + " -K" + the_type
+ command = command + " -K" + the_category
+ command = command + " -K" + the_streams
+ command = command + " -Dtype=" + the_type
+ command = command + " -DType=" + the_Type
+ command = command + " -Dfulltype=" + the_fulltype
+ command = command + " -DFulltype=" + the_Fulltype
+ command = command + " -Dstreamtype=" + the_streamtype
+ command = command + " -DStreamtype=" + the_Streamtype
+ command = command + " -Dx=" + the_x
+ command = command + " -Dmemtype=" + the_memType
+ command = command + " -DMemtype=" + the_MemType
+ command = command + " -DSwaptype=" + the_Swaptype
+ command = command + " -DfromBits=" + the_fromBits
+ command = command + " -DtoBits=" + the_toBits
+ command = command + " -DLG_BYTES_PER_VALUE=" + str(the_LBPV)
+ command = command + " -DBYTES_PER_VALUE=" + str(the_BPV)
+ command = command + " -DBO=" + byte_order
+ command = command + " -Dswap=" + the_swap
+ command = command + " -DRW=" + the_RW
+ command = command + " -K" + the_rw_key
+ command = command + " -Da=" + the_a
+ command = command + " -DA=" + the_A
+ if (append == " >> "):
+ command = command + " -be"
+ if byte_order:
+ command = command + " -Kbo" + byte_order
+ command = command + " < " + template_file
+ command = command + append + output_file
+ print(command)
+
+ if bin_ops:
+ for primitive in PRIMITIVES:
+ if (primitive == PRIMITIVE_BYTE): continue
+ buffer_prefix = PRIMITIVE_TO_BUFFER_PREFIX[primitive]
+ generate_buffer(bin_ops, output_file, buffer_prefix, "", False, "", " >> ")
+
+
+
+def iterate_through_primitives(input_dir, output_dir, template_name, output_name, byte_order):
+ for primitive in PRIMITIVES:
+ if (primitive == PRIMITIVE_BYTE): continue
+ buffer_prefix = PRIMITIVE_TO_BUFFER_PREFIX[primitive]
+ template_file = os.path.join(input_dir, template_name)
+ output_file = os.path.join(output_dir, output_name + buffer_prefix + "Buffer" + byte_order + ".java")
+ output_file_r = os.path.join(output_dir, output_name + buffer_prefix + "BufferR" + byte_order + ".java")
+ generate_buffer(template_file, output_file, buffer_prefix, "", False, byte_order)
+ print("\n")
+ generate_buffer(template_file, output_file_r, buffer_prefix, "", True, byte_order)
+ print("\n")
+
+ # Generate X-Buffers
+def main():
+ parser = argparse.ArgumentParser(
+ description='Parse input and output directories')
+ parser.add_argument('input', help='Path to the directory that contains the template files')
+ parser.add_argument('output', help='Path to the directory where the output files should be placed')
+ args = parser.parse_args()
+
+ template_dir = args.input
+ output_dir = args.output
+ print("\nX-Buffer\n")
+
+ for primitive in PRIMITIVES:
+ bin_ops = os.path.join(template_dir, "X-Buffer-bin.java.template") if primitive == PRIMITIVE_BYTE else ""
+ buffer_prefix = PRIMITIVE_TO_BUFFER_PREFIX[primitive]
+ template_file = os.path.join(template_dir, "X-Buffer.java.template")
+ output_file = os.path.join(output_dir, buffer_prefix + "Buffer.java")
+ generate_buffer(template_file, output_file, buffer_prefix, bin_ops)
+ print("\n")
+
+ print("\nHeap-X-Buffer\n")
+
+ for primitive in PRIMITIVES:
+ buffer_prefix = PRIMITIVE_TO_BUFFER_PREFIX[primitive]
+ template_file = os.path.join(template_dir, "Heap-X-Buffer.java.template")
+ output_file = os.path.join(output_dir, "Heap" + buffer_prefix + "Buffer.java")
+ output_file_r = os.path.join(output_dir, "Heap" + buffer_prefix + "BufferR.java")
+ generate_buffer(template_file, output_file, buffer_prefix, "")
+ print("\n")
+ generate_buffer(template_file, output_file_r, buffer_prefix, "", True)
+ print("\n")
+
+ print("\nDirect-X-Buffer\n")
+
+ generate_buffer(os.path.join(template_dir, "Direct-X-Buffer.java.template"),
+ os.path.join(output_dir, "DirectByteBuffer.java"), "Byte",
+ os.path.join(template_dir, "Direct-X-Buffer-bin.java.template"))
+ print("\n")
+ generate_buffer(os.path.join(template_dir, "Direct-X-Buffer.java.template"),
+ os.path.join(output_dir, "DirectByteBufferR.java"), "Byte",
+ os.path.join(template_dir, "Direct-X-Buffer-bin.java.template"), True)
+ print("\n")
+
+ print("\nDirect-X-Buffer Unswapped\n")
+
+ iterate_through_primitives(template_dir, output_dir, "Direct-X-Buffer.java.template", "Direct", "U")
+
+ print("\nDirect-X-Buffer Swapped\n")
+
+ iterate_through_primitives(template_dir, output_dir, "Direct-X-Buffer.java.template", "Direct", "S")
+
+ print("\nByteBufferAs-X-Buffer BigEndian\n")
+
+ iterate_through_primitives(template_dir, output_dir, "ByteBufferAs-X-Buffer.java.template", "ByteBufferAs", "B")
+
+ print("\nByteBufferAs-X-Buffer LittleEndian\n")
+
+ iterate_through_primitives(template_dir, output_dir, "ByteBufferAs-X-Buffer.java.template", "ByteBufferAs", "L")
+
+ print("\nDONE\n")
+
+
+main()
\ No newline at end of file
diff --git a/tools/expected_upstream/ojluni_upgrade_identicals.py b/tools/expected_upstream/ojluni_upgrade_identicals.py
index 083dee0..1e49bb9 100755
--- a/tools/expected_upstream/ojluni_upgrade_identicals.py
+++ b/tools/expected_upstream/ojluni_upgrade_identicals.py
@@ -49,13 +49,17 @@
description='Set an entry in EXCPETED_UPSTREAM to the given version if'
' the current and given version are identical.')
arg_parser.add_argument(
- 'tag_or_commit', nargs=1,
+ 'target_ref', nargs=1,
+ help='A git tag or commit in the upstream-openjdkXXX branch')
+ arg_parser.add_argument(
+ 'source_ref', nargs='?',
help='A git tag or commit in the upstream-openjdkXXX branch')
args = arg_parser.parse_args(argv)
- input_ref = args.tag_or_commit[0]
- commit = get_commit_or_exit(input_ref)
+ target_ref = args.target_ref[0]
+ source_ref = args.source_ref
+ commit = get_commit_or_exit(target_ref)
expected_upstream_file = ExpectedUpstreamFile()
expected_entries = expected_upstream_file.read_all_entries()
@@ -63,7 +67,11 @@
new_finder = OpenjdkFinder(commit)
for expected_entry in expected_entries:
- if expected_entry.git_ref == input_ref:
+ if expected_entry.git_ref == target_ref:
+ continue
+
+ # If the source_ref is specified, skip any existing different source refs.
+ if source_ref is not None and expected_entry.git_ref != source_ref:
continue
current_commit = LIBCORE_REPO.commit(expected_entry.git_ref)
@@ -88,7 +96,7 @@
new_blob = commit.tree[new_src_path]
if current_blob.data_stream.read() == new_blob.data_stream.read():
- expected_entry.git_ref = input_ref
+ expected_entry.git_ref = target_ref
expected_entry.src_path = new_src_path
expected_upstream_file.write_all_entries(expected_entries)