forked from pool/aqute-bnd
659 lines
20 KiB
Diff
659 lines
20 KiB
Diff
--- bnd-5.1.1.REL/aQute.libg/src/aQute/lib/io/ByteBufferDataInput.java 2020-06-16 23:03:04.000000000 +0200
|
|
+++ bnd-5.1.1.REL/aQute.libg/src/aQute/lib/io/ByteBufferDataInput.java 2021-10-18 07:58:03.359785670 +0200
|
|
@@ -2,6 +2,7 @@
|
|
|
|
import java.io.DataInput;
|
|
import java.io.IOException;
|
|
+import java.nio.Buffer;
|
|
import java.nio.ByteBuffer;
|
|
import java.util.Objects;
|
|
|
|
@@ -34,8 +35,8 @@
|
|
public ByteBuffer slice(int n) {
|
|
int limit = ranged(n);
|
|
ByteBuffer slice = bb.slice();
|
|
- slice.limit(limit);
|
|
- bb.position(bb.position() + limit);
|
|
+ ((Buffer)slice).limit(limit);
|
|
+ ((Buffer)bb).position(bb.position() + limit);
|
|
return slice;
|
|
}
|
|
|
|
@@ -52,7 +53,7 @@
|
|
@Override
|
|
public int skipBytes(int n) {
|
|
int skipped = ranged(n);
|
|
- bb.position(bb.position() + skipped);
|
|
+ ((Buffer)bb).position(bb.position() + skipped);
|
|
return skipped;
|
|
}
|
|
|
|
--- bnd-5.1.1.REL/aQute.libg/src/aQute/lib/io/ByteBufferDataOutput.java 2020-06-16 23:03:04.000000000 +0200
|
|
+++ bnd-5.1.1.REL/aQute.libg/src/aQute/lib/io/ByteBufferDataOutput.java 2021-10-18 08:02:40.545556492 +0200
|
|
@@ -4,6 +4,7 @@
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.UTFDataFormatException;
|
|
+import java.nio.Buffer;
|
|
import java.nio.ByteBuffer;
|
|
|
|
public class ByteBufferDataOutput implements DataOutput {
|
|
@@ -19,7 +20,7 @@
|
|
|
|
public ByteBuffer toByteBuffer() {
|
|
ByteBuffer obb = bb.duplicate();
|
|
- obb.flip();
|
|
+ ((Buffer)obb).flip();
|
|
return obb;
|
|
}
|
|
|
|
@@ -41,7 +42,7 @@
|
|
if ((newCap - minCap) < 0) {
|
|
newCap = minCap;
|
|
}
|
|
- obb.flip();
|
|
+ ((Buffer)obb).flip();
|
|
return bb = ByteBuffer.allocate(newCap)
|
|
.put(obb);
|
|
}
|
|
@@ -78,7 +79,7 @@
|
|
byte[] buffer = obb.array();
|
|
for (int size, position; obb.hasRemaining()
|
|
&& (size = in.read(buffer, position = obb.position(), obb.remaining())) > 0;) {
|
|
- obb.position(position + size);
|
|
+ ((Buffer)obb).position(position + size);
|
|
}
|
|
} while (!obb.hasRemaining());
|
|
}
|
|
--- bnd-5.1.1.REL/aQute.libg/src/aQute/lib/io/ByteBufferInputStream.java 2020-06-16 23:03:04.000000000 +0200
|
|
+++ bnd-5.1.1.REL/aQute.libg/src/aQute/lib/io/ByteBufferInputStream.java 2021-10-18 08:00:48.472840427 +0200
|
|
@@ -1,13 +1,14 @@
|
|
package aQute.lib.io;
|
|
|
|
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;
|
|
}
|
|
|
|
@@ -44,7 +45,7 @@
|
|
return 0L;
|
|
}
|
|
int skipped = Math.min((int) n, bb.remaining());
|
|
- bb.position(bb.position() + skipped);
|
|
+ ((Buffer)bb).position(bb.position() + skipped);
|
|
return skipped;
|
|
}
|
|
|
|
@@ -55,17 +56,17 @@
|
|
|
|
@Override
|
|
public void close() {
|
|
- bb.position(bb.limit());
|
|
+ ((Buffer)bb).position(bb.limit());
|
|
}
|
|
|
|
@Override
|
|
public synchronized void mark(int readlimit) {
|
|
- bb.mark();
|
|
+ ((Buffer)bb).mark();
|
|
}
|
|
|
|
@Override
|
|
public synchronized void reset() {
|
|
- bb.reset();
|
|
+ ((Buffer)bb).reset();
|
|
}
|
|
|
|
@Override
|
|
--- bnd-5.1.1.REL/aQute.libg/src/aQute/lib/io/ByteBufferOutputStream.java 2020-06-16 23:03:04.000000000 +0200
|
|
+++ bnd-5.1.1.REL/aQute.libg/src/aQute/lib/io/ByteBufferOutputStream.java 2021-10-18 07:59:24.488303884 +0200
|
|
@@ -3,6 +3,7 @@
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.OutputStream;
|
|
+import java.nio.Buffer;
|
|
import java.nio.ByteBuffer;
|
|
|
|
public class ByteBufferOutputStream extends OutputStream {
|
|
@@ -18,7 +19,7 @@
|
|
|
|
public ByteBuffer toByteBuffer() {
|
|
ByteBuffer obb = bb.duplicate();
|
|
- obb.flip();
|
|
+ ((Buffer)obb).flip();
|
|
return obb;
|
|
}
|
|
|
|
@@ -40,7 +41,7 @@
|
|
if ((newCap - minCap) < 0) {
|
|
newCap = minCap;
|
|
}
|
|
- obb.flip();
|
|
+ ((Buffer)obb).flip();
|
|
return bb = ByteBuffer.allocate(newCap)
|
|
.put(obb);
|
|
}
|
|
@@ -77,7 +78,7 @@
|
|
byte[] buffer = obb.array();
|
|
for (int size, position; obb.hasRemaining()
|
|
&& (size = in.read(buffer, position = obb.position(), obb.remaining())) > 0;) {
|
|
- obb.position(position + size);
|
|
+ ((Buffer)obb).position(position + size);
|
|
}
|
|
} while (!obb.hasRemaining());
|
|
}
|
|
--- bnd-5.1.1.REL/aQute.libg/src/aQute/lib/io/CharBufferReader.java 2020-06-16 23:03:04.000000000 +0200
|
|
+++ bnd-5.1.1.REL/aQute.libg/src/aQute/lib/io/CharBufferReader.java 2021-10-18 08:09:03.356117231 +0200
|
|
@@ -1,13 +1,14 @@
|
|
package aQute.lib.io;
|
|
|
|
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;
|
|
}
|
|
|
|
@@ -24,7 +25,7 @@
|
|
|
|
@Override
|
|
public void close() {
|
|
- cb.position(cb.limit());
|
|
+ ((Buffer)cb).position(cb.limit());
|
|
}
|
|
|
|
@Override
|
|
@@ -41,7 +42,7 @@
|
|
return 0L;
|
|
}
|
|
int skipped = Math.min((int) n, cb.remaining());
|
|
- cb.position(cb.position() + skipped);
|
|
+ ((Buffer)cb).position(cb.position() + skipped);
|
|
return skipped;
|
|
}
|
|
|
|
@@ -57,11 +58,11 @@
|
|
|
|
@Override
|
|
public void mark(int readAheadLimit) {
|
|
- cb.mark();
|
|
+ ((Buffer)cb).mark();
|
|
}
|
|
|
|
@Override
|
|
public void reset() {
|
|
- cb.reset();
|
|
+ ((Buffer)cb).reset();
|
|
}
|
|
}
|
|
--- bnd-5.1.1.REL/aQute.libg/src/aQute/lib/io/IO.java 2020-06-16 23:03:04.000000000 +0200
|
|
+++ bnd-5.1.1.REL/aQute.libg/src/aQute/lib/io/IO.java 2021-10-18 08:32:23.545468242 +0200
|
|
@@ -25,6 +25,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;
|
|
@@ -218,11 +219,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;
|
|
@@ -238,7 +239,7 @@
|
|
int offset = bb.arrayOffset();
|
|
for (int size, position; bb.hasRemaining()
|
|
&& (size = in.read(buffer, offset + (position = bb.position()), bb.remaining())) > 0;) {
|
|
- bb.position(position + size);
|
|
+ ((Buffer)bb).position(position + size);
|
|
}
|
|
} else {
|
|
int length = Math.min(bb.remaining(), BUFFER_SIZE);
|
|
@@ -275,7 +276,7 @@
|
|
bbout.write(bb);
|
|
} else if (bb.hasArray()) {
|
|
out.write(bb.array(), bb.arrayOffset() + bb.position(), bb.remaining());
|
|
- bb.position(bb.limit());
|
|
+ ((Buffer)bb).position(bb.limit());
|
|
} else {
|
|
int length = Math.min(bb.remaining(), BUFFER_SIZE);
|
|
byte[] buffer = new byte[length];
|
|
@@ -294,7 +295,7 @@
|
|
bbout.write(bb);
|
|
} else if (bb.hasArray()) {
|
|
out.write(bb.array(), bb.arrayOffset() + bb.position(), bb.remaining());
|
|
- bb.position(bb.limit());
|
|
+ ((Buffer)bb).position(bb.limit());
|
|
} else {
|
|
int length = Math.min(bb.remaining(), BUFFER_SIZE);
|
|
byte[] buffer = new byte[length];
|
|
@@ -339,7 +340,7 @@
|
|
try {
|
|
ByteBuffer bb = ByteBuffer.allocate(BUFFER_SIZE);
|
|
while (in.read(bb) > 0) {
|
|
- bb.flip();
|
|
+ ((Buffer)bb).flip();
|
|
md.update(bb);
|
|
bb.compact();
|
|
}
|
|
@@ -472,12 +473,12 @@
|
|
ByteBuffer bb = ByteBuffer.allocate(BUFFER_SIZE);
|
|
byte[] buffer = bb.array();
|
|
for (int size, position; (size = in.read(buffer, position = bb.position(), bb.remaining())) > 0;) {
|
|
- bb.position(position + size);
|
|
- bb.flip();
|
|
+ ((Buffer)bb).position(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;
|
|
@@ -490,7 +491,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;
|
|
@@ -515,7 +516,7 @@
|
|
}
|
|
ByteBuffer bb = ByteBuffer.allocate((int) size);
|
|
while (in.read(bb) > 0) {}
|
|
- bb.flip();
|
|
+ ((Buffer)bb).flip();
|
|
return bb;
|
|
}
|
|
}
|
|
--- bnd-5.1.1.REL/aQute.libg/src/aQute/lib/utf8properties/UTF8Properties.java 2020-06-16 23:03:04.000000000 +0200
|
|
+++ bnd-5.1.1.REL/aQute.libg/src/aQute/lib/utf8properties/UTF8Properties.java 2021-10-18 08:04:01.910076369 +0200
|
|
@@ -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;
|
|
@@ -120,11 +121,11 @@
|
|
}
|
|
decoder.reset();
|
|
if (success) {
|
|
- return cb.flip()
|
|
+ return ((Buffer)cb).flip()
|
|
.toString();
|
|
}
|
|
- bb.rewind();
|
|
- cb.clear();
|
|
+ ((Buffer)bb).rewind();
|
|
+ ((Buffer)cb).clear();
|
|
}
|
|
return new String(buffer); // default decoding
|
|
}
|
|
--- bnd-5.1.1.REL/aQute.libg/test/aQute/lib/io/IOTest.java 2020-06-16 23:03:04.000000000 +0200
|
|
+++ bnd-5.1.1.REL/aQute.libg/test/aQute/lib/io/IOTest.java 2021-10-18 07:51:55.341414987 +0200
|
|
@@ -13,6 +13,7 @@
|
|
import java.io.InputStream;
|
|
import java.io.Writer;
|
|
import java.lang.reflect.Method;
|
|
+import java.nio.Buffer;
|
|
import java.nio.ByteBuffer;
|
|
import java.nio.file.Files;
|
|
import java.nio.file.Path;
|
|
@@ -135,7 +136,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());
|
|
@@ -149,7 +150,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());
|
|
@@ -163,7 +164,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());
|
|
@@ -178,7 +179,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());
|
|
@@ -192,7 +193,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());
|
|
@@ -206,7 +207,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());
|
|
@@ -220,7 +221,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());
|
|
@@ -243,7 +244,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-5.1.1.REL/biz.aQute.bndlib/src/aQute/bnd/classfile/CodeAttribute.java 2020-06-16 23:03:04.000000000 +0200
|
|
+++ bnd-5.1.1.REL/biz.aQute.bndlib/src/aQute/bnd/classfile/CodeAttribute.java 2021-10-18 07:43:59.698276751 +0200
|
|
@@ -3,6 +3,7 @@
|
|
import java.io.DataInput;
|
|
import java.io.DataOutput;
|
|
import java.io.IOException;
|
|
+import java.nio.Buffer;
|
|
import java.nio.ByteBuffer;
|
|
import java.util.Arrays;
|
|
|
|
@@ -58,7 +59,7 @@
|
|
out.writeShort(max_stack);
|
|
out.writeShort(max_locals);
|
|
ByteBuffer duplicate = code.duplicate();
|
|
- duplicate.rewind();
|
|
+ ((Buffer)duplicate).rewind();
|
|
int code_length = duplicate.limit();
|
|
out.writeInt(code_length);
|
|
IO.copy(duplicate, out);
|
|
--- bnd-5.1.1.REL/biz.aQute.bndlib/src/aQute/bnd/classfile/SourceDebugExtensionAttribute.java 2020-06-16 23:03:04.000000000 +0200
|
|
+++ bnd-5.1.1.REL/biz.aQute.bndlib/src/aQute/bnd/classfile/SourceDebugExtensionAttribute.java 2021-10-18 07:46:56.515450094 +0200
|
|
@@ -3,6 +3,7 @@
|
|
import java.io.DataInput;
|
|
import java.io.DataOutput;
|
|
import java.io.IOException;
|
|
+import java.nio.Buffer;
|
|
import java.nio.ByteBuffer;
|
|
|
|
import aQute.lib.io.IO;
|
|
@@ -40,7 +41,7 @@
|
|
out.writeShort(attribute_name_index);
|
|
out.writeInt(attribute_length);
|
|
ByteBuffer duplicate = debug_extension.duplicate();
|
|
- duplicate.rewind();
|
|
+ ((Buffer)duplicate).rewind();
|
|
IO.copy(duplicate, out);
|
|
}
|
|
|
|
--- bnd-5.1.1.REL/biz.aQute.bndlib/src/aQute/bnd/classfile/UnrecognizedAttribute.java 2020-06-16 23:03:04.000000000 +0200
|
|
+++ bnd-5.1.1.REL/biz.aQute.bndlib/src/aQute/bnd/classfile/UnrecognizedAttribute.java 2021-10-18 08:14:58.714562788 +0200
|
|
@@ -3,6 +3,7 @@
|
|
import java.io.DataInput;
|
|
import java.io.DataOutput;
|
|
import java.io.IOException;
|
|
+import java.nio.Buffer;
|
|
import java.nio.ByteBuffer;
|
|
|
|
import aQute.lib.io.IO;
|
|
@@ -41,7 +42,7 @@
|
|
out.writeShort(attribute_name_index);
|
|
out.writeInt(attribute_length);
|
|
ByteBuffer duplicate = value.duplicate();
|
|
- duplicate.rewind();
|
|
+ ((Buffer)duplicate).rewind();
|
|
IO.copy(duplicate, out);
|
|
}
|
|
|
|
--- bnd-5.1.1.REL/biz.aQute.bndlib/src/aQute/bnd/osgi/Clazz.java 2020-06-16 23:03:04.000000000 +0200
|
|
+++ bnd-5.1.1.REL/biz.aQute.bndlib/src/aQute/bnd/osgi/Clazz.java 2021-10-18 07:36:37.475442949 +0200
|
|
@@ -23,6 +23,7 @@
|
|
import java.io.InputStream;
|
|
import java.lang.annotation.RetentionPolicy;
|
|
import java.lang.reflect.Modifier;
|
|
+import java.nio.Buffer;
|
|
import java.nio.ByteBuffer;
|
|
import java.util.ArrayDeque;
|
|
import java.util.Arrays;
|
|
@@ -1201,7 +1202,7 @@
|
|
|
|
private void processCode(CodeAttribute attribute, ElementType elementType) {
|
|
ByteBuffer code = attribute.code.duplicate();
|
|
- code.rewind();
|
|
+ ((Buffer)code).rewind();
|
|
int lastReference = -1;
|
|
while (code.hasRemaining()) {
|
|
int instruction = Byte.toUnsignedInt(code.get());
|
|
@@ -1248,7 +1249,7 @@
|
|
}
|
|
case OpCodes.wide : {
|
|
int opcode = Byte.toUnsignedInt(code.get());
|
|
- code.position(code.position() + (opcode == OpCodes.iinc ? 4 : 2));
|
|
+ ((Buffer)code).position(code.position() + (opcode == OpCodes.iinc ? 4 : 2));
|
|
lastReference = -1;
|
|
break;
|
|
}
|
|
@@ -1256,12 +1257,12 @@
|
|
// Skip to place divisible by 4
|
|
int rem = code.position() % 4;
|
|
if (rem != 0) {
|
|
- code.position(code.position() + 4 - rem);
|
|
+ ((Buffer)code).position(code.position() + 4 - rem);
|
|
}
|
|
int deflt = code.getInt();
|
|
int low = code.getInt();
|
|
int high = code.getInt();
|
|
- code.position(code.position() + (high - low + 1) * 4);
|
|
+ ((Buffer)code).position(code.position() + (high - low + 1) * 4);
|
|
lastReference = -1;
|
|
break;
|
|
}
|
|
@@ -1269,16 +1270,16 @@
|
|
// Skip to place divisible by 4
|
|
int rem = code.position() % 4;
|
|
if (rem != 0) {
|
|
- code.position(code.position() + 4 - rem);
|
|
+ ((Buffer)code).position(code.position() + 4 - rem);
|
|
}
|
|
int deflt = code.getInt();
|
|
int npairs = code.getInt();
|
|
- code.position(code.position() + npairs * 8);
|
|
+ ((Buffer)code).position(code.position() + npairs * 8);
|
|
lastReference = -1;
|
|
break;
|
|
}
|
|
default : {
|
|
- code.position(code.position() + OpCodes.OFFSETS[instruction]);
|
|
+ ((Buffer)code).position(code.position() + OpCodes.OFFSETS[instruction]);
|
|
lastReference = -1;
|
|
break;
|
|
}
|
|
@@ -1292,7 +1293,7 @@
|
|
|
|
private void visitCode(ClassDataCollector cd, CodeAttribute attribute, ElementType elementType) throws Exception {
|
|
ByteBuffer code = attribute.code.duplicate();
|
|
- code.rewind();
|
|
+ ((Buffer)code).rewind();
|
|
while (code.hasRemaining()) {
|
|
int instruction = Byte.toUnsignedInt(code.get());
|
|
switch (instruction) {
|
|
@@ -1309,7 +1310,7 @@
|
|
case OpCodes.invokeinterface : {
|
|
int method_ref_index = Short.toUnsignedInt(code.getShort());
|
|
visitReferenceMethod(cd, method_ref_index);
|
|
- code.position(code.position() + 2);
|
|
+ ((Buffer)code).position(code.position() + 2);
|
|
break;
|
|
}
|
|
case OpCodes.invokestatic : {
|
|
@@ -1319,34 +1320,34 @@
|
|
}
|
|
case OpCodes.wide : {
|
|
int opcode = Byte.toUnsignedInt(code.get());
|
|
- code.position(code.position() + (opcode == OpCodes.iinc ? 4 : 2));
|
|
+ ((Buffer)code).position(code.position() + (opcode == OpCodes.iinc ? 4 : 2));
|
|
break;
|
|
}
|
|
case OpCodes.tableswitch : {
|
|
// Skip to place divisible by 4
|
|
int rem = code.position() % 4;
|
|
if (rem != 0) {
|
|
- code.position(code.position() + 4 - rem);
|
|
+ ((Buffer)code).position(code.position() + 4 - rem);
|
|
}
|
|
int deflt = code.getInt();
|
|
int low = code.getInt();
|
|
int high = code.getInt();
|
|
- code.position(code.position() + (high - low + 1) * 4);
|
|
+ ((Buffer)code).position(code.position() + (high - low + 1) * 4);
|
|
break;
|
|
}
|
|
case OpCodes.lookupswitch : {
|
|
// Skip to place divisible by 4
|
|
int rem = code.position() % 4;
|
|
if (rem != 0) {
|
|
- code.position(code.position() + 4 - rem);
|
|
+ ((Buffer)code).position(code.position() + 4 - rem);
|
|
}
|
|
int deflt = code.getInt();
|
|
int npairs = code.getInt();
|
|
- code.position(code.position() + npairs * 8);
|
|
+ ((Buffer)code).position(code.position() + npairs * 8);
|
|
break;
|
|
}
|
|
default : {
|
|
- code.position(code.position() + OpCodes.OFFSETS[instruction]);
|
|
+ ((Buffer)code).position(code.position() + OpCodes.OFFSETS[instruction]);
|
|
break;
|
|
}
|
|
}
|
|
--- bnd-5.1.1.REL/biz.aQute.bndlib/src/aQute/bnd/osgi/Jar.java 2020-06-16 23:03:04.000000000 +0200
|
|
+++ bnd-5.1.1.REL/biz.aQute.bndlib/src/aQute/bnd/osgi/Jar.java 2021-10-18 07:40:21.304848650 +0200
|
|
@@ -13,6 +13,7 @@
|
|
import java.io.InputStream;
|
|
import java.io.OutputStream;
|
|
import java.net.URI;
|
|
+import java.nio.Buffer;
|
|
import java.nio.ByteBuffer;
|
|
import java.nio.file.FileVisitOption;
|
|
import java.nio.file.FileVisitResult;
|
|
@@ -1106,7 +1107,7 @@
|
|
if ((bb != null) && bb.hasArray()) {
|
|
for (MessageDigest d : digests) {
|
|
d.update(bb);
|
|
- bb.flip();
|
|
+ ((Buffer)bb).flip();
|
|
}
|
|
} else {
|
|
try (InputStream in = r.openInputStream()) {
|
|
--- bnd-5.1.1.REL/biz.aQute.bndlib/src/aQute/bnd/osgi/URLResource.java 2020-06-16 23:03:04.000000000 +0200
|
|
+++ bnd-5.1.1.REL/biz.aQute.bndlib/src/aQute/bnd/osgi/URLResource.java 2021-10-18 07:39:12.944410885 +0200
|
|
@@ -7,6 +7,7 @@
|
|
import java.net.MalformedURLException;
|
|
import java.net.URL;
|
|
import java.net.URLConnection;
|
|
+import java.nio.Buffer;
|
|
import java.nio.ByteBuffer;
|
|
import java.util.jar.JarFile;
|
|
|
|
@@ -48,7 +49,7 @@
|
|
return buffer = ByteBuffer.wrap(IO.read(in));
|
|
}
|
|
ByteBuffer bb = IO.copy(in, ByteBuffer.allocate(size));
|
|
- bb.flip();
|
|
+ ((Buffer)bb).flip();
|
|
return buffer = bb;
|
|
}
|
|
|
|
--- bnd-5.1.1.REL/biz.aQute.bndlib/src/aQute/bnd/osgi/ZipResource.java 2020-06-16 23:03:04.000000000 +0200
|
|
+++ bnd-5.1.1.REL/biz.aQute.bndlib/src/aQute/bnd/osgi/ZipResource.java 2021-10-18 07:37:53.975919239 +0200
|
|
@@ -6,6 +6,7 @@
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.OutputStream;
|
|
+import java.nio.Buffer;
|
|
import java.nio.ByteBuffer;
|
|
import java.nio.file.Path;
|
|
import java.util.zip.ZipEntry;
|
|
@@ -64,7 +65,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;
|
|
}
|
|
|
|
--- bnd-5.1.1.REL/biz.aQute.repository/src/aQute/maven/provider/POM.java 2020-06-16 23:03:04.000000000 +0200
|
|
+++ bnd-5.1.1.REL/biz.aQute.repository/src/aQute/maven/provider/POM.java 2021-10-18 07:49:09.756330007 +0200
|
|
@@ -3,6 +3,7 @@
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
+import java.nio.Buffer;
|
|
import java.nio.ByteBuffer;
|
|
import java.nio.channels.FileChannel;
|
|
import java.nio.charset.StandardCharsets;
|
|
@@ -147,7 +148,7 @@
|
|
try (FileChannel in = IO.readChannel(file.toPath())) {
|
|
ByteBuffer bb = ByteBuffer.allocate((int) in.size());
|
|
while (in.read(bb) > 0) {}
|
|
- bb.flip();
|
|
+ ((Buffer)bb).flip();
|
|
return processEntities(bb);
|
|
}
|
|
}
|