History log of /libcore/ojluni/src/main/java/java/util/List.java
Revision Date Author Comments
1d70b849467dfcfa30f495e6d03bcbdef47b2588 03-Mar-2017 Tobias Thierer <tobiast@google.com> Tweak java.util classes to minimize diffs vs. upstream

All of these changes are minor. They fix minor needless
differences vs. upstream code. Some tweaks to Android-changed
documentation were also made.

"upstream" means OpenJDK8u121-b13, except for AbstractQueue,
whose upstream is the same as in http://r.android.com/316686
(a commit between jdk-9+113 and jdk-9+114).

- AbstractMap:
- Minor whitespace changes.
- AbstractQueue:
- Minor whitespace changes.
- Tweaks to Android-changed docs.
- Arrays:
- tweak to rangeCheck() argument name and docs,
missed in the update to OpenJDK8u60
- Tweaks to Android-changed docs.
- Base64:
- avoid integer overflow, missed in the update
to OpenJDK8u121-b13.
- EnumMap:
- Fixed copyright year change, missed in the
update to OpenJDK8u60.
- Minor whitespace change.
- Hashtable:
- Tweaks to Android-changed docs.
- Minor whitespace changes.
- List:
- Removed empty documentation line.
- TreeMap:
- Dropped redundant "= null" initialization,
consistent with upstream OpenJDK8u60 (this line
still differs from upstream because of the rename
Entry -> TreeMapEntry).
- Tweaks to Android-changed docs.
- Vector:
- Minor whitespace change.

Bug: 35910877
Test: CtsLibcoreTestCases

Change-Id: Iaff5c5130e4ff32cbb28677d2fb8715d75d08a5e
ffbe99d6c5f0228e25d8821e7ff84e7c54ca38a4 03-Jan-2017 Tobias Thierer <tobiast@google.com> Compat behavior for Collections.sort()

AOSP libcore commit 5ae9d084f85cce06b02f7cee28db87ebe6be5056
changed Collections.sort() to call List.sort() rather than
vice versa. This causes infinite recursions in apps that call
Collections.sort() from List.sort(). (It can also lead to a
behavior difference with respect to modCount). Since popular
such apps exist, this CL guards the new behavior by a
targetSdkVersion check so that only apps targeting (and
running on) API versions > 25 observe the new behavior of
Collections.sort() calling List.sort().

The previous documentation for List.sort() was also
inappropriate since it recommended calling super.sort(),
which will only work on API level 24+ which introduced
that method.

Tests temporarily set appropriate targetSdkVersions.

Bug: 33482884
Bug: 34072201
Test: CtsLibcoreTestCases (includes CollectionsTest)

Change-Id: I57cf18895e1d03cb43ff1c8232a75744fe94b78f
5ae9d084f85cce06b02f7cee28db87ebe6be5056 27-Oct-2016 Tobias Thierer <tobiast@google.com> Implement Collections.sort() on top of List.sort(), not vice-versa

This is an app-observable behavior change relative to Android N.

This updates List.sort() and Collections.sort() to OpenJDK8u60.
Previously, Android had been using the logic from earlier version
of OpenJDK8 (present up to u19 or so). See:
https://bugs.openjdk.java.net/browse/JDK-8030848

The new behavior makes Collections.sort() more efficient for
List implementations that override List.sort() with a specialized,
efficient implementation. It also makes the modCount behavior of
Collections.sort() consistent with that of overridden List.sort()
implementations.

This behavior change carries a risk of app compat issues in future
versions of Android. Specifically:

- List.sort() implementations that delegate to Collections.sort()
will now infinitely recurse. Such implementations should be
fixed to call super.sort() instead.

- List implementations that override sort() with a version that
changes the value of modCount (this affects e.g. ArrayList but
not LinkedList), will now throw ConcurrentModificationException
if Collections.sort(list) is called in the middle of an iteration.

In such cases, the calling code should be fixed. E.g.,
- don't sort the list in the middle of iterating, or
- loop over list indices instead and use List.get(int), or
- convert the List to an array or a LinkedList first

Should serious app compat issues arise, possible ways to address
them in the platform include:

- revert this change, or
- make the change dependent on targetSdkVersion, or
- detect (indirect) recursive calls to Collections.sort()
and deal with them by logging, throwing a more informative
exception, or changing behavior.

Tests were updated to assert the new behavior.

The harmony CollectionsTest uses an ArrayList subclass that
throws UnsupportedOperationException from ArrayList.set()
without also overriding ArrayList.sort(). This makes the
subclass used in the test inconsistent with the List.sort()
documentation that claims that List.sort() will throw such
an exception if List.listIterator().set() does; this
inconsistency now also affects Collections.sort(). Therefore
the test was updated in this particular place to use a
different List implementation instead that, unlike ArrayList,
does not override List.sort().

Bug: 31902309
Bug: 29935305
Test: cts-tradefed run cts -m CtsLibcoreTestCases -a arm64-v8a

Change-Id: I6aad092f77ecee3eac3e633e1d59957e768fbf2b
dc1be9dbce3f33315883fe4fa8108c33af7cc119 19-Aug-2016 Tobias Thierer <tobiast@google.com> Update List to OpenJDK8u60.

Order of default methods was changed. It now matches upstream.

Android's sort() implementation was kept for consistency with
the current documentation in Android.
Upstream's documentation is not consistent with upstream's
implementation.

Test: Ran the following at a follow-up CL that used this CL
as a base.
1.) run cts -p android.core.tests.libcore.package.libcore
2.) guava-testlib tests for java.util List/Map/Set/Queue
implementations

Bug: 29935305

Change-Id: I1d2bfbb4bc7fd4d9c8cf8d7f75357915624a3d85
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>
309f9df28350e15445b9135e8b710fa2b34b5dc1 25-Apr-2016 Yi Kong <yikong@google.com> Update URLs to Java technotes and platform docs

Fix links to {@docRoot}/../{technotes,platform} pages.

This is done by batch editing using the following script:
grep @docRoot -rl | xargs sed -i 's/\/..\/technotes/r\/openjdk-redirect.html?v=8\&path=\/technotes/g;s/\/..\/platform/openjdk-redirect.html?v=8\&path=\/platform/g'

Bug: 27540501
Change-Id: Ib5634cd461fbba37dd94ddad9660910dc9397fe7
(cherry picked from commit d2449bb576ad1e3a3877364e5e1ae28625f69e35)
d2449bb576ad1e3a3877364e5e1ae28625f69e35 25-Apr-2016 Yi Kong <yikong@google.com> Update URLs to Java technotes and platform docs

Fix links to {@docRoot}/../{technotes,platform} pages.

This is done by batch editing using the following script:
grep @docRoot -rl | xargs sed -i 's/\/..\/technotes/r\/openjdk-redirect.html?v=8\&path=\/technotes/g;s/\/..\/platform/openjdk-redirect.html?v=8\&path=\/platform/g'

Bug: 27540501
Change-Id: Ib5634cd461fbba37dd94ddad9660910dc9397fe7
4f549c0a2df05bf19a068fcd8a917ba332cf809a 18-Mar-2016 Shubham Ajmera <shubhamajmera@google.com> Add OpenJDK 8 java.util.List Default Methods

and corresponding tests.

Added replaceAll and sort methods from the upstream except for the
CopyOnWriteArrayList.

Added forEach method along with the above two methods in
CopyOnWriteArrayList.

Bug: 27693350
Bug: 27540008

Change-Id: Id32df836e79bee614c0dce8c61dbc7b06731265d
ed47d30308588e419164d9311a41b04b8eefa04c 18-Mar-2016 Shubham Ajmera <shubhamajmera@google.com> Add OpenJDK 8 java.util.List Default Methods

and corresponding tests.

Added replaceAll and sort methods from the upstream except for the
CopyOnWriteArrayList.

Added forEach method along with the above two methods in
CopyOnWriteArrayList.

Bug: 27693350
Bug: 27540008
(cherry-picked from commit 67b8c3f1414bf04e53c094b951c8ea7903998d90)
Change-Id: Id32df836e79bee614c0dce8c61dbc7b06731265d
8b056f0b15bc1e45da8d4c504353b05e681ac013 04-Mar-2016 Narayan Kamath <narayan@google.com> Add java.lang.Iterable.spliterator() and supporting classes.

The only android specific changes here are to HashMap - their
spliterators add Spliterator.ORDERED if the HashMap is an instance
of a LinkedHashMap.

There's some degree of duplication between the test code used to
exercise primitive arrays (Arrays / Spliterators provide similar
APIs). These differences are quite hard to consolidate, since the
Arrays version declares that their Spliterators are ORDERED but
the Spliterator version doesn't. The latter also allows us to declare
additional Spliterator characteristics.

bug: 27426688
Change-Id: I191a9319d4af7e22834f2d91f73634a227b36bc2
4c89023ef86f29fa9add7db2574f2169fe842577 04-Mar-2016 Narayan Kamath <narayan@google.com> Add java.lang.Iterable.spliterator() and supporting classes.

The only android specific changes here are to HashMap - their
spliterators add Spliterator.ORDERED if the HashMap is an instance
of a LinkedHashMap.

There's some degree of duplication between the test code used to
exercise primitive arrays (Arrays / Spliterators provide similar
APIs). These differences are quite hard to consolidate, since the
Arrays version declares that their Spliterators are ORDERED but
the Spliterator version doesn't. The latter also allows us to declare
additional Spliterator characteristics.

(cherry-picked from commit ed21aa3a8dcd34eca6f0317eeb683e7afdc825b9)

bug: 27426688
Change-Id: I191a9319d4af7e22834f2d91f73634a227b36bc2
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