Message12690
Could indeed be an openjdk thing. More details:
Under OpenJDK 11
C:\Users\Adam\jython\jython5\jython>java -version
openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)
Before fix:
public void clear();
Code:
0: aload_0
1: getfield #5 // Field buffer:Ljava/nio/ByteBuffer;
4: invokevirtual #13 // Method java/nio/ByteBuffer.clear:()Ljava/nio/ByteBuffer;
7: iconst_0
8: invokevirtual #11 // Method java/nio/ByteBuffer.limit:(I)Ljava/nio/ByteBuffer;
11: pop
12: return
With fix
public void clear();
Code:
0: aload_0
1: getfield #5 // Field buffer:Ljava/nio/ByteBuffer;
4: invokestatic #13 // Method com/headius/backport9/buffer/Buffers.clearBuffer:(Ljava/nio/Buffer;)Ljava/nio/Buffer;
7: pop
8: aload_0
9: getfield #5 // Field buffer:Ljava/nio/ByteBuffer;
12: iconst_0
13: invokestatic #11 // Method com/headius/backport9/buffer/Buffers.limitBuffer:(Ljava/nio/Buffer;I)Ljava/nio/Buffer;
16: pop
17: return
As you can sort of see in the bytecode, the backport9 fix is to invoke statically, using a generic to always match the type signatures.
public class Buffers {
/**
* Invoke Buffer.clear always using Buffer as the target, to avoid binary incompatibility on Java 8.
*
*/
public static <T extends Buffer> T clearBuffer(T buf) {
return (T) buf.clear();
}
Jython 2.7.2a1+ (uncontrolled:+, Oct. 6 2019, 20:17:35)
[OpenJDK 64-Bit Server VM (Oracle Corporation)] on java11.0.1
Type "help", "copyright", "credits" or "license" for more information.
My Java 8 is indeed Oracle
:\Users\Adam\jython>java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode) |
|
Date |
User |
Action |
Args |
2019-10-06 10:28:26 | adamburke | set | messageid: <1570357706.68.0.442154573822.issue2810@roundup.psfhosted.org> |
2019-10-06 10:28:26 | adamburke | set | recipients:
+ adamburke, jeff.allen |
2019-10-06 10:28:26 | adamburke | link | issue2810 messages |
2019-10-06 10:28:26 | adamburke | create | |
|