SHA256
1
0
forked from pool/aqute-bnd
aqute-bnd/aqute-bnd-3.5.0-java8compat.patch

387 lines
12 KiB
Diff

--- bnd-3.5.0.REL/aQute.libg/src/aQute/lib/io/ByteBufferDataInput.java 2017-09-29 20:03:19.000000000 +0200
+++ bnd-3.5.0.REL/aQute.libg/src/aQute/lib/io/ByteBufferDataInput.java 2018-11-13 11:54:47.408250050 +0100
@@ -3,6 +3,7 @@
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.IOException;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.util.Objects;
public class ByteBufferDataInput implements DataInput {
@@ -32,7 +33,7 @@
return 0;
}
int skipped = Math.min(n, bb.remaining());
- bb.position(bb.position() + skipped);
+ ((Buffer)bb).position(bb.position() + skipped);
return skipped;
}
--- bnd-3.5.0.REL/aQute.libg/src/aQute/lib/io/ByteBufferInputStream.java 2017-09-29 20:03:19.000000000 +0200
+++ bnd-3.5.0.REL/aQute.libg/src/aQute/lib/io/ByteBufferInputStream.java 2018-11-13 11:53:37.615873907 +0100
@@ -2,13 +2,14 @@
import java.io.IOException;
import java.io.InputStream;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
public class ByteBufferInputStream extends InputStream {
private final ByteBuffer bb;
public ByteBufferInputStream(ByteBuffer buffer) {
- buffer.mark();
+ ((Buffer)buffer).mark();
bb = buffer;
}
@@ -37,7 +38,7 @@
return 0L;
}
int skipped = Math.min((int) n, bb.remaining());
- bb.position(bb.position() + skipped);
+ ((Buffer)bb).position(bb.position() + skipped);
return skipped;
}
@@ -48,17 +49,17 @@
@Override
public void close() throws IOException {
- bb.position(bb.limit());
+ ((Buffer)bb).position(((Buffer)bb).limit());
}
@Override
public void mark(int readlimit) {
- bb.mark();
+ ((Buffer)bb).mark();
}
@Override
public void reset() throws IOException {
- bb.reset();
+ ((Buffer)bb).reset();
}
@Override
--- bnd-3.5.0.REL/aQute.libg/src/aQute/lib/io/CharBufferReader.java 2017-09-29 20:03:19.000000000 +0200
+++ bnd-3.5.0.REL/aQute.libg/src/aQute/lib/io/CharBufferReader.java 2018-11-13 11:45:05.349112131 +0100
@@ -2,13 +2,14 @@
import java.io.IOException;
import java.io.Reader;
+import java.nio.Buffer;
import java.nio.CharBuffer;
public class CharBufferReader extends Reader {
private final CharBuffer cb;
public CharBufferReader(CharBuffer buffer) {
- buffer.mark();
+ ((Buffer)buffer).mark();
cb = buffer;
}
@@ -25,7 +26,7 @@
@Override
public void close() throws IOException {
- cb.position(cb.limit());
+ ((Buffer)cb).position(((Buffer)cb).limit());
}
@Override
@@ -42,7 +43,7 @@
return 0L;
}
int skipped = Math.min((int) n, cb.remaining());
- cb.position(cb.position() + skipped);
+ ((Buffer)cb).position(cb.position() + skipped);
return skipped;
}
@@ -58,11 +59,11 @@
@Override
public void mark(int readAheadLimit) throws IOException {
- cb.mark();
+ ((Buffer)cb).mark();
}
@Override
public void reset() throws IOException {
- cb.reset();
+ ((Buffer)cb).reset();
}
}
--- bnd-3.5.0.REL/aQute.libg/src/aQute/lib/io/IO.java 2017-09-29 20:03:19.000000000 +0200
+++ bnd-3.5.0.REL/aQute.libg/src/aQute/lib/io/IO.java 2018-11-13 11:50:46.002948997 +0100
@@ -23,6 +23,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.channels.Channels;
@@ -196,11 +197,11 @@
try {
ByteBuffer bb = ByteBuffer.allocateDirect(BUFFER_SIZE);
while (in.read(bb) > 0) {
- bb.flip();
+ ((Buffer)bb).flip();
out.write(bb);
bb.compact();
}
- for (bb.flip(); bb.hasRemaining();) {
+ for (((Buffer)bb).flip(); bb.hasRemaining();) {
out.write(bb);
}
return out;
@@ -216,7 +217,7 @@
int offset = bb.arrayOffset();
for (int size; bb.hasRemaining()
&& (size = in.read(buffer, offset + bb.position(), bb.remaining())) > 0;) {
- bb.position(bb.position() + size);
+ ((Buffer)bb).position(bb.position() + size);
}
} else {
int length = Math.min(bb.remaining(), BUFFER_SIZE);
@@ -250,7 +251,7 @@
public static OutputStream copy(ByteBuffer bb, OutputStream out) throws IOException {
if (bb.hasArray()) {
out.write(bb.array(), bb.arrayOffset() + bb.position(), bb.remaining());
- bb.position(bb.limit());
+ ((Buffer)bb).position(((Buffer)bb).limit());
} else {
int length = Math.min(bb.remaining(), BUFFER_SIZE);
byte[] buffer = new byte[length];
@@ -295,11 +296,11 @@
try {
ByteBuffer bb = ByteBuffer.allocate(BUFFER_SIZE);
while (in.read(bb) > 0) {
- bb.flip();
+ ((Buffer)bb).flip();
md.update(bb);
bb.compact();
}
- for (bb.flip(); bb.hasRemaining();) {
+ for (((Buffer)bb).flip(); bb.hasRemaining();) {
md.update(bb);
}
return md;
@@ -425,12 +426,12 @@
ByteBuffer bb = ByteBuffer.allocate(BUFFER_SIZE);
byte[] buffer = bb.array();
for (int size; (size = in.read(buffer, bb.position(), bb.remaining())) > 0;) {
- bb.position(bb.position() + size);
- bb.flip();
+ ((Buffer)bb).position(bb.position() + size);
+ ((Buffer)bb).flip();
out.write(bb);
bb.compact();
}
- for (bb.flip(); bb.hasRemaining();) {
+ for (((Buffer)bb).flip(); bb.hasRemaining();) {
out.write(bb);
}
return out;
@@ -443,7 +444,7 @@
try {
ByteBuffer bb = ByteBuffer.allocate(BUFFER_SIZE);
byte[] buffer = bb.array();
- for (; in.read(bb) > 0; bb.clear()) {
+ for (; in.read(bb) > 0; ((Buffer)bb).clear()) {
out.write(buffer, 0, bb.position());
}
return out;
@@ -468,7 +469,7 @@
}
ByteBuffer bb = ByteBuffer.allocate((int) size);
while (in.read(bb) > 0) {}
- bb.flip();
+ ((Buffer)bb).flip();
return bb;
}
}
--- bnd-3.5.0.REL/aQute.libg/src/aQute/lib/utf8properties/UTF8Properties.java 2017-09-29 20:03:19.000000000 +0200
+++ bnd-3.5.0.REL/aQute.libg/src/aQute/lib/utf8properties/UTF8Properties.java 2018-11-13 11:35:27.673997245 +0100
@@ -10,6 +10,7 @@
import java.io.Reader;
import java.io.StringWriter;
import java.io.Writer;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.CharsetDecoder;
@@ -87,10 +88,10 @@
}
decoder.reset();
if (success) {
- return cb.flip().toString();
+ return ((Buffer)cb).flip().toString();
}
- bb.rewind();
- cb.clear();
+ ((Buffer)bb).rewind();
+ ((Buffer)cb).clear();
}
return new String(buffer); // default decoding
}
--- bnd-3.5.0.REL/aQute.libg/test/aQute/lib/io/IOTest.java 2017-09-29 20:03:19.000000000 +0200
+++ bnd-3.5.0.REL/aQute.libg/test/aQute/lib/io/IOTest.java 2018-11-13 11:57:46.305214231 +0100
@@ -2,6 +2,7 @@
import java.io.File;
import java.io.InputStream;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.file.Files;
@@ -60,7 +61,7 @@
assertEquals((int) src.length(), bb.position());
assertEquals(bb.capacity(), bb.position());
assertFalse(bb.hasRemaining());
- bb.flip();
+ ((Buffer)bb).flip();
int length = bb.remaining();
for (int i = 0; i < length; i++) {
assertEquals(file[i], bb.get());
@@ -73,7 +74,7 @@
ByteBuffer bb = IO.copy(IO.stream(src), ByteBuffer.allocate((int) src.length() - 8));
assertEquals(bb.capacity(), bb.position());
assertFalse(bb.hasRemaining());
- bb.flip();
+ ((Buffer)bb).flip();
int length = bb.remaining();
for (int i = 0; i < length; i++) {
assertEquals(file[i], bb.get());
@@ -86,7 +87,7 @@
ByteBuffer bb = IO.copy(IO.stream(src), ByteBuffer.allocate((int) src.length() + 20));
assertEquals((int) src.length(), bb.position());
assertTrue(bb.hasRemaining());
- bb.flip();
+ ((Buffer)bb).flip();
int length = bb.remaining();
for (int i = 0; i < length; i++) {
assertEquals(file[i], bb.get());
@@ -100,7 +101,7 @@
assertEquals((int) src.length(), bb.position());
assertEquals(bb.capacity(), bb.position());
assertFalse(bb.hasRemaining());
- bb.flip();
+ ((Buffer)bb).flip();
int length = bb.remaining();
for (int i = 0; i < length; i++) {
assertEquals(file[i], bb.get());
@@ -113,7 +114,7 @@
ByteBuffer bb = IO.copy(IO.stream(src), ByteBuffer.allocateDirect((int) src.length() - 8));
assertEquals(bb.capacity(), bb.position());
assertFalse(bb.hasRemaining());
- bb.flip();
+ ((Buffer)bb).flip();
int length = bb.remaining();
for (int i = 0; i < length; i++) {
assertEquals(file[i], bb.get());
@@ -126,7 +127,7 @@
ByteBuffer bb = IO.copy(IO.stream(src), ByteBuffer.allocateDirect((int) src.length() + 20));
assertEquals((int) src.length(), bb.position());
assertTrue(bb.hasRemaining());
- bb.flip();
+ ((Buffer)bb).flip();
int length = bb.remaining();
for (int i = 0; i < length; i++) {
assertEquals(file[i], bb.get());
@@ -139,7 +140,7 @@
ByteBuffer bb = IO.copy(IO.stream(src), ByteBuffer.allocateDirect(IOConstants.PAGE_SIZE * 32));
assertEquals((int) src.length(), bb.position());
assertTrue(bb.hasRemaining());
- bb.flip();
+ ((Buffer)bb).flip();
int length = bb.remaining();
for (int i = 0; i < length; i++) {
assertEquals(file[i], bb.get());
@@ -161,7 +162,7 @@
for (int i = 1; i < length; i++) {
assertEquals(file[i - 1], wrapped[i]);
}
- slice.flip();
+ ((Buffer)slice).flip();
length = slice.remaining();
for (int i = 0; i < length; i++) {
assertEquals(file[i], slice.get());
--- bnd-3.5.0.REL/biz.aQute.bndlib/src/aQute/bnd/osgi/Clazz.java 2017-09-29 20:03:19.000000000 +0200
+++ bnd-3.5.0.REL/biz.aQute.bndlib/src/aQute/bnd/osgi/Clazz.java 2018-11-13 12:06:21.331989997 +0100
@@ -7,6 +7,7 @@
import java.lang.annotation.ElementType;
import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.Modifier;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Collection;
@@ -1308,7 +1309,7 @@
int low = bb.getInt();
int high = bb.getInt();
try {
- bb.position(bb.position() + (high - low + 1) * 4);
+ ((Buffer)bb).position(bb.position() + (high - low + 1) * 4);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -1325,13 +1326,13 @@
/* deflt = */
int deflt = bb.getInt();
int npairs = bb.getInt();
- bb.position(bb.position() + npairs * 8);
+ ((Buffer)bb).position(bb.position() + npairs * 8);
lastReference = -1;
break;
default :
lastReference = -1;
- bb.position(bb.position() + OpCodes.OFFSETS[instruction]);
+ ((Buffer)bb).position(bb.position() + OpCodes.OFFSETS[instruction]);
}
}
}
--- bnd-3.5.0.REL/biz.aQute.bndlib/src/aQute/bnd/osgi/URLResource.java 2017-09-29 20:03:19.000000000 +0200
+++ bnd-3.5.0.REL/biz.aQute.bndlib/src/aQute/bnd/osgi/URLResource.java 2018-11-13 12:01:36.758456308 +0100
@@ -6,6 +6,7 @@
import java.io.OutputStream;
import java.net.URL;
import java.net.URLConnection;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import aQute.lib.io.IO;
@@ -41,7 +42,7 @@
return buffer = ByteBuffer.wrap(IO.read(conn.getInputStream()));
}
ByteBuffer bb = IO.copy(conn.getInputStream(), ByteBuffer.allocate(size));
- bb.flip();
+ ((Buffer)bb).flip();
return buffer = bb;
}
--- bnd-3.5.0.REL/biz.aQute.bndlib/src/aQute/bnd/osgi/ZipResource.java 2017-09-29 20:03:19.000000000 +0200
+++ bnd-3.5.0.REL/biz.aQute.bndlib/src/aQute/bnd/osgi/ZipResource.java 2018-11-13 12:03:47.143158991 +0100
@@ -5,6 +5,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@@ -44,7 +45,7 @@
return buffer = ByteBuffer.wrap(IO.read(zip.getInputStream(entry)));
}
ByteBuffer bb = IO.copy(zip.getInputStream(entry), ByteBuffer.allocate((int) size));
- bb.flip();
+ ((Buffer)bb).flip();
return buffer = bb;
}