Merge changes from topic "icu60"
* changes:
Updated test expectations for ICU 60.
Replace clearCachedDefault with setICUDefault
diff --git a/ojluni/src/main/java/java/nio/Buffer.java b/ojluni/src/main/java/java/nio/Buffer.java
index 2e2e0d0..c912aaa 100644
--- a/ojluni/src/main/java/java/nio/Buffer.java
+++ b/ojluni/src/main/java/java/nio/Buffer.java
@@ -184,6 +184,7 @@
// Invariants: mark <= position <= limit <= capacity
private int mark = -1;
+ // Android-changed: position field non-private for use by Android's nio implementation classes.
int position = 0;
private int limit;
private int capacity;
@@ -192,6 +193,7 @@
// NOTE: hoisted here for speed in JNI GetDirectBufferAddress
long address;
+ // Android-added: _elementSizeShift field for NIOAccess class and framework native code.
/**
* The log base 2 of the element size of this buffer. Each typed subclass
* (ByteBuffer, CharBuffer, etc.) is responsible for initializing this
@@ -203,6 +205,7 @@
// Creates a new buffer with the given mark, position, limit, and capacity,
// after checking invariants.
//
+ // Android-added: _elementSizeShift field for NIOAccess class and framework native code.
Buffer(int mark, int pos, int lim, int cap, int elementSizeShift) { // package-private
if (cap < 0)
throw new IllegalArgumentException("Negative capacity: " + cap);
@@ -215,6 +218,7 @@
+ mark + " > " + pos + ")");
this.mark = mark;
}
+ // Android-added: _elementSizeShift field for NIOAccess class and framework native code.
_elementSizeShift = elementSizeShift;
}
diff --git a/ojluni/src/main/java/java/nio/MappedByteBuffer.java b/ojluni/src/main/java/java/nio/MappedByteBuffer.java
index e85f3a2..2ea6cbd 100644
--- a/ojluni/src/main/java/java/nio/MappedByteBuffer.java
+++ b/ojluni/src/main/java/java/nio/MappedByteBuffer.java
@@ -27,7 +27,6 @@
package java.nio;
import java.io.FileDescriptor;
-
import sun.misc.Unsafe;
@@ -59,13 +58,15 @@
* <p> Mapped byte buffers otherwise behave no differently than ordinary direct
* byte buffers. </p>
*
+ *
* @author Mark Reinhold
* @author JSR-51 Expert Group
* @since 1.4
*/
public abstract class MappedByteBuffer
- extends ByteBuffer {
+ extends ByteBuffer
+{
// This is a little bit backwards: By rights MappedByteBuffer should be a
// subclass of DirectByteBuffer, but to keep the spec clear and simple, and
@@ -79,11 +80,13 @@
// This should only be invoked by the DirectByteBuffer constructors
//
MappedByteBuffer(int mark, int pos, int lim, int cap, // package-private
- FileDescriptor fd) {
+ FileDescriptor fd)
+ {
super(mark, pos, lim, cap);
this.fd = fd;
}
+ // Android-added: Additional constructor for use by Android's DirectByteBuffer.
MappedByteBuffer(int mark, int pos, int lim, int cap, byte[] buf, int offset) {
super(mark, pos, lim, cap, buf, offset);
this.fd = null;
@@ -113,7 +116,7 @@
}
private long mappingLength(long mappingOffset) {
- return (long) capacity() + mappingOffset;
+ return (long)capacity() + mappingOffset;
}
/**
@@ -131,8 +134,8 @@
* underlying operating system may have paged out some of the buffer's data
* by the time that an invocation of this method returns. </p>
*
- * @return <tt>true</tt> if it is likely that this buffer's content
- * is resident in physical memory
+ * @return <tt>true</tt> if it is likely that this buffer's content
+ * is resident in physical memory
*/
public final boolean isLoaded() {
checkMapped();
@@ -154,7 +157,7 @@
* method may cause some number of page faults and I/O operations to
* occur. </p>
*
- * @return This buffer
+ * @return This buffer
*/
public final MappedByteBuffer load() {
checkMapped();
@@ -172,7 +175,7 @@
int count = Bits.pageCount(length);
long a = mappingAddress(offset);
byte x = 0;
- for (int i = 0; i < count; i++) {
+ for (int i=0; i<count; i++) {
x ^= unsafe.getByte(a);
a += ps;
}
@@ -198,7 +201,7 @@
* java.nio.channels.FileChannel.MapMode#READ_WRITE}) then invoking this
* method has no effect. </p>
*
- * @return This buffer
+ * @return This buffer
*/
public final MappedByteBuffer force() {
checkMapped();
@@ -210,8 +213,6 @@
}
private native boolean isLoaded0(long address, long length, int pageCount);
-
private native void load0(long address, long length);
-
private native void force0(FileDescriptor fd, long address, long length);
}
diff --git a/ojluni/src/main/java/java/nio/StringCharBuffer.java b/ojluni/src/main/java/java/nio/StringCharBuffer.java
index 6654c18..0c20fa6 100644
--- a/ojluni/src/main/java/java/nio/StringCharBuffer.java
+++ b/ojluni/src/main/java/java/nio/StringCharBuffer.java
@@ -29,7 +29,8 @@
// ## If the sequence is a string, use reflection to share its array
class StringCharBuffer // package-private
- extends CharBuffer {
+ extends CharBuffer
+{
CharSequence str;
StringCharBuffer(CharSequence s, int start, int end) { // package-private
@@ -42,11 +43,11 @@
public CharBuffer slice() {
return new StringCharBuffer(str,
- -1,
- 0,
- this.remaining(),
- this.remaining(),
- offset + this.position());
+ -1,
+ 0,
+ this.remaining(),
+ this.remaining(),
+ offset + this.position());
}
private StringCharBuffer(CharSequence s,
@@ -61,7 +62,7 @@
public CharBuffer duplicate() {
return new StringCharBuffer(str, markValue(),
- position(), limit(), capacity(), offset);
+ position(), limit(), capacity(), offset);
}
public CharBuffer asReadOnlyBuffer() {
@@ -106,11 +107,11 @@
try {
int pos = position();
return new StringCharBuffer(str,
- -1,
- pos + checkIndex(start, pos),
- pos + checkIndex(end, pos),
- capacity(),
- offset);
+ -1,
+ pos + checkIndex(start, pos),
+ pos + checkIndex(end, pos),
+ capacity(),
+ offset);
} catch (IllegalArgumentException x) {
throw new IndexOutOfBoundsException();
}
diff --git a/ojluni/src/main/java/java/nio/channels/ServerSocketChannel.java b/ojluni/src/main/java/java/nio/channels/ServerSocketChannel.java
index 7a5fd76..8d967b3 100644
--- a/ojluni/src/main/java/java/nio/channels/ServerSocketChannel.java
+++ b/ojluni/src/main/java/java/nio/channels/ServerSocketChannel.java
@@ -141,7 +141,7 @@
* @return This channel
*
* @throws AlreadyBoundException {@inheritDoc}
- * @throws UnresolvedAddressException
+ * @throws UnsupportedAddressTypeException {@inheritDoc}
* @throws ClosedChannelException {@inheritDoc}
* @throws IOException {@inheritDoc}
* @throws SecurityException
diff --git a/ojluni/src/main/java/java/nio/file/FileSystem.java b/ojluni/src/main/java/java/nio/file/FileSystem.java
index bb6f136..755d64f 100644
--- a/ojluni/src/main/java/java/nio/file/FileSystem.java
+++ b/ojluni/src/main/java/java/nio/file/FileSystem.java
@@ -294,6 +294,7 @@
*/
public abstract Path getPath(String first, String... more);
+ // Android-changed: Removed javadoc references to UNIX and Windows.
/**
* Returns a {@code PathMatcher} that performs match operations on the
* {@code String} representation of {@link Path} objects by interpreting a