History log of /libcore/ojluni/src/main/java/java/text/DecimalFormat.java
Revision Date Author Comments
f055b94e2bf6ea4696b6bac932f9ae4f542e91a8 14-Feb-2018 Anton Hansson <hansson@google.com> Remove cachedLocaleData from DecimalFormat.

This cache was removed upstream in
http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/1d7a6adf499f,
and doesn't appear to be making a meaningful difference to
performance.

Benchmark results (product: hikey):

Before:
Experiment {instrument=runtime, benchmarkMethod=time_instantiation, vm=default, parameters={}}
Results:
runtime(ns): min=198214.70, 1st qu.=198214.70, median=198214.70, mean=198214.70, 3rd qu.=198214.70, max=198214.70

After:
Experiment {instrument=runtime, benchmarkMethod=time_instantiation, vm=default, parameters={}}
Results:
runtime(ns): min=197940.89, 1st qu.=197940.89, median=197940.89, mean=197940.89, 3rd qu.=197940.89, max=197940.89

Bug: 31930415
Test: m -j droid & ran benchmark
Change-Id: I83deaead58b7f79d2016fc68add2ec8b861414c7
a5a851ef18cf45152fc0901a07e2f6aa303ef702 24-Oct-2017 Joachim Sauer <jsauer@google.com> Use DecimalFormat_ICU58_Android in DecimalFormat.

java.text.DecimalFormat delegates most behaviour to
android.icu.text.DecimalFormat.

ICU 59 introduced a variety of behaviour changes many of which are not
desireable to inherit for java.text.DecimalFormat.

This changes java.text.DecimalFormat to delegate to
android.icu.text.DecimalFormat_ICU58_Android instead. This class is the
ICU 58 implementation of DecimalFormat that ICU ships for testing
purposes only.

This is a stop-gap measure until we can get the new implementation
configured in a way to be close enough to the old behaviour to use in
java.text.DecimalFormat.

This commit also partially reverts the test that were changed to
accomodate the switch to ICU 59 in commit
51f8d749d3100694d695fa0cd32d2fb99c02ba74.

The reason the revert is only partial is that not all test changes were
caused by code changes. A significant portion was caused by CLDR changes
which still affect us, even if we use DecimalFormat_ICU58.

Bug: 68143370
Test: CtsLibcoreTestCases
Change-Id: If50d927265136e8de964b54ae879291c7be85cfc
9b60c4cd0121442b624ce8b83f9f31d867a17e3c 02-Oct-2017 Joachim Sauer <jsauer@google.com> Revert^2 "Add change comments in DecimalFormat/NumberFormat."

This reverts commit ed7add3467f160f9a07d9366b62e61a38748702a.

This was originally commited with the change id.
Ib0d7d8f857f88d4eee2cce4c159e4e28b4fdc2fe

This commit differs from the original by correctly calling initPattern()
instead of applyPattern() in readObject().

Bug: 65669355
Test: CtsLibcoreTestCases
Change-Id: I33f39e5c5902b2c86bb34d9494c4658e54f7fa1d
ed7add3467f160f9a07d9366b62e61a38748702a 29-Sep-2017 Andreas Gampe <agampe@google.com> Revert "Add change comments in DecimalFormat/NumberFormat."

This reverts commit f8dc36d04961d13ec0b0d2692fba6ca2dbd0a184.

Reason for revert: Breaks libcore tests:

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.icu.text.DecimalFormat.applyPattern(java.lang.String)' on a null object reference
at java.text.DecimalFormat.applyPattern(DecimalFormat.java:1289)
at java.text.DecimalFormat.readObject(DecimalFormat.java:1712)

Bug: 65669355
Change-Id: Ia3d82f4835fa7382533982e8edd73aa031a90860
Test: none
f8dc36d04961d13ec0b0d2692fba6ca2dbd0a184 21-Sep-2017 Joachim Sauer <jsauer@google.com> Add change comments in DecimalFormat/NumberFormat.

Add Android-changed/-added/-removed comments where approrpiate in
java.text.NumberFormat and java.text.DecimalFormat. This verifies that
this file is consistent with OpenJDK 8u121-b31.

Additionally this commit contains a number of small non-documentation
changes:

- renamed init to initPattern to indicate parallel to applyPattern
- Changed the order of isParseIntegerOnly/setParseIntegerOnly to be
consistent with other getters/setters and replace documentation with
{@inheritDoc} as no additional information was given.
- re-added "fastPathCheckNeeded = true" commented-out in many places to
make comparison with upstream easier.
- move currentSerialVersion = 4 to bottom of file to be consistent with
upstream.
- re-added explicit "symbols = null" initialization to align more
closely with upstream.

Bug: 65669355
Test: CtsLibcoreTestCases
Change-Id: Ib0d7d8f857f88d4eee2cce4c159e4e28b4fdc2fe
bdb158e71c53e691b5e204da1da893173fc9b83b 06-Jul-2017 Fredrik Roubert <roubert@google.com> Fix broken serialization of libcore's DecimalFormat with ICU 59.

Internally, libcore's DecimalFormat uses ICU4J's DecimalFormat but this
internal object is not part of the serialized form.

Therefore it's necessary for the deserialization code to call the right
setters in the right order on ICU4J's DecimalFormat object to make sure
that the resulting object ends up being equals() to the one that the
object that was serialized had as an internal member.

This has become more complex in ICU 59 because of the interaction of the
properties and exportedProperties attributes. Calling a setter will make
an object no longer equals(), even if the value set is the default
value. For more information about this, see:

http://bugs.icu-project.org/trac/ticket/13266

For the objects recreated during deserialization to be identical to the
corresponding objects that were serialized, libcore's DecimalFormat must
work around this.

This change updates the deserialization code so that it with both ICU 58
and ICU 59 will create objects that are equals() to the objects that
were serialized, for all cases covered by existing unit tests.

It does not change the behaviour of DecimalFormat in any other way.

(Further work would be needed to also handle objects on which some
property before serialization has been explicitly set to a value
identical to the default value. This is a use case not covered by
current tests.)

Test: CtsLibcoreTestCases
Change-Id: I025d0327f59c14d668f68a0be54cb1737c395dc5
49965c1dc9da104344f4893a05e45795a5740d20 30-Jun-2016 Ganesh Mahendran <opensource.ganesh@gmail.com> remove x attribute of java file

java file does not need x attribute. This patch removes it.

Change-Id: I2a7170d99f4bee7a7b819621c84dd197ded37fa2
Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
6e42190c7f7d7cf3d8b787c918de0d797c6ddbba 23-Jun-2016 Paul Duffin <paulduffin@google.com> Applies non-functional changes from 7u40 - 8u60

These changes cover:
* JavaDoc improvements.
* Internal use of generics.
* Improve diagnostics for some internal errors.
* Add annotations, e.g. @Override, @SuppressWarnings where
necessary.
* Formatting changes.
* Removing unnecessary modifiers, e.g. public on package private
classes, final on private methods, etc.
* Copyright updates.

Bug: 29352743
Test: flashed onto device and made sure that it comes up
properly, ran make docs and checked the output of a few
representative changes.
Change-Id: I731c556d7d4401e2d571ca9b2a69e63b29ef89e1
e8a4182a90c36516eb7f8be58802b7e9db3d3492 23-May-2016 Joachim Sauer <jsauer@google.com> Fix setCurrency resetting fraction digits.

ICU DecimalFormat and java.text.DecimalFormat differ in their
definition of setCurrency in that the former is documented to leave the
minimum and maximum fraction digits untouched and the later updates it
to the default of the currency.

Since we implement java.text.DecimalFormat using the ICU DecimalFormat
we have to work around that difference.

Bug: 28893763

(cherry picked from commit 13659d2d064672bb89cc41ccc75eeb89096166b4)

Change-Id: I30d855c89fcec6f732a1b44cb4d9ad77afd729fc
13659d2d064672bb89cc41ccc75eeb89096166b4 23-May-2016 Joachim Sauer <jsauer@google.com> Fix setCurrency resetting fraction digits.

ICU DecimalFormat and java.text.DecimalFormat differ in their
definition of setCurrency in that the former is documented to leave the
minimum and maximum fraction digits untouched and the later updates it
to the default of the currency.

Since we implement java.text.DecimalFormat using the ICU DecimalFormat
we have to work around that difference.

Bug: 28893763
Change-Id: I0e7e19fe95f352e75cc9f53ad8a7739436de37d1
85d15d8d455485b9a084594360ccf82c5e279325 07-Apr-2016 Joachim Sauer <jsauer@google.com> Up java.text.DecimalFormat max integer digits.

Android M and before used native ICU4C NumberFormat for
java.text.DecimalFormat and that had a max integer digits of 2000000000.
To maintain compatibility with earlier Android releases, use that value
for java.text.DecimalFormat.

The underlying android.icu.DecimalFormat is modified to allow maximum
integer digits bigger than 309 (but keeping the default values
unchanged).

Also add test for DecimalFormat with pattern "00" (fixed by related
revert in external/icu)

Bug: 27855939

(cherry picked from commit 43379e19f9b8cb88936d0c1be69070c7c8fbd083)

Change-Id: I873147c044b1a27d992fb2f881bd5ec074559f4d
43379e19f9b8cb88936d0c1be69070c7c8fbd083 07-Apr-2016 Joachim Sauer <jsauer@google.com> Up java.text.DecimalFormat max integer digits.

Android M and before used native ICU4C NumberFormat for
java.text.DecimalFormat and that had a max integer digits of 2000000000.
To maintain compatibility with earlier Android releases, use that value
for java.text.DecimalFormat.

The underlying android.icu.DecimalFormat is modified to allow maximum
integer digits bigger than 309 (but keeping the default values
unchanged).

Also add test for DecimalFormat with pattern "00" (fixed by related
revert in external/icu)

Bug: 27855939
Change-Id: I8d83e3392d7f87cdfbda8c6fbc40a775809ab4c1
4dcb96a32e1d4ce3c0d36d6f0ad47390ab679f31 13-Jan-2016 Shubham Ajmera <shubhamajmera@google.com> Fix serialization in DecimalFormat / DecimalFormatSymbols.

Adapted from changes f2d5062,bdc285fc5 and 3b128c4585.

Also fix OldDecimalFormatSymbolsTest.

Bug: 26104359
Change-Id: Iae234c1403f67e988a533c7e0406dbc24ed3fcdf
bcdd53724f6d55a3677c06289d1a31a764218822 24-Dec-2015 Yi Kong <yikong@google.com> Fix NumberFormatTest#test_customCurrencySymbol

Setting currency again should reset the custom currency symbol to
default, so we should also check for the symbol when deciding whether
we need call setCurrency().

Bug: 26024260
Change-Id: Id2fb28883abbedabee069028ef9a2168639f311b
2c87ad3a45cecf9e344487cad1abfdebe79f2c7c 21-Dec-2015 Narayan Kamath <narayan@google.com> Update file headers.

Change-Id: I8149f41585768a1a4b72ab7bb4a1452376c05cc2
c976de8fbfb0235d9d678e10a55e123131f9f03c 17-Dec-2015 Narayan Kamath <narayan@google.com> Bail early for bogus ParsePositions.

Some of our tests were expecting a null return value for
ParsePosition.index == -1.

bug: 26207177
Change-Id: I013f5a2b4f8cccd7814a0c001857a99cbfbb4925
4e03bfe307749b9c293ad0cb6e1157b762117fd6 01-Dec-2015 Shubham Ajmera <shubhamajmera@google.com> implemented DecimalFormat using icu4j

The change fixes test_formatDouble_scientificNotation,
test_formatDouble_scientificNotationMinusZero,
test_formatDouble_withFieldPosition, test_formatLong_scientificNotation,
test_parse_withMultiplier.

Tests - testSerializationHarmonyRICompatible,
test_formatDouble_withFieldPosition,
test_formatToCharacterIterator_original are to be fixed.

Also, unused variables and methods has been removed.

Bug: 26022696
Bug: 26024115
Bug: 25993727
Bug: 25860873

Change-Id: I867d1366bfac0f3f94c0184275868f78609d2303
2939a92f599d22a801a545ba5bf31599f60b2605 28-Sep-2015 Przemyslaw Szczepaniak <pszczepaniak@google.com> Rewrite an expression to work around a compiler bug.

Change-Id: I6d77c7b801998f1c439337a9f1c2799889f9291a
9c853c5b9ebbb0ef60a013ae10ee411d70dfa832 18-Feb-2015 Piotr Jastrzebski <haaawk@google.com> Use OpenJdk implementations of java.text.*

- LocaleInternalsTest has been disabled since it depends on
internal implementation details.
- Collator: Use libcore's RuleBasedCollatorICU to fetch collator
rules instead of sun.misc.resources.LocaleData & friends.
- DateFormat: Add support for set24HourTimePref (not wired up
yet).
- DateFormatSymbols : Use libcore's LocaleData & TimeZoneNames
classes internally.
- NumberFormat: Use libcore's LocaleData.
- Drop support for SCIENTIFICSTYLE (we should re-enable this at
some point ?).
- SimpleDateFormat : Don't reject the format specifiers for
standalone weekday and friends. We'll need to switch over to
using ICU4J formatters at some point.
- Calendar : Use GregorianCalendar only.
- TimeZone : Use TimeZoneNames to access time zone names.

Change-Id: I4a2866904d4f2f39f0793154d9aad7f109da3b5a
51b1b6997fd3f980076b8081f7f1165ccc2a4008 16-Feb-2015 Piotr Jastrzebski <haaawk@google.com> Initial import of OpenJdk files.

Create new libcore/ojluni directory with src/main/java and
src/main/native subdirectiories.

Build ojluni into core-oj jar.

Use openjdk classes from java.awt.font package.

Copy all files from jdk/src/share/classes and jdk/src/solaris/classes
directories in openjdk into libcore/ojluni/src/main/java.

Copy following native files from openjdk to
libcore/ojluni/src/main/native:
jdk/src/solaris/native/java/io/canonicalize_md.c
build/linux-amd64/include/classfile_constants.h
jdk/src/share/native/java/net/DatagramPacket.c
jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c
jdk/src/share/native/java/lang/Double.c
jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h
jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c
jdk/src/solaris/native/java/io/FileDescriptor_md.c
jdk/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c
jdk/src/share/native/java/io/FileInputStream.c
jdk/src/solaris/native/sun/nio/ch/FileKey.c
jdk/src/solaris/native/java/io/FileOutputStream_md.c
jdk/src/solaris/native/java/io/FileSystem_md.c
jdk/src/share/native/java/lang/Float.c
jdk/src/share/native/java/net/Inet4Address.c
jdk/src/solaris/native/java/net/Inet4AddressImpl.c
jdk/src/share/native/java/net/Inet6Address.c
jdk/src/solaris/native/java/net/Inet6AddressImpl.c
jdk/src/share/native/java/net/InetAddress.c
jdk/src/solaris/native/java/net/InetAddressImplFactory.c
jdk/src/share/native/java/io/io_util.c
jdk/src/solaris/native/sun/nio/ch/IOUtil.c
jdk/src/share/native/java/io/io_util.h
jdk/src/solaris/native/java/io/io_util_md.c
jdk/src/solaris/native/java/io/io_util_md.h
build/linux-amd64/tmp/java/java.nio/nio/CClassHeaders/java_io_FileDescriptor.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_io_FileInputStream.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_io_FileOutputStream.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_io_FileSystem.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_io_ObjectStreamClass.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_io_UnixFileSystem.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Double.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Float.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Integer.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Long.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Runtime.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Shutdown.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_StrictMath.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_String.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_System.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Thread.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Throwable.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_DatagramPacket.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_Inet4Address.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_Inet4AddressImpl.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_Inet6Address.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_Inet6AddressImpl.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_InetAddress.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_InetAddressImplFactory.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_NetworkInterface.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_PlainDatagramSocketImpl.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_PlainSocketImpl.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_SocketInputStream.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_SocketOptions.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_SocketOutputStream.h
jdk/src/share/native/java/lang/java_props.h
jdk/src/solaris/native/java/lang/java_props_md.c
jdk/src/share/native/java/util/zip/Adler32.c as java_util_zip_Adler32.c
jdk/src/share/native/java/util/zip/CRC32.c as java_util_zip_CRC32.c
build/linux-amd64/tmp/sun/java.util.zip/zip/CClassHeaders/java_util_zip_CRC32.h
jdk/src/share/native/java/util/zip/Deflater.c as java_util_zip_Deflater.c
build/linux-amd64/tmp/sun/java.util.zip/zip/CClassHeaders/java_util_zip_Deflater.h
jdk/src/share/native/java/util/zip/Inflater.c as java_util_zip_Inflater.c
build/linux-amd64/tmp/sun/java.util.zip/zip/CClassHeaders/java_util_zip_Inflater.h
jdk/src/share/native/java/util/zip/ZipFile.c as java_util_zip_ZipFile.c
build/linux-amd64/tmp/sun/java.util.zip/zip/CClassHeaders/java_util_zip_ZipFile.h
jdk/src/share/native/java/lang/fdlibm/include/jfdlibm.h
jdk/src/share/native/common/jlong.h
jdk/src/solaris/native/common/jlong_md.h
jdk/src/share/native/common/jni_util.c
jdk/src/share/native/common/jni_util.h
jdk/src/solaris/native/common/jni_util_md.c
jdk/src/share/javavm/export/jvm.h
jdk/src/solaris/javavm/export/jvm_md.h
jdk/src/solaris/native/java/net/linux_close.c
jdk/src/share/native/sun/misc/NativeSignalHandler.c
jdk/src/solaris/native/sun/nio/ch/NativeThread.c
jdk/src/share/native/java/net/net_util.c
jdk/src/share/native/java/net/net_util.h
jdk/src/solaris/native/java/net/net_util_md.c
jdk/src/solaris/native/java/net/net_util_md.h
jdk/src/solaris/native/java/net/NetworkInterface.c
jdk/src/share/native/sun/nio/ch/nio.h
jdk/src/solaris/native/sun/nio/ch/nio_util.h
jdk/src/share/native/java/io/ObjectStreamClass.c
jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
jdk/src/solaris/native/java/net/PlainSocketImpl.c
jdk/src/solaris/native/java/lang/ProcessEnvironment_md.c
jdk/src/share/native/java/lang/Runtime.c
jdk/src/share/native/java/lang/Shutdown.c
jdk/src/share/native/sun/misc/Signal.c
jdk/src/solaris/native/java/net/SocketInputStream.c
jdk/src/solaris/native/java/net/SocketOutputStream.c
jdk/src/share/native/java/lang/StrictMath.c
jdk/src/share/native/java/lang/String.c
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/sun_misc_NativeSignalHandler.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/sun_misc_Signal.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/sun_net_spi_DefaultProxySelector.h
build/linux-amd64/tmp/java/java.nio/nio/CClassHeaders/sun_nio_ch_FileChannelImpl.h
build/linux-amd64/tmp/java/java.nio/nio/CClassHeaders/sun_nio_ch_FileDispatcherImpl.h
build/linux-amd64/tmp/java/java.nio/nio/CClassHeaders/sun_nio_ch_FileKey.h
build/linux-amd64/tmp/java/java.nio/nio/CClassHeaders/sun_nio_ch_IOStatus.h
build/linux-amd64/tmp/java/java.nio/nio/CClassHeaders/sun_nio_ch_IOUtil.h
build/linux-amd64/tmp/java/java.nio/nio/CClassHeaders/sun_nio_ch_NativeThread.h
jdk/src/share/native/java/lang/System.c
jdk/src/share/native/java/lang/Thread.c
jdk/src/share/native/java/lang/Throwable.c
jdk/src/solaris/native/java/io/UnixFileSystem_md.c
jdk/src/solaris/native/java/lang/UNIXProcess_md.c
jdk/src/share/native/java/util/zip/zip_util.c
jdk/src/share/native/java/util/zip/zip_util.h

Change-Id: Ib237df4e1b7b5b4d9f12e74d189e6ec9eed3c31d