This commit is contained in:
138
jna-java8compat.patch
Normal file
138
jna-java8compat.patch
Normal file
@@ -0,0 +1,138 @@
|
||||
diff -urEbwB jna-5.4.0/build.xml jna-5.4.0.new/build.xml
|
||||
--- jna-5.4.0/build.xml 2019-07-19 21:22:03.000000000 +0200
|
||||
+++ jna-5.4.0.new/build.xml 2019-10-10 21:47:22.950356404 +0200
|
||||
@@ -102,7 +102,12 @@
|
||||
files.
|
||||
-->
|
||||
<condition property="compatibility" value="1.6" else="9">
|
||||
+ <or>
|
||||
<matches pattern="^1\.\d+$" string="${ant.java.version}"/>
|
||||
+ <matches pattern="^9.*$" string="${ant.java.version}"/>
|
||||
+ <matches pattern="^10.*$$" string="${ant.java.version}"/>
|
||||
+ <matches pattern="^11.*$$" string="${ant.java.version}"/>
|
||||
+ </or>
|
||||
</condition>
|
||||
|
||||
<condition property="compatibility-check" value="true">
|
||||
diff -urEbwB jna-5.4.0/contrib/platform/src/com/sun/jna/platform/mac/XAttrUtil.java jna-5.4.0.new/contrib/platform/src/com/sun/jna/platform/mac/XAttrUtil.java
|
||||
--- jna-5.4.0/contrib/platform/src/com/sun/jna/platform/mac/XAttrUtil.java 2019-07-19 21:22:03.000000000 +0200
|
||||
+++ jna-5.4.0.new/contrib/platform/src/com/sun/jna/platform/mac/XAttrUtil.java 2019-10-10 21:37:54.962613364 +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
|
||||
}
|
||||
}
|
||||
|
||||
diff -urEbwB jna-5.4.0/test/com/sun/jna/BufferArgumentsMarshalTest.java jna-5.4.0.new/test/com/sun/jna/BufferArgumentsMarshalTest.java
|
||||
--- jna-5.4.0/test/com/sun/jna/BufferArgumentsMarshalTest.java 2019-07-19 21:22:03.000000000 +0200
|
||||
+++ jna-5.4.0.new/test/com/sun/jna/BufferArgumentsMarshalTest.java 2019-10-10 21:28:39.574890668 +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,
|
||||
diff -urEbwB jna-5.4.0/test/com/sun/jna/PerformanceTest.java jna-5.4.0.new/test/com/sun/jna/PerformanceTest.java
|
||||
--- jna-5.4.0/test/com/sun/jna/PerformanceTest.java 2019-07-19 21:22:03.000000000 +0200
|
||||
+++ jna-5.4.0.new/test/com/sun/jna/PerformanceTest.java 2019-10-10 21:26:21.041920761 +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;
|
||||
diff -urEbwB jna-5.4.0/test/com/sun/jna/PointerBufferTest.java jna-5.4.0.new/test/com/sun/jna/PointerBufferTest.java
|
||||
--- jna-5.4.0/test/com/sun/jna/PointerBufferTest.java 2019-07-19 21:22:03.000000000 +0200
|
||||
+++ jna-5.4.0.new/test/com/sun/jna/PointerBufferTest.java 2019-10-10 21:21:33.152310989 +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));
|
||||
}
|
@@ -21,9 +21,12 @@ Thu Oct 10 18:33:20 UTC 2019 - Fridrich Strba <fstrba@suse.com>
|
||||
* jna-build.patch
|
||||
* jna-callback.patch
|
||||
+ Adapted to changed context
|
||||
- Added patch:
|
||||
- Added patches:
|
||||
* jna-system-libjnidispatch.patch
|
||||
+ Load the libjnidispatch from system
|
||||
* jna-java8compat.patch
|
||||
+ Add casts to prevent using of java9+ only ByteBuffer
|
||||
methods
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Mar 13 19:03:23 UTC 2019 - Fridrich Strba <fstrba@suse.com>
|
||||
|
3
jna.spec
3
jna.spec
@@ -28,6 +28,7 @@ Source1000: %{name}-rpmlintrc
|
||||
Patch0: jna-build.patch
|
||||
Patch1: jna-callback.patch
|
||||
Patch2: jna-system-libjnidispatch.patch
|
||||
Patch3: jna-java8compat.patch
|
||||
BuildRequires: ant
|
||||
BuildRequires: ant-junit
|
||||
BuildRequires: dos2unix
|
||||
@@ -38,7 +39,6 @@ BuildRequires: junit
|
||||
BuildRequires: libffi-devel
|
||||
BuildRequires: xorg-x11-libX11-devel
|
||||
BuildRequires: xorg-x11-libXt-devel
|
||||
BuildConflicts: java-devel >= 9
|
||||
Requires: java >= 1.8
|
||||
Provides: jna-native = %{version}-%{release}
|
||||
Obsoletes: jna-native < %{version}-%{release}
|
||||
@@ -78,6 +78,7 @@ dos2unix OTHERS
|
||||
%patch0 -p1 -b .orig
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
|
||||
sed -i 's|@LIBDIR@|%{_libdir}/%{name}|' src/com/sun/jna/Native.java
|
||||
|
||||
|
Reference in New Issue
Block a user