jna/jna-java8compat.patch

137 lines
5.4 KiB
Diff
Raw Normal View History

--- jna-5.13.0/build.xml 2023-05-30 15:30:31.116195853 +0200
+++ jna-5.13.0/build.xml 2023-05-30 15:31:56.400786710 +0200
@@ -106,8 +106,14 @@
JDK 11 is the last JDK, that supports creation of Java 6 compatible class
files.
-->
- <condition property="compatibility" value="1.6" else="9">
+ <condition property="compatibility" value="1.8" else="9">
+ <or>
<matches pattern="^1\.\d+$" string="${ant.java.version}"/>
+ <matches pattern="^9.*$" string="${ant.java.version}"/>
+ <matches pattern="^1.*$$" string="${ant.java.version}"/>
+ <matches pattern="^20.*$$" string="${ant.java.version}"/>
+ <matches pattern="^21.*$$" string="${ant.java.version}"/>
+ </or>
</condition>
<condition property="compatibility-check" value="true">
--- jna-5.13.0/contrib/platform/src/com/sun/jna/platform/mac/XAttrUtil.java 2023-05-30 15:30:31.140196020 +0200
+++ jna-5.13.0/contrib/platform/src/com/sun/jna/platform/mac/XAttrUtil.java 2023-05-30 15:30:47.452309013 +0200
@@ -23,6 +23,7 @@
*/
package com.sun.jna.platform.mac;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.util.ArrayList;
@@ -102,11 +103,11 @@
bb.mark(); // first key starts from here
while (bb.hasRemaining()) {
if (bb.get() == 0) {
- ByteBuffer nameBuffer = (ByteBuffer) bb.duplicate().limit(bb.position() - 1).reset();
+ ByteBuffer nameBuffer = (ByteBuffer) ((Buffer)(bb.duplicate())).limit(bb.position() - 1).reset();
if (nameBuffer.hasRemaining()) {
names.add(decodeString(nameBuffer));
}
- bb.mark(); // next key starts from here
+ ((Buffer)bb).mark(); // next key starts from here
}
}
--- jna-5.13.0/test/com/sun/jna/BufferArgumentsMarshalTest.java 2023-05-30 15:30:31.288197044 +0200
+++ jna-5.13.0/test/com/sun/jna/BufferArgumentsMarshalTest.java 2023-05-30 15:30:47.452309013 +0200
@@ -23,6 +23,7 @@
*/
package com.sun.jna;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.DoubleBuffer;
@@ -108,7 +109,7 @@
for (int i=0;i < buf.capacity();i++) {
assertEquals("Bad value at index " + i, MAGIC, buf.get(i));
}
- buf.position(512);
+ ((Buffer)buf).position(512);
lib.fillInt8Buffer(buf, 512, (byte)0);
for (int i=0;i < buf.capacity();i++) {
assertEquals("Bad value at index " + i,
--- jna-5.13.0/test/com/sun/jna/PerformanceTest.java 2023-05-30 15:30:31.288197044 +0200
+++ jna-5.13.0/test/com/sun/jna/PerformanceTest.java 2023-05-30 15:30:47.452309013 +0200
@@ -396,7 +396,7 @@
start = System.currentTimeMillis();
for (int i=0;i < COUNT;i++) {
byte[] bytes = str.getBytes();
- b.position(0);
+ ((Buffer)b).position(0);
b.put(bytes);
b.put((byte)0);
int iresult = CLibrary.strlen(b);
@@ -413,7 +413,7 @@
for (int i=0;i < COUNT;i++) {
b.putInt(8, (int)pb.peer + 12);
b.putInt(12, (int)pb.peer + 16);
- b.position(16);
+ ((Buffer)b).position(16);
// This operation is very expensive!
b.put(str.getBytes());
b.put((byte)0);
@@ -454,7 +454,7 @@
start = System.currentTimeMillis();
for (int i=0;i < COUNT;i++) {
- b.position(0);
+ ((Buffer)b).position(0);
b.put(bulk);
}
delta = System.currentTimeMillis() - start;
--- jna-5.13.0/test/com/sun/jna/PointerBufferTest.java 2023-05-30 15:30:31.288197044 +0200
+++ jna-5.13.0/test/com/sun/jna/PointerBufferTest.java 2023-05-30 15:30:47.452309013 +0200
@@ -24,6 +24,7 @@
package com.sun.jna;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.DoubleBuffer;
@@ -42,7 +43,7 @@
final String ENCODING = "utf8";
Memory m = new Memory(1024);
ByteBuffer buf = m.getByteBuffer(0, m.size()).order(ByteOrder.nativeOrder());
- buf.put(MAGIC.getBytes(ENCODING)).put((byte) 0).flip();
+ ((Buffer)(buf.put(MAGIC.getBytes(ENCODING)).put((byte) 0))).flip();
assertEquals("String not written to memory", MAGIC,
m.getString(0, ENCODING));
}
@@ -50,7 +51,7 @@
final byte MAGIC = (byte)0xED;
Memory m = new Memory(8);
ByteBuffer buf = m.getByteBuffer(0, m.size()).order(ByteOrder.nativeOrder());
- buf.put(MAGIC).flip();
+ ((Buffer)(buf.put(MAGIC))).flip();
assertEquals("Byte not written to memory", MAGIC,
m.getByte(0));
}
@@ -58,7 +59,7 @@
final int MAGIC = 0xABEDCF23;
Memory m = new Memory(8);
ByteBuffer buf = m.getByteBuffer(0, m.size()).order(ByteOrder.nativeOrder());
- buf.putInt(MAGIC).flip();
+ ((Buffer)(buf.putInt(MAGIC))).flip();
assertEquals("Int not written to memory", MAGIC,
m.getInt(0));
}
@@ -66,7 +67,7 @@
final long MAGIC = 0x1234567887654321L;
Memory m = new Memory(8);
ByteBuffer buf = m.getByteBuffer(0, m.size()).order(ByteOrder.nativeOrder());
- buf.putLong(MAGIC).flip();
+ ((Buffer)(buf.putLong(MAGIC))).flip();
assertEquals("Long not written to memory", MAGIC,
m.getLong(0));
}