This commit is contained in:
parent
3e21fa8780
commit
a16d327b9b
46
donotmock.patch
Normal file
46
donotmock.patch
Normal file
@ -0,0 +1,46 @@
|
||||
--- guava-30.1/guava/src/com/google/common/graph/Traverser.java 2021-05-10 16:45:16.248098756 +0200
|
||||
+++ guava-30.1/guava/src/com/google/common/graph/Traverser.java 2021-05-10 16:53:38.627252038 +0200
|
||||
@@ -60,9 +60,7 @@
|
||||
* @since 23.1
|
||||
*/
|
||||
@Beta
|
||||
-@DoNotMock(
|
||||
- "Call forGraph or forTree, passing a lambda or a Graph with the desired edges (built with"
|
||||
- + " GraphBuilder)")
|
||||
+@DoNotMock("Call forGraph or forTree, passing a lambda or a Graph with the desired edges (built with GraphBuilder)")
|
||||
public abstract class Traverser<N> {
|
||||
private final SuccessorsFunction<N> successorFunction;
|
||||
|
||||
--- guava-30.1/guava/src/com/google/common/util/concurrent/ClosingFuture.java 2021-05-10 16:45:16.256098806 +0200
|
||||
+++ guava-30.1/guava/src/com/google/common/util/concurrent/ClosingFuture.java 2021-05-10 16:55:44.184040192 +0200
|
||||
@@ -32,6 +32,7 @@
|
||||
import static com.google.common.util.concurrent.Futures.immediateFuture;
|
||||
import static com.google.common.util.concurrent.Futures.nonCancellationPropagating;
|
||||
import static com.google.common.util.concurrent.MoreExecutors.directExecutor;
|
||||
+import com.google.errorprone.annotations.DoNotMock;
|
||||
import static java.util.logging.Level.FINER;
|
||||
import static java.util.logging.Level.SEVERE;
|
||||
import static java.util.logging.Level.WARNING;
|
||||
@@ -1202,8 +1203,7 @@
|
||||
* }</pre>
|
||||
*/
|
||||
// TODO(cpovirk): Use simple name instead of fully qualified after we stop building with JDK 8.
|
||||
- @com.google.errorprone.annotations.DoNotMock(
|
||||
- "Use ClosingFuture.whenAllSucceed() or .whenAllComplete() instead.")
|
||||
+ @DoNotMock("Use ClosingFuture.whenAllSucceed() or .whenAllComplete() instead.")
|
||||
public static class Combiner {
|
||||
|
||||
private final CloseableList closeables = new CloseableList();
|
||||
--- guava-30.1/guava/src/com/google/common/util/concurrent/ListeningExecutorService.java 2021-05-10 16:45:16.256098806 +0200
|
||||
+++ guava-30.1/guava/src/com/google/common/util/concurrent/ListeningExecutorService.java 2021-05-10 16:53:54.207349829 +0200
|
||||
@@ -32,9 +32,7 @@
|
||||
* @author Chris Povirk
|
||||
* @since 10.0
|
||||
*/
|
||||
-@DoNotMock(
|
||||
- "Use TestingExecutors.sameThreadScheduledExecutor, or wrap a real Executor from "
|
||||
- + "java.util.concurrent.Executors with MoreExecutors.listeningDecorator")
|
||||
+@DoNotMock("Use TestingExecutors.sameThreadScheduledExecutor, or wrap a real Executor from java.util.concurrent.Executors with MoreExecutors.listeningDecorator")
|
||||
@GwtIncompatible
|
||||
public interface ListeningExecutorService extends ExecutorService {
|
||||
/**
|
@ -1,656 +0,0 @@
|
||||
--- 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();
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a69c04f7b35ed95ca1ebaf76de648255e3b22f063c69cf33a46c3cf4e8888675
|
||||
size 2724
|
||||
oid sha256:b02e359c3be4697175cd19498fc20dba83c6ac3d6d1244de8ad35298e3dd04c1
|
||||
size 3428
|
||||
|
@ -1,3 +1,17 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon May 10 14:59:41 UTC 2021 - Fridrich Strba <fstrba@suse.com>
|
||||
|
||||
- Upgrade to guava 30.1.1
|
||||
* fixes bsc#1179926, CVE-2020-8908: temp directory creation
|
||||
vulnerability in Guava versions prior to 30.0
|
||||
- Removed patch:
|
||||
* guava-25.0-java8compat.patch
|
||||
+ the compatibility is handled in the upstream code
|
||||
- Added patch:
|
||||
* donotmock.patch
|
||||
+ patch @DoNotMock annotation occurrences in order to put them
|
||||
in a format that our regex is able to identify and kill
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Dec 4 17:32:18 UTC 2019 - Fridrich Strba <fstrba@suse.com>
|
||||
|
||||
|
12
guava.spec
12
guava.spec
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package guava
|
||||
#
|
||||
# Copyright (c) 2019 SUSE LLC
|
||||
# Copyright (c) 2021 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
Name: guava
|
||||
Version: 25.0
|
||||
Version: 30.1.1
|
||||
Release: 0
|
||||
Summary: Google Core Libraries for Java
|
||||
License: Apache-2.0 AND CC0-1.0
|
||||
@ -25,7 +25,7 @@ Group: Development/Libraries/Java
|
||||
URL: https://github.com/google/guava
|
||||
Source0: https://github.com/google/guava/archive/v%{version}.tar.gz
|
||||
Source1: %{name}-build.tar.xz
|
||||
Patch0: %{name}-%{version}-java8compat.patch
|
||||
Patch0: donotmock.patch
|
||||
BuildRequires: ant
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: javapackages-local
|
||||
@ -74,10 +74,10 @@ find . -name '*.jar' -delete
|
||||
|
||||
%pom_xpath_inject /pom:project/pom:build/pom:plugins/pom:plugin/pom:configuration/pom:instructions "<_nouses>true</_nouses>" guava/pom.xml
|
||||
|
||||
%pom_remove_dep -r :animal-sniffer-annotations
|
||||
%pom_remove_dep -r :error_prone_annotations
|
||||
%pom_remove_dep -r :j2objc-annotations
|
||||
%pom_remove_dep -r org.checkerframework:
|
||||
%pom_remove_dep -r :listenablefuture
|
||||
|
||||
annotations=$(
|
||||
find -name '*.java' \
|
||||
@ -112,11 +112,14 @@ build-jar-repository -s lib junit jsr-305
|
||||
%install
|
||||
# jars
|
||||
install -dm 0755 %{buildroot}%{_javadir}/%{name}
|
||||
install -pm 0644 futures/failureaccess/target/failureaccess-1.0.1.jar %{buildroot}%{_javadir}/%{name}/failureaccess.jar
|
||||
install -pm 0644 %{name}/target/%{name}-%{version}*.jar %{buildroot}%{_javadir}/%{name}/%{name}.jar
|
||||
install -pm 0644 %{name}-testlib/target/%{name}-testlib-%{version}*.jar %{buildroot}%{_javadir}/%{name}/%{name}-testlib.jar
|
||||
|
||||
# poms
|
||||
install -dm 0755 %{buildroot}%{_mavenpomdir}/%{name}
|
||||
install -pm 0644 futures/failureaccess/pom.xml %{buildroot}%{_mavenpomdir}/%{name}/failureaccess.pom
|
||||
%add_maven_depmap %{name}/failureaccess.pom %{name}/failureaccess.jar -f %{name}
|
||||
install -pm 0644 %{name}/pom.xml %{buildroot}%{_mavenpomdir}/%{name}/%{name}.pom
|
||||
%add_maven_depmap %{name}/%{name}.pom %{name}/%{name}.jar -f %{name}
|
||||
install -pm 0644 %{name}-testlib/pom.xml %{buildroot}%{_mavenpomdir}/%{name}/%{name}-testlib.pom
|
||||
@ -124,6 +127,7 @@ install -pm 0644 %{name}-testlib/pom.xml %{buildroot}%{_mavenpomdir}/%{name}/%{n
|
||||
|
||||
# javadoc
|
||||
install -dm 0755 %{buildroot}%{_javadocdir}/%{name}
|
||||
cp -r futures/failureaccess/target/site/apidocs %{buildroot}%{_javadocdir}/%{name}/failureaccess
|
||||
cp -r %{name}/target/site/apidocs %{buildroot}%{_javadocdir}/%{name}/%{name}
|
||||
cp -r %{name}-testlib/target/site/apidocs %{buildroot}%{_javadocdir}/%{name}/%{name}-testlib
|
||||
%fdupes -s %{buildroot}%{_javadocdir}
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5893c7596828eefafd285375a9a3a717139e0027c388417b25ef8c1eeb673bb6
|
||||
size 5262298
|
3
v30.1.1.tar.gz
Normal file
3
v30.1.1.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ca7ee32dcb9ed26920910e38b673f267f56033df013aad5c1dba41bfbbda725e
|
||||
size 5404546
|
Loading…
x
Reference in New Issue
Block a user