SHA256
1
0
forked from pool/guava
Fridrich Strba 2019-10-10 21:03:59 +00:00 committed by Git OBS Bridge
parent 4e33d0a0ea
commit 0d4040cc68
3 changed files with 671 additions and 1 deletions

View File

@ -0,0 +1,656 @@
--- guava-25.0/android/guava/src/com/google/common/hash/AbstractByteHasher.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/android/guava/src/com/google/common/hash/AbstractByteHasher.java 2019-10-10 22:06:40.125798409 +0200
@@ -22,6 +22,7 @@
import com.google.common.primitives.Longs;
import com.google.common.primitives.Shorts;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -54,7 +55,7 @@
protected void update(ByteBuffer b) {
if (b.hasArray()) {
update(b.array(), b.arrayOffset() + b.position(), b.remaining());
- b.position(b.limit());
+ ((Buffer)b).position(b.limit());
} else {
for (int remaining = b.remaining(); remaining > 0; remaining--) {
update(b.get());
@@ -67,7 +68,7 @@
try {
update(scratch.array(), 0, bytes);
} finally {
- scratch.clear();
+ ((Buffer)scratch).clear();
}
return this;
}
--- guava-25.0/android/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/android/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java 2019-10-10 22:08:03.862309584 +0200
@@ -18,6 +18,7 @@
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.errorprone.annotations.Immutable;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
@@ -98,7 +99,7 @@
public Hasher putBytes(ByteBuffer bytes) {
int pos = bytes.position();
for (Hasher hasher : hashers) {
- bytes.position(pos);
+ ((Buffer)bytes).position(pos);
hasher.putBytes(bytes);
}
return this;
--- guava-25.0/android/guava/src/com/google/common/hash/AbstractHasher.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/android/guava/src/com/google/common/hash/AbstractHasher.java 2019-10-10 22:02:00.936093927 +0200
@@ -16,6 +16,7 @@
import com.google.common.base.Preconditions;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
@@ -73,7 +74,7 @@
public Hasher putBytes(ByteBuffer b) {
if (b.hasArray()) {
putBytes(b.array(), b.arrayOffset() + b.position(), b.remaining());
- b.position(b.limit());
+ ((Buffer)b).position(b.limit());
} else {
for (int remaining = b.remaining(); remaining > 0; remaining--) {
putByte(b.get());
--- guava-25.0/android/guava/src/com/google/common/hash/AbstractStreamingHasher.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/android/guava/src/com/google/common/hash/AbstractStreamingHasher.java 2019-10-10 22:04:31.181011211 +0200
@@ -17,6 +17,7 @@
import static com.google.common.base.Preconditions.checkArgument;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -179,10 +180,10 @@
@Override
public final HashCode hash() {
munch();
- buffer.flip();
+ ((Buffer)buffer).flip();
if (buffer.remaining() > 0) {
processRemaining(buffer);
- buffer.position(buffer.limit());
+ ((Buffer)buffer).position(buffer.limit());
}
return makeHash();
}
@@ -203,7 +204,7 @@
}
private void munch() {
- buffer.flip();
+ ((Buffer)buffer).flip();
while (buffer.remaining() >= chunkSize) {
// we could limit the buffer to ensure process() does not read more than
// chunkSize number of bytes, but we trust the implementations
--- guava-25.0/android/guava/src/com/google/common/io/ByteStreams.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/android/guava/src/com/google/common/io/ByteStreams.java 2019-10-10 21:58:55.242959068 +0200
@@ -33,6 +33,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel;
@@ -145,11 +146,11 @@
ByteBuffer buf = ByteBuffer.wrap(createBuffer());
long total = 0;
while (from.read(buf) != -1) {
- buf.flip();
+ ((Buffer)buf).flip();
while (buf.hasRemaining()) {
total += to.write(buf);
}
- buf.clear();
+ ((Buffer)buf).clear();
}
return total;
}
--- guava-25.0/android/guava/src/com/google/common/io/CharStreams.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/android/guava/src/com/google/common/io/CharStreams.java 2019-10-10 22:51:07.748443767 +0200
@@ -25,6 +25,7 @@
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
+import java.nio.Buffer;
import java.nio.CharBuffer;
import java.util.ArrayList;
import java.util.List;
@@ -83,10 +84,10 @@
long total = 0;
CharBuffer buf = createBuffer();
while (from.read(buf) != -1) {
- buf.flip();
+ ((Buffer)buf).flip();
to.append(buf);
total += buf.remaining();
- buf.clear();
+ ((Buffer)buf).clear();
}
return total;
}
@@ -240,7 +241,7 @@
CharBuffer buf = createBuffer();
while ((read = readable.read(buf)) != -1) {
total += read;
- buf.clear();
+ ((Buffer)buf).clear();
}
return total;
}
--- guava-25.0/android/guava/src/com/google/common/io/LineReader.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/android/guava/src/com/google/common/io/LineReader.java 2019-10-10 22:51:07.748443767 +0200
@@ -22,6 +22,7 @@
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.IOException;
import java.io.Reader;
+import java.nio.Buffer;
import java.nio.CharBuffer;
import java.util.LinkedList;
import java.util.Queue;
@@ -70,7 +71,7 @@
@CanIgnoreReturnValue // to skip a line
public String readLine() throws IOException {
while (lines.peek() == null) {
- cbuf.clear();
+ ((Buffer)cbuf).clear();
// The default implementation of Reader#read(CharBuffer) allocates a
// temporary char[], so we call Reader#read(char[], int, int) instead.
int read = (reader != null) ? reader.read(buf, 0, buf.length) : readable.read(cbuf);
--- guava-25.0/android/guava/src/com/google/common/io/ReaderInputStream.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/android/guava/src/com/google/common/io/ReaderInputStream.java 2019-10-10 22:51:07.748443767 +0200
@@ -104,7 +104,7 @@
encoder.reset();
charBuffer = CharBuffer.allocate(bufferSize);
- charBuffer.flip();
+ ((Buffer)charBuffer).flip();
byteBuffer = ByteBuffer.allocate(bufferSize);
}
@@ -143,7 +143,7 @@
return (totalBytesRead > 0) ? totalBytesRead : -1;
}
draining = false;
- byteBuffer.clear();
+ ((Buffer)byteBuffer).clear();
}
while (true) {
@@ -189,8 +189,8 @@
private static CharBuffer grow(CharBuffer buf) {
char[] copy = Arrays.copyOf(buf.array(), buf.capacity() * 2);
CharBuffer bigger = CharBuffer.wrap(copy);
- bigger.position(buf.position());
- bigger.limit(buf.limit());
+ ((Buffer)bigger).position(buf.position());
+ ((Buffer)bigger).limit(buf.limit());
return bigger;
}
@@ -207,7 +207,7 @@
if (availableCapacity(charBuffer) == 0) {
if (charBuffer.position() > 0) {
// (2) There is room in the buffer. Move existing bytes to the beginning.
- charBuffer.compact().flip();
+ ((Buffer)(charBuffer.compact())).flip();
} else {
// (3) Entire buffer is full, need bigger buffer.
charBuffer = grow(charBuffer);
@@ -220,7 +220,7 @@
if (numChars == -1) {
endOfInput = true;
} else {
- charBuffer.limit(limit + numChars);
+ ((Buffer)charBuffer).limit(limit + numChars);
}
}
@@ -235,7 +235,7 @@
* overflow must be due to a small output buffer.
*/
private void startDraining(boolean overflow) {
- byteBuffer.flip();
+ ((Buffer)byteBuffer).flip();
if (overflow && byteBuffer.remaining() == 0) {
byteBuffer = ByteBuffer.allocate(byteBuffer.capacity() * 2);
} else {
--- guava-25.0/android/guava-tests/benchmark/com/google/common/io/CharStreamsCopyBenchmark.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/android/guava-tests/benchmark/com/google/common/io/CharStreamsCopyBenchmark.java 2019-10-10 22:51:07.748443767 +0200
@@ -21,6 +21,7 @@
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
+import java.nio.Buffer;
import java.nio.CharBuffer;
import java.util.Random;
@@ -40,10 +41,10 @@
CharBuffer buf = CharStreams.createBuffer();
long total = 0;
while (from.read(buf) != -1) {
- buf.flip();
+ ((Buffer)buf).flip();
to.append(buf);
total += buf.remaining();
- buf.clear();
+ ((Buffer)buf).clear();
}
return total;
}
--- guava-25.0/android/guava-tests/test/com/google/common/hash/HashTestUtils.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/android/guava-tests/test/com/google/common/hash/HashTestUtils.java 2019-10-10 21:55:54.929856118 +0200
@@ -24,6 +24,7 @@
import com.google.common.collect.Sets;
import com.google.common.primitives.Ints;
import com.google.common.testing.EqualsTester;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.Charset;
@@ -195,8 +196,8 @@
int limit = pos + random.nextInt(value.length - pos + 1);
for (PrimitiveSink sink : sinks) {
ByteBuffer buffer = ByteBuffer.wrap(value);
- buffer.position(pos);
- buffer.limit(limit);
+ ((Buffer)buffer).position(pos);
+ ((Buffer)buffer).limit(limit);
sink.putBytes(buffer);
assertEquals(limit, buffer.limit());
assertEquals(limit, buffer.position());
--- guava-25.0/android/guava-tests/test/com/google/common/io/CharSequenceReaderTest.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/android/guava-tests/test/com/google/common/io/CharSequenceReaderTest.java 2019-10-10 22:51:07.748443767 +0200
@@ -17,6 +17,7 @@
package com.google.common.io;
import java.io.IOException;
+import java.nio.Buffer;
import java.nio.CharBuffer;
import junit.framework.TestCase;
@@ -211,7 +212,7 @@
reader = new CharSequenceReader(charSequence);
CharBuffer buf2 = CharBuffer.allocate(expected.length());
assertEquals(expected.length() == 0 ? -1 : expected.length(), reader.read(buf2));
- buf2.flip();
+ ((Buffer)buf2).flip();
assertEquals(expected, buf2.toString());
assertFullyRead(reader);
@@ -220,9 +221,9 @@
buf2 = CharBuffer.allocate(5);
builder = new StringBuilder();
while (reader.read(buf2) != -1) {
- buf2.flip();
+ ((Buffer)buf2).flip();
builder.append(buf2);
- buf2.clear();
+ ((Buffer)buf2).clear();
}
assertEquals(expected, builder.toString());
assertFullyRead(reader);
--- guava-25.0/android/guava-tests/test/com/google/common/io/SourceSinkFactories.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/android/guava-tests/test/com/google/common/io/SourceSinkFactories.java 2019-10-10 22:51:07.752443789 +0200
@@ -34,6 +34,7 @@
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
+import java.nio.Buffer;
import java.nio.CharBuffer;
import java.util.Arrays;
import java.util.logging.Logger;
@@ -407,9 +408,9 @@
StringBuilder builder = new StringBuilder();
CharBuffer buffer = CharBuffer.allocate(100);
while (reader.read(buffer) != -1) {
- buffer.flip();
+ ((Buffer)buffer).flip();
builder.append(buffer);
- buffer.clear();
+ ((Buffer)buffer).clear();
}
return builder.toString();
}
--- guava-25.0/guava/src/com/google/common/hash/AbstractByteHasher.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/guava/src/com/google/common/hash/AbstractByteHasher.java 2019-10-10 22:25:49.468199825 +0200
@@ -22,6 +22,7 @@
import com.google.common.primitives.Longs;
import com.google.common.primitives.Shorts;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -54,7 +55,7 @@
protected void update(ByteBuffer b) {
if (b.hasArray()) {
update(b.array(), b.arrayOffset() + b.position(), b.remaining());
- b.position(b.limit());
+ ((Buffer)b).position(b.limit());
} else {
for (int remaining = b.remaining(); remaining > 0; remaining--) {
update(b.get());
@@ -67,7 +68,7 @@
try {
update(scratch.array(), 0, bytes);
} finally {
- scratch.clear();
+ ((Buffer)scratch).clear();
}
return this;
}
--- guava-25.0/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java 2019-10-10 22:27:25.852699317 +0200
@@ -18,6 +18,7 @@
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.errorprone.annotations.Immutable;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
@@ -98,7 +99,7 @@
public Hasher putBytes(ByteBuffer bytes) {
int pos = bytes.position();
for (Hasher hasher : hashers) {
- bytes.position(pos);
+ ((Buffer)bytes).position(pos);
hasher.putBytes(bytes);
}
return this;
--- guava-25.0/guava/src/com/google/common/hash/AbstractHasher.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/guava/src/com/google/common/hash/AbstractHasher.java 2019-10-10 22:21:28.222754715 +0200
@@ -16,6 +16,7 @@
import com.google.common.base.Preconditions;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
@@ -73,7 +74,7 @@
public Hasher putBytes(ByteBuffer b) {
if (b.hasArray()) {
putBytes(b.array(), b.arrayOffset() + b.position(), b.remaining());
- b.position(b.limit());
+ ((Buffer)b).position(b.limit());
} else {
for (int remaining = b.remaining(); remaining > 0; remaining--) {
putByte(b.get());
--- guava-25.0/guava/src/com/google/common/hash/AbstractStreamingHasher.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/guava/src/com/google/common/hash/AbstractStreamingHasher.java 2019-10-10 22:24:01.043564217 +0200
@@ -17,6 +17,7 @@
import static com.google.common.base.Preconditions.checkArgument;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -179,10 +180,10 @@
@Override
public final HashCode hash() {
munch();
- buffer.flip();
+ ((Buffer)buffer).flip();
if (buffer.remaining() > 0) {
processRemaining(buffer);
- buffer.position(buffer.limit());
+ ((Buffer)buffer).position(buffer.limit());
}
return makeHash();
}
@@ -203,7 +204,7 @@
}
private void munch() {
- buffer.flip();
+ ((Buffer)buffer).flip();
while (buffer.remaining() >= chunkSize) {
// we could limit the buffer to ensure process() does not read more than
// chunkSize number of bytes, but we trust the implementations
--- guava-25.0/guava/src/com/google/common/io/ByteStreams.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/guava/src/com/google/common/io/ByteStreams.java 2019-10-10 22:14:55.056830174 +0200
@@ -33,6 +33,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel;
@@ -145,11 +146,11 @@
ByteBuffer buf = ByteBuffer.wrap(createBuffer());
long total = 0;
while (from.read(buf) != -1) {
- buf.flip();
+ ((Buffer)buf).flip();
while (buf.hasRemaining()) {
total += to.write(buf);
}
- buf.clear();
+ ((Buffer)buf).clear();
}
return total;
}
--- guava-25.0/guava/src/com/google/common/io/CharStreams.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/guava/src/com/google/common/io/CharStreams.java 2019-10-10 22:51:07.752443789 +0200
@@ -25,6 +25,7 @@
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
+import java.nio.Buffer;
import java.nio.CharBuffer;
import java.util.ArrayList;
import java.util.List;
@@ -83,10 +84,10 @@
long total = 0;
CharBuffer buf = createBuffer();
while (from.read(buf) != -1) {
- buf.flip();
+ ((Buffer)buf).flip();
to.append(buf);
total += buf.remaining();
- buf.clear();
+ ((Buffer)buf).clear();
}
return total;
}
@@ -240,7 +241,7 @@
CharBuffer buf = createBuffer();
while ((read = readable.read(buf)) != -1) {
total += read;
- buf.clear();
+ ((Buffer)buf).clear();
}
return total;
}
--- guava-25.0/guava/src/com/google/common/io/LineReader.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/guava/src/com/google/common/io/LineReader.java 2019-10-10 22:51:07.752443789 +0200
@@ -22,6 +22,7 @@
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.IOException;
import java.io.Reader;
+import java.nio.Buffer;
import java.nio.CharBuffer;
import java.util.LinkedList;
import java.util.Queue;
@@ -70,7 +71,7 @@
@CanIgnoreReturnValue // to skip a line
public String readLine() throws IOException {
while (lines.peek() == null) {
- cbuf.clear();
+ ((Buffer)cbuf).clear();
// The default implementation of Reader#read(CharBuffer) allocates a
// temporary char[], so we call Reader#read(char[], int, int) instead.
int read = (reader != null) ? reader.read(buf, 0, buf.length) : readable.read(cbuf);
--- guava-25.0/guava/src/com/google/common/io/ReaderInputStream.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/guava/src/com/google/common/io/ReaderInputStream.java 2019-10-10 22:19:43.042350389 +0200
@@ -104,7 +104,7 @@
encoder.reset();
charBuffer = CharBuffer.allocate(bufferSize);
- charBuffer.flip();
+ ((Buffer)charBuffer).flip();
byteBuffer = ByteBuffer.allocate(bufferSize);
}
@@ -143,7 +143,7 @@
return (totalBytesRead > 0) ? totalBytesRead : -1;
}
draining = false;
- byteBuffer.clear();
+ ((Buffer)byteBuffer).clear();
}
while (true) {
@@ -189,8 +189,8 @@
private static CharBuffer grow(CharBuffer buf) {
char[] copy = Arrays.copyOf(buf.array(), buf.capacity() * 2);
CharBuffer bigger = CharBuffer.wrap(copy);
- bigger.position(buf.position());
- bigger.limit(buf.limit());
+ ((Buffer)bigger).position(buf.position());
+ ((Buffer)bigger).limit(buf.limit());
return bigger;
}
@@ -207,7 +207,7 @@
if (availableCapacity(charBuffer) == 0) {
if (charBuffer.position() > 0) {
// (2) There is room in the buffer. Move existing bytes to the beginning.
- charBuffer.compact().flip();
+ ((Buffer)(charBuffer.compact())).flip();
} else {
// (3) Entire buffer is full, need bigger buffer.
charBuffer = grow(charBuffer);
@@ -220,7 +220,7 @@
if (numChars == -1) {
endOfInput = true;
} else {
- charBuffer.limit(limit + numChars);
+ ((Buffer)charBuffer).limit(limit + numChars);
}
}
@@ -235,7 +235,7 @@
* overflow must be due to a small output buffer.
*/
private void startDraining(boolean overflow) {
- byteBuffer.flip();
+ ((Buffer)byteBuffer).flip();
if (overflow && byteBuffer.remaining() == 0) {
byteBuffer = ByteBuffer.allocate(byteBuffer.capacity() * 2);
} else {
--- guava-25.0/guava-tests/benchmark/com/google/common/io/CharStreamsCopyBenchmark.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/guava-tests/benchmark/com/google/common/io/CharStreamsCopyBenchmark.java 2019-10-10 22:51:18.680505077 +0200
@@ -21,6 +21,7 @@
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
+import java.nio.Buffer;
import java.nio.CharBuffer;
import java.util.Random;
@@ -40,10 +41,10 @@
CharBuffer buf = CharStreams.createBuffer();
long total = 0;
while (from.read(buf) != -1) {
- buf.flip();
+ ((Buffer)buf).flip();
to.append(buf);
total += buf.remaining();
- buf.clear();
+ ((Buffer)buf).clear();
}
return total;
}
--- guava-25.0/guava-tests/test/com/google/common/hash/HashTestUtils.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/guava-tests/test/com/google/common/hash/HashTestUtils.java 2019-10-10 22:12:29.071934399 +0200
@@ -24,6 +24,7 @@
import com.google.common.collect.Sets;
import com.google.common.primitives.Ints;
import com.google.common.testing.EqualsTester;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.Charset;
@@ -195,8 +196,8 @@
int limit = pos + random.nextInt(value.length - pos + 1);
for (PrimitiveSink sink : sinks) {
ByteBuffer buffer = ByteBuffer.wrap(value);
- buffer.position(pos);
- buffer.limit(limit);
+ ((Buffer)buffer).position(pos);
+ ((Buffer)buffer).limit(limit);
sink.putBytes(buffer);
assertEquals(limit, buffer.limit());
assertEquals(limit, buffer.position());
--- guava-25.0/guava-tests/test/com/google/common/io/CharSequenceReaderTest.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/guava-tests/test/com/google/common/io/CharSequenceReaderTest.java 2019-10-10 22:51:18.680505077 +0200
@@ -17,6 +17,7 @@
package com.google.common.io;
import java.io.IOException;
+import java.nio.Buffer;
import java.nio.CharBuffer;
import junit.framework.TestCase;
@@ -211,7 +212,7 @@
reader = new CharSequenceReader(charSequence);
CharBuffer buf2 = CharBuffer.allocate(expected.length());
assertEquals(expected.length() == 0 ? -1 : expected.length(), reader.read(buf2));
- buf2.flip();
+ ((Buffer)buf2).flip();
assertEquals(expected, buf2.toString());
assertFullyRead(reader);
@@ -220,9 +221,9 @@
buf2 = CharBuffer.allocate(5);
builder = new StringBuilder();
while (reader.read(buf2) != -1) {
- buf2.flip();
+ ((Buffer)buf2).flip();
builder.append(buf2);
- buf2.clear();
+ ((Buffer)buf2).clear();
}
assertEquals(expected, builder.toString());
assertFullyRead(reader);
--- guava-25.0/guava-tests/test/com/google/common/io/SourceSinkFactories.java 2018-04-26 00:12:31.000000000 +0200
+++ guava-25.0/guava-tests/test/com/google/common/io/SourceSinkFactories.java 2019-10-10 22:51:18.684505100 +0200
@@ -34,6 +34,7 @@
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
+import java.nio.Buffer;
import java.nio.CharBuffer;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
@@ -442,9 +443,9 @@
StringBuilder builder = new StringBuilder();
CharBuffer buffer = CharBuffer.allocate(100);
while (reader.read(buffer) != -1) {
- buffer.flip();
+ ((Buffer)buffer).flip();
builder.append(buffer);
- buffer.clear();
+ ((Buffer)buffer).clear();
}
return builder.toString();
}

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Thu Oct 10 21:00:22 UTC 2019 - Fridrich Strba <fstrba@suse.com>
- Added patch:
* guava-25.0-java8compat.patch
+ Avoid callingoverridden methods with covariant return types
for java.nio.ByteBuffer and java.nio.CharBuffer, which were
introduced in Java 9
+ This allows us to produce with Java >= 9 binaries that are
compatible with Java 8
-------------------------------------------------------------------
Fri Apr 12 10:05:01 UTC 2019 - Fridrich Strba <fstrba@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package guava
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -24,6 +24,7 @@ License: Apache-2.0 AND CC0-1.0
Group: Development/Libraries/Java
URL: https://github.com/google/guava
Source0: https://github.com/google/guava/archive/v%{version}.tar.gz
Patch0: %{name}-%{version}-java8compat.patch
BuildRequires: fdupes
BuildRequires: maven-local
BuildRequires: mvn(com.google.code.findbugs:jsr305)
@ -49,12 +50,14 @@ API documentation for %{name}.
%package testlib
Summary: The guava-testlib artifact
Group: Development/Libraries/Java
%description testlib
guava-testlib provides additional functionality for conveninent unit testing
%prep
%setup -q
%patch0 -p1
find . -name '*.jar' -delete