History log of /libcore/luni/src/main/java/java/util/Calendar.java
Revision Date Author Comments
e4f01dff49442840faa828dcff0d1583a2e68530 12-Aug-2014 Narayan Kamath <narayan@google.com> Allow Calendar.getInstance to be called with a null Locale.

LocaleData.get was changed to throw for null locales instead
of falling back to the default, so we need to adjust callers
accordingly.

Turns out all other callers would've thrown anyway (for different
reasons) so this change makes those exceptions explicit and
adds tests for them.

bug: 16938922

(cherry picked from commit 148de94b69ad9ed98ebb1adf0e8eb1b1e9e33e1f)

Change-Id: Id89961c9b9524776ef13f57d97b2bb73e19b4eb1
fda7c027e360292edfa4d32fadd2844efaa5f9d7 26-Jun-2014 Elliott Hughes <enh@google.com> Fix a faulty Julian day computation.

The use of Calendar.MILLISECONDS was wrong, as was the use of
ZONE_OFFSET without DST_OFFSET. The existing code pretty much
only works for the values tested in the unit test! This patch
adds new tests to make up for that.

I've also added calls to Calendar.clear to ensure we're not
leaking SECONDS and MILLISECONDS from the Calendar instances (which
get initialized to the current wall clock) into our test values.
This hasn't mattered in the past, but actually does matter here
because tests like isMidnight measure down to the millisecond.

Bug: https://code.google.com/p/android/issues/detail?id=72356
Signed-off-by: jasper tsai <jasper3_tsai@asus.com>
Signed-off-by: hellena shih <hellena_shih@asus.com>
Change-Id: I7d57590a95d3f026bdf1b991e0b1ddb47ba9af37
afc18db553293a12f7a04bd04c7d028dbb3de2f6 19-Mar-2013 Elliott Hughes <enh@google.com> Clarify Calendar.clear documentation.

Bug: https://code.google.com/p/android/issues/detail?id=45877
Change-Id: I49c82916a25388864f4acd12e09de984f72e8653
e040b50765cafb84783245ed959b1f5b6ded8de4 03-Jan-2013 Elliott Hughes <enh@google.com> Improve the Calendar documentation.

Bug: http://code.google.com/p/android/issues/detail?id=42059
Change-Id: I08112426fcd8a2389e4068d2c6f9c3a583ec95d5
d43b9ef11a1095967a3396b246639b563e1a4128 12-Sep-2012 Kenny Root <kroot@google.com> Add consistent reasons for NullPointerException

Semi-automated replacement of empty and non-conforming
NullPointerException reason messages.

(cherry-pick of 86acc043d3334651ee26c65467d78d6cefedd397.)

Change-Id: I6d893979f5c20a50e841e32af9fd7b2d8bc9d54d
86acc043d3334651ee26c65467d78d6cefedd397 12-Sep-2012 Kenny Root <kroot@google.com> Add consistent reasons for NullPointerException

Semi-automated replacement of empty and non-conforming
NullPointerException reason messages.

Change-Id: Iedeb4b21949e973c4042ce5982dda315f2e785e1
1baa4fcbfe3c22e5f06a4fee48f520162d23270f 22-Jun-2011 Jesse Wilson <jessewilson@google.com> Don't cache partial sets of date fields in Calendar.

This was only useful when modifying calendars within a single day.
Not worth the complexity, and possibly a source of bugs.

(cherry-pick of 0170a5c2cd87d90e11513a45f29ebafee6a1701c.)

Bug: 2435103
Change-Id: Ib6d68aed29f424ac464fc389e7ae26909667b9b9
32d2e33dabd6767913e275a62c456f8fe4e5131f 09-Feb-2011 Elliott Hughes <enh@google.com> Simplify Date.toGMTString.

There was a reason for the madness, but Android's SimpleDateFormat implements
'y' like the Unicode standard, not the RI, so we don't need the hack to get
standard behavior manually. Add explicit tests to guard against regression.

Change-Id: Iff3cf09004c76684ce7605ede888463a86d15d92
e26ba79900d471d02d656f686926918ef7dc751f 08-Feb-2011 Elliott Hughes <enh@google.com> Use int.class instead of Integer.TYPE (et cetera) for clarity.

I've also removed some small amount of duplication and a few unused imports.

Change-Id: Ie52477484bade74c80a348ad1261b596f9053cf6
28eb98ecd43c27702e85b0561e040e2da10320a6 05-Feb-2011 Elliott Hughes <enh@google.com> Fix serialization of DecimalFormatSymbols.

Missing 'final' on the serialPersistentFields declaration meant we were
falling back to reflection, and 'exponential' isn't actually a field.

I've checked all the other serialPersistentFields fields, and put them
in a canonical form. There were no other errors.

I'll do two other related changes: I'll replace confusing use of Character.TYPE
with char.class (and so forth), and I'll backport the active ingredient from
this change so it's fixed in honeycomb-mr1.

Bug: http://code.google.com/p/android/issues/detail?id=14495
Change-Id: I954da649ad597450bee54957dc0e3d3aa9d151dd
e4a533f2e6b22bd6183285c96d7907a97389240b 21-Jan-2011 Elliott Hughes <enh@google.com> Just give the time zone id in Calendar.toString.

Anyone who wants to know all about the TimeZone can get it and toString it
independently.

Bug: 3329355
Change-Id: Id5dfd5f6030437b8a2608e77798e2e6da2fd53f8
fb0ec0e650bf8be35acb0d47da0311a7c446aa33 14-Jan-2011 Elliott Hughes <enh@google.com> Remove useless android-changed comments.

I've changed useful ones to regular comments or TODOs, as appropriate.

I've left ones in code like java.util.concurrent where we really are
tracking an upstream source, making the change markers useful.

I've left a handful of others where I intend to actually investigate
the implied TODOs before deciding how to resolve them.

Change-Id: Iaf71059b818596351cf8ee5a3cf3c85586051fa6
1c4b8eb0aebfe7f99c10fb1d01716946e8e74ad7 07-Jan-2011 Elliott Hughes <enh@google.com> Remove @SuppressWarnings("nls") cruft.

Also rewrite a couple of toString methods for clarity.

Change-Id: Ic6e8c474ef87e0c0550eea2daed611ae41118229
b46dab348e2007bc08abaf7ecae34d89a2474e50 09-Dec-2010 Elliott Hughes <enh@google.com> Rewrite all backwards comparisons.

Strictly, all the ones I could find. This is everything with 0 or null on the
left-hand side.

Note that this touches several incorrect bounds checks, which I haven't fixed:
I'm going to come back and finish that independent cleanup separately.

Change-Id: Ibdb054b53df9aace47c7d2a00ff19122190053e8
d29fddcf333997fc2d7429d531e4d934dc705c88 27-Oct-2010 Jesse Wilson <jessewilson@google.com> Flip 'abstract public' to 'public abstract'.

Change-Id: Ice9b81c63cea4a3c08f697a28180c161a13e640e
162b0775772fa66b7eb634760a8159a60c1ddcea 02-Oct-2010 Elliott Hughes <enh@google.com> Move more stuff out of icu4jni; ICU and LocaleData.

Bug: 3045778
Change-Id: I59fd27920a2da9a42b29fd79b8d81bdaabdef8cd
d2d7abef3e9b73a57cdf1f2afd678d7f48945679 12-Sep-2010 Elliott Hughes <enh@google.com> Document Unicode versions and that we don't support the locale spi junk.

Bug: 2860486
Bug: 2938123
Change-Id: I3eb587300ea97340cdc23ba2d0136b8eeeb99b25
7365de1056414750d0a7d1fdd26025fd247f0d04 12-Aug-2010 Jesse Wilson <jessewilson@google.com> Sorting imports.

Change-Id: I8347bc625480a1c37a1ed9976193ddfedeb00bbc
162a12c1442641a95fe95859fa4e561b22db049f 25-May-2010 Elliott Hughes <enh@google.com> Remove @hide from Java 6 API.

I've left the two new spi packages @hidden, because I think we shouldn't
support them without convincing demand from developers (and I don't
believe there could be such a thing --- they just don't make sense, and
if we add anything, it should be the ability to provide extra ICU data).

Also fix a handful of javadoc syntax errors in Arrays.java and TreeMap.java.

Bug: 2497395
Change-Id: I4176b72daff0face4ed6c7ee1d1f4267d52006b4
f33eae7e84eb6d3b0f4e86b59605bb3de73009f3 13-May-2010 Elliott Hughes <enh@google.com> Remove all trailing whitespace from the dalvik team-maintained parts of libcore.

Gentlemen, you may now set your editors to "strip trailing whitespace"...

Change-Id: I85b2f6c80e5fbef1af6cab11789790b078c11b1b
fd6bb3510c2f94d636f3572dcf5f7f4dcd1a2726 13-May-2010 Elliott Hughes <enh@google.com> Remove //$NON-NLS-\d$ cruft.

Mostly done by perl(1), with manual cleanup of the few misspelled instances.
This makes our trailing whitespace slightly worse, but I'll fix all that with
a follow-on change.

Change-Id: I0b4ca98819be6f9519c4ba980d759bd1ee1a0303
757a7942eed2b0aa457f8517a0259d2ac82c5b18 16-Apr-2010 Elliott Hughes <enh@google.com> Merge LocaleData and Resources, rename Resources to ICU.

Also move our ICU tests into our little tree of tests.

Bug: 2596471
Change-Id: I73b53d74c26ef9bf670f12cac58b51ba61eefead
f9157eaea53923d3dbe6a521b29427819052f176 01-Apr-2010 Elliott Hughes <enh@google.com> Tidy up our getAvailableLocales methods to actually ask ICU4C.

These specialized methods are little used, and in several cases ICU itself
just returns the list of locales, but that's ICU's business, not ours. As
long as ICU is in charge of our locale-specific data, it should be responsible
for answering questions about what locale-specific data is available...

Change-Id: Idc8a66bbf7fcbc6b06e30929e6a7af3fe30ab7d1
2e43b95339579a2ea8b749d7598677bb44f2770f 31-Mar-2010 Elliott Hughes <enh@google.com> Add Java 6's Calendar API changes.

Also correct two javadoc mistakes I added, and bring back the latest harmony
java6 CalendarTest.

Bug: 2497395
Change-Id: If481390948ca93d5f709a8ed4585991889de9f8b
93f0d794f264baeb7a90d02e58cae60305b3912a 24-Mar-2010 Elliott Hughes <enh@google.com> Add Java 6's getAvailableLocales/getInstance to DateFormatSymbols and DecimalFormatSymbols.

This patch also improves the documentation of all getAvailableLocales methods
to clarify exactly what "available" means. Note that at the moment, many of
our implementations just return Locale.getAvailableLocales. It turns out that
ICU does the same in most cases, but I'll come back in a separate patch and
add code so we just pass these down to ICU, and wash our hands of the matter.

I've rewritten DateFormatSymbols.equals, which was very wrong. The time zone
names comparison had an invalid optimization, and its slow-path loop was wrong
too: it only ever tested values against themselves, which isn't likely to have
been the author's intention.

I've added toString overrides to DateFormatSymbols and DecimalFormatSymbols,
because I need them every time I work on these classes.

I've made the constants in DecimalFormatSymbols static final, and given them
idiomatic names. (I still think we might benefit from breaking these into
separate fields, as in the serialized form, but that's a separate issue.)

Finally, and unrelatedly, I've added a comment to BreakIteratorProvider that
I missed in my last change to that file.

Change-Id: I5d6cb30f9afdb502d38353d8a624dc2f0fef41ac
69bcb487b7317dde579a8ddc1a8094040ed7ae2b 04-Feb-2010 Elliott Hughes <enh@google.com> Minimal fix for Calendar.setTimeZone.

The interpretation of Calendar's competing member variables when the time,
time zone, and fields[] don't agree is confusing, and led to
Calendar.setTimeZone having no effect. I've improved the documentation
based on my reverse-engineering and fixed this bug. I noticed a lot of
other code that looks incorrect though, and I've raised http://b/2419810
suggesting that we switch to icu4j's calendars in the longer term.

Bug: http://code.google.com/p/android/issues/detail?id=6184
33aa6eb602478e7f51ac16f30c88db3566022886 23-Dec-2009 Elliott Hughes <enh@google.com> Stop using ResourceBundle for locale data.

This offers an additional speed increase and gets rid of a lot of native code.
2e3a41defb42a97b463194d859d2d4088a600fd8 21-Dec-2009 Elliott Hughes <enh@google.com> Speed up the way we access ICU's locale data.

This patch makes creating a new NumberFormat or new SimpleDateFormat 2x faster.

Basically, the ResourceBundle mechanism is really expensive in several ways:

1. The two-level caching is unnecessary for locale data, and expensive because
it burns through a lot of temporary objects.
2. The PrivilegedAction stuff is unnecessary and expensive because it too burns
quite a few temporary objects (including an ArrayList for each call; should
we consider removing support for SecurityManager so we can remove this cruft
from our code?).
3. The caching in most cases doesn't cache anything useful; the ResourceBundles
simply forward all questions straight to native code anyway, all we're
caching is an unnecessary forwarding object (in a cache where lookups cost
more than just creating a new unnecessary forwarding object would cost).

I've left CurrencyResourceBundle on the slow (ResourceBundle.getBundle) path
because I'm not yet sure how much of that path's semantics it relies on.

I still return LocaleResourceBundle instances (albeit via a much faster path)
but we should fix that. The native code returns an array which ResourceBundle
stuffs into a Hashtable and the calling code accesses via hash table lookups.
This despite the fact that the keys are a small fixed set known in advance.
We could make the native layer and the calling layer simpler and faster by
using a "struct", and doing so would make the middle layer go away completely.
4fefecee9d4a5d2a4510f516b4015607b19e8d09 13-Nov-2009 Jean-Baptiste Queru <jbq@google.com> eclair snapshot
1c422fc0ab0692e10a05af6f48c6276c4dad4bea 16-Oct-2009 Jesse Wilson <jessewilson@google.com> Respond to impossible CloneNotSupportedExceptions with AssertionErrors.

See bug 2183132.
a389b4a499f40379b0b204d7ba1c2057663d95c0 11-Aug-2009 Jesse Wilson <jessewilson@google.com> Update Luni to Harmony r802921.

Notable changes:
- replaced StringBuffer with StringBuilder in several places
- fixed a problem with BufferedInputStream's newline characters (EBCDIC)
- cleanup Timer's finalizer helper object
- new cache for the canonical path of a file
- fixed concurrency issue with ArrayList
- floating point parsing now trims length for very small numbers
- encoding specified "UTF-8" when converting some byte[]s to strings (JarURLConnection, Util, OSFileSystem)
- Harmony now implements floor and ceil in Java. We continue to use native code.
f5597e626ecf7949d249dea08c1a2964d890ec11 25-Jul-2009 Jesse Wilson <jessewilson@google.com> Integrate luni module (but not tests) to Harmony r772995.

Notable changes
- Stripped "@since Android 1.0" from many files. Most files
are now 100% the same in Dalvik and Harmony.
- AbstractStringBuilder.reverse() supports surrogates
- AbstractStringBuilder shares less to waste less memory
- Bitset optimized
- BufferedInputStream changed to support unsynchronized close()
- BufferedOutputStream does flushInternal
- BufferedReader supports EBCDIC NEL
- Collections.synchronizedList().indexOf() does a copy for more concurrency
- Classes in nio module changed: DatagramChannelImpl, SocketChannelImpl
and ServerSocketChannelImpl (these depend on internal APIs changed in
this update)
- DataInputStream/DataOutputStream now use a small buffer to limit the
number of times the underlying stream is accessed
- Date now has a minutes offset, more efficient toString()
- ExposedByteArrayInputStream: new internal class
- DeleteOnExit moved to top-level class
- FileDescriptor.isValid() now non-native
- Float, Double lessThan optimized (fix for compare(-0.0F, 0.0F) still pending)
- FileURLConnection now guesses content types from streams
- HashMap iterator changes
- Hashtable iterator changes
- INetworkSystem
- removes bind2(), createMulticastSocket, sendStream(),
- renames createSocket to createStreamSocket
- JarURLConnection rewritten
- LinkedHashMap: new iterator
- Locale, Currency, TimeZone: now use ICU in Harmony, plain Java in Dalvik
- ObjectInputStream: Accessor objects in Harmony, direct native in Dalvik
- ProxyClassFile - many changes
- String - optimized ascii for toLowerCase, toUpperCase, compare
- Timer - rewritten
- TreeMap - rewritten
- URLClassLoader - new
- URLConnection - new guessContentTypeFromStream(), uses org.apache.harmony.awt.www.content
to lookup content type handlers
adc854b798c1cfe3bfd4c27d68d5cee38ca617da 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
1c0fed63c71ddb230f3b304aac12caffbedf2f21 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
dd828f42a5c83b4270d4fbf6fce2da1878f1e84a 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
fdb2704414a9ed92394ada0d1395e4db86889465 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution