File guava20-java8compat.patch of Package guava20.28016

diff -urEbwB guava-20.0/guava/src/com/google/common/hash/AbstractByteHasher.java guava-20.0.new/guava/src/com/google/common/hash/AbstractByteHasher.java
--- guava-20.0/guava/src/com/google/common/hash/AbstractByteHasher.java	2016-10-28 22:30:44.000000000 +0200
+++ guava-20.0.new/guava/src/com/google/common/hash/AbstractByteHasher.java	2018-11-29 20:11:23.337123690 +0100
@@ -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;
 
@@ -83,7 +84,7 @@
     try {
       update(scratch.array(), 0, bytes);
     } finally {
-      scratch.clear();
+      ((Buffer)scratch).clear();
     }
     return this;
   }
diff -urEbwB guava-20.0/guava/src/com/google/common/hash/AbstractStreamingHashFunction.java guava-20.0.new/guava/src/com/google/common/hash/AbstractStreamingHashFunction.java
--- guava-20.0/guava/src/com/google/common/hash/AbstractStreamingHashFunction.java	2016-10-28 22:30:44.000000000 +0200
+++ guava-20.0.new/guava/src/com/google/common/hash/AbstractStreamingHashFunction.java	2018-11-29 20:09:55.808674786 +0100
@@ -18,6 +18,7 @@
 
 import com.google.common.base.Preconditions;
 import com.google.errorprone.annotations.CanIgnoreReturnValue;
+import java.nio.Buffer;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.nio.charset.Charset;
@@ -135,13 +136,13 @@
      * <p>This implementation simply pads with zeros and delegates to {@link #process(ByteBuffer)}.
      */
     protected void processRemaining(ByteBuffer bb) {
-      bb.position(bb.limit()); // move at the end
-      bb.limit(chunkSize + 7); // get ready to pad with longs
+      ((Buffer)bb).position(bb.limit()); // move at the end
+      ((Buffer)bb).limit(chunkSize + 7); // get ready to pad with longs
       while (bb.position() < chunkSize) {
         bb.putLong(0);
       }
-      bb.limit(chunkSize);
-      bb.flip();
+      ((Buffer)bb).limit(chunkSize);
+      ((Buffer)bb).flip();
       process(bb);
     }
 
@@ -242,7 +243,7 @@
     @Override
     public final HashCode hash() {
       munch();
-      buffer.flip();
+      ((Buffer)buffer).flip();
       if (buffer.remaining() > 0) {
         processRemaining(buffer);
       }
@@ -260,7 +261,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
diff -urEbwB guava-20.0/guava/src/com/google/common/io/ByteStreams.java guava-20.0.new/guava/src/com/google/common/io/ByteStreams.java
--- guava-20.0/guava/src/com/google/common/io/ByteStreams.java	2016-10-28 22:30:44.000000000 +0200
+++ guava-20.0.new/guava/src/com/google/common/io/ByteStreams.java	2018-11-29 20:07:12.499837268 +0100
@@ -32,6 +32,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;
@@ -142,11 +143,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;
   }
diff -urEbwB guava-20.0/guava/src/com/google/common/io/CharStreams.java guava-20.0.new/guava/src/com/google/common/io/CharStreams.java
--- guava-20.0/guava/src/com/google/common/io/CharStreams.java	2016-10-28 22:30:44.000000000 +0200
+++ guava-20.0.new/guava/src/com/google/common/io/CharStreams.java	2018-11-29 20:23:17.520747451 +0100
@@ -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;
@@ -72,10 +73,10 @@
     CharBuffer buf = 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;
   }
@@ -164,7 +165,7 @@
     CharBuffer buf = createBuffer();
     while ((read = readable.read(buf)) != -1) {
       total += read;
-      buf.clear();
+      ((Buffer)buf).clear();
     }
     return total;
   }
diff -urEbwB guava-20.0/guava/src/com/google/common/io/LineReader.java guava-20.0.new/guava/src/com/google/common/io/LineReader.java
--- guava-20.0/guava/src/com/google/common/io/LineReader.java	2016-10-28 22:30:44.000000000 +0200
+++ guava-20.0.new/guava/src/com/google/common/io/LineReader.java	2018-11-29 20:24:02.056973124 +0100
@@ -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;
@@ -71,7 +72,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)
diff -urEbwB guava-20.0/guava/src/com/google/common/io/ReaderInputStream.java guava-20.0.new/guava/src/com/google/common/io/ReaderInputStream.java
--- guava-20.0/guava/src/com/google/common/io/ReaderInputStream.java	2016-10-28 22:30:44.000000000 +0200
+++ guava-20.0.new/guava/src/com/google/common/io/ReaderInputStream.java	2018-11-29 20:28:48.770431203 +0100
@@ -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 {
diff -urEbwB guava-20.0/guava-tests/test/com/google/common/io/CharSequenceReaderTest.java guava-20.0.new/guava-tests/test/com/google/common/io/CharSequenceReaderTest.java
--- guava-20.0/guava-tests/test/com/google/common/io/CharSequenceReaderTest.java	2016-10-28 22:30:44.000000000 +0200
+++ guava-20.0.new/guava-tests/test/com/google/common/io/CharSequenceReaderTest.java	2018-11-29 20:16:05.574558776 +0100
@@ -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;
 
@@ -210,7 +211,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);
 
@@ -219,9 +220,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);
diff -urEbwB guava-20.0/guava-tests/test/com/google/common/io/SourceSinkFactories.java guava-20.0.new/guava-tests/test/com/google/common/io/SourceSinkFactories.java
--- guava-20.0/guava-tests/test/com/google/common/io/SourceSinkFactories.java	2016-10-28 22:30:44.000000000 +0200
+++ guava-20.0.new/guava-tests/test/com/google/common/io/SourceSinkFactories.java	2018-11-29 20:16:54.126804793 +0100
@@ -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;
@@ -415,9 +416,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();
     }
openSUSE Build Service is sponsored by