File java8-compatibility.patch of Package xmlgraphics-fop.28273

--- fop-2.5/fop-core/src/main/java/org/apache/fop/afp/fonts/CharactersetEncoder.java	2020-05-05 11:42:04.000000000 +0200
+++ fop-2.5/fop-core/src/main/java/org/apache/fop/afp/fonts/CharactersetEncoder.java	2020-06-03 11:18:04.577537190 +0200
@@ -21,6 +21,7 @@
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.nio.Buffer;
 import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
 import java.nio.charset.CharacterCodingException;
@@ -68,7 +69,7 @@
         if (bb.hasArray()) {
             return getEncodedChars(bb.array(), bb.limit());
         } else {
-            bb.rewind();
+            ((Buffer)bb).rewind();
             byte[] bytes = new byte[bb.remaining()];
             bb.get(bytes);
             return getEncodedChars(bytes, bytes.length);
--- fop-2.5/fop-core/src/main/java/org/apache/fop/area/AreaTreeParser.java	2020-05-05 11:42:04.000000000 +0200
+++ fop-2.5/fop-core/src/main/java/org/apache/fop/area/AreaTreeParser.java	2020-06-03 11:18:04.581537214 +0200
@@ -24,6 +24,7 @@
 import java.awt.geom.Rectangle2D;
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.nio.Buffer;
 import java.nio.CharBuffer;
 import java.util.List;
 import java.util.Map;
@@ -326,7 +327,7 @@
                 throws SAXException {
             lastAttributes = new AttributesImpl(attributes);
             Maker maker = makers.get(localName);
-            content.clear();
+            ((Buffer)content).clear();
             ignoreCharacters = true;
             if (maker != null) {
                 ignoreCharacters = maker.ignoreCharacters();
@@ -357,7 +358,7 @@
                     Maker maker = makers.get(localName);
                     if (maker != null) {
                         maker.endElement();
-                        content.clear();
+                        ((Buffer)content).clear();
                     }
                     ignoreCharacters = true;
                 } else {
@@ -845,7 +846,7 @@
                 boolean reversed = XMLUtil.getAttributeAsBoolean(lastAttributes, "reversed", false);
                 int[][] gposAdjustments
                     = XMLUtil.getAttributeAsPositionAdjustments(lastAttributes, "position-adjust");
-                content.flip();
+                ((Buffer)content).flip();
                 WordArea word = new WordArea(
                     offset, level, content.toString().trim(), letterAdjust,
                       null, gposAdjustments, reversed);
@@ -865,7 +866,7 @@
                 int offset = XMLUtil.getAttributeAsInt(lastAttributes, "offset", 0);
                 //TODO the isAdjustable parameter is currently not used/implemented
                 if (content.position() > 0) {
-                    content.flip();
+                    ((Buffer)content).flip();
                     boolean adjustable = XMLUtil.getAttributeAsBoolean(lastAttributes, "adj", true);
                     int level = XMLUtil.getAttributeAsInt(lastAttributes, "level", -1);
                     SpaceArea space = new SpaceArea(offset, level, content.charAt(0), adjustable);
@@ -1254,17 +1255,17 @@
                     // allocate a larger buffer and transfer content
                     CharBuffer newContent
                             = CharBuffer.allocate(this.content.position() + length);
-                    this.content.flip();
+                    ((Buffer)(this.content)).flip();
                     newContent.put(this.content);
                     this.content = newContent;
                 }
                 // make sure the full capacity is used
-                this.content.limit(this.content.capacity());
+                ((Buffer)(this.content)).limit(this.content.capacity());
                 // add characters to the buffer
                 this.content.put(ch, start, length);
                 // decrease the limit, if necessary
                 if (this.content.position() < this.content.limit()) {
-                    this.content.limit(this.content.position());
+                    ((Buffer)(this.content)).limit(this.content.position());
                 }
             }
         }
--- fop-2.5/fop-core/src/main/java/org/apache/fop/fo/FOText.java	2020-05-05 11:42:04.000000000 +0200
+++ fop-2.5/fop-core/src/main/java/org/apache/fop/fo/FOText.java	2020-06-03 11:18:04.581537214 +0200
@@ -20,6 +20,7 @@
 package org.apache.fop.fo;
 
 import java.awt.Color;
+import java.nio.Buffer;
 import java.nio.CharBuffer;
 import java.text.CharacterIterator;
 import java.text.StringCharacterIterator;
@@ -134,17 +135,17 @@
                     newCapacity = requires;
                 }
                 CharBuffer newBuffer = CharBuffer.allocate(newCapacity);
-                charBuffer.rewind();
+                ((Buffer)charBuffer).rewind();
                 newBuffer.put(charBuffer);
                 charBuffer = newBuffer;
             }
         }
         // extend limit to capacity
-        charBuffer.limit(charBuffer.capacity());
+        ((Buffer)charBuffer).limit(charBuffer.capacity());
         // append characters
         charBuffer.put(data, start, length);
         // shrink limit to position
-        charBuffer.limit(charBuffer.position());
+        ((Buffer)charBuffer).limit(((Buffer)charBuffer).position());
     }
 
     /**
@@ -156,7 +157,7 @@
         if (this.charBuffer == null) {
             return null;
         }
-        this.charBuffer.rewind();
+        ((Buffer)(this.charBuffer)).rewind();
         return this.charBuffer.asReadOnlyBuffer().subSequence(0, this.charBuffer.limit());
     }
 
@@ -169,9 +170,9 @@
             // pointed to is really a different one
             if (charBuffer != null) {
                 ft.charBuffer = CharBuffer.allocate(charBuffer.limit());
-                charBuffer.rewind();
+                ((Buffer)charBuffer).rewind();
                 ft.charBuffer.put(charBuffer);
-                ft.charBuffer.rewind();
+                ((Buffer)(ft.charBuffer)).rewind();
             }
         }
         ft.prevFOTextThisBlock = null;
@@ -203,7 +204,7 @@
     /** {@inheritDoc} */
     public void endOfNode() throws FOPException {
         if (charBuffer != null) {
-            charBuffer.rewind();
+            ((Buffer)charBuffer).rewind();
         }
         super.endOfNode();
         getFOEventHandler().characters(this);
@@ -230,7 +231,7 @@
         }
 
         char ch;
-        charBuffer.rewind();
+        ((Buffer)charBuffer).rewind();
         while (charBuffer.hasRemaining()) {
             ch = charBuffer.get();
             if (!((ch == CharUtilities.SPACE)
@@ -238,7 +239,7 @@
                     || (ch == CharUtilities.CARRIAGE_RETURN)
                     || (ch == CharUtilities.TAB))) {
                 // not whitespace
-                charBuffer.rewind();
+                ((Buffer)charBuffer).rewind();
                 return true;
             }
         }
@@ -281,7 +282,7 @@
             return;
         }
 
-        charBuffer.rewind();
+        ((Buffer)charBuffer).rewind();
         CharBuffer tmp = charBuffer.slice();
         char c;
         int lim = charBuffer.limit();
@@ -548,19 +549,19 @@
         public void remove() {
 
             if (this.canRemove) {
-                charBuffer.position(currentPosition);
+                ((Buffer)charBuffer).position(currentPosition);
                 // Slice the buffer at the current position
                 CharBuffer tmp = charBuffer.slice();
                 // Reset position to before current character
-                charBuffer.position(--currentPosition);
+                ((Buffer)charBuffer).position(--currentPosition);
                 if (tmp.hasRemaining()) {
                     // Transfer any remaining characters
-                    charBuffer.mark();
+                    ((Buffer)charBuffer).mark();
                     charBuffer.put(tmp);
-                    charBuffer.reset();
+                    ((Buffer)charBuffer).reset();
                 }
                 // Decrease limit
-                charBuffer.limit(charBuffer.limit() - 1);
+                ((Buffer)charBuffer).limit(((Buffer)charBuffer).limit() - 1);
                 // Make sure following calls fail, unless nextChar() was called
                 this.canRemove = false;
             } else {
@@ -743,7 +744,7 @@
      */
     public void resetBuffer() {
         if (charBuffer != null) {
-            charBuffer.rewind();
+            ((Buffer)charBuffer).rewind();
         }
     }
 
--- fop-2.5/fop-core/src/main/java/org/apache/fop/fonts/MultiByteFont.java	2020-05-05 11:42:05.000000000 +0200
+++ fop-2.5/fop-core/src/main/java/org/apache/fop/fonts/MultiByteFont.java	2020-06-03 11:19:29.182037444 +0200
@@ -21,6 +21,7 @@
 
 import java.awt.Rectangle;
 import java.io.InputStream;
+import java.nio.Buffer;
 import java.nio.CharBuffer;
 import java.nio.IntBuffer;
 import java.util.ArrayList;
@@ -731,7 +732,7 @@
             cb.put(c);
         }
 
-        cb.flip();
+        ((Buffer)cb).flip();
         return cb;
     }
 
openSUSE Build Service is sponsored by