[Jython-checkins] jython: Respond to deprecation warnings in ASM and JFFI.

jeff.allen jython-checkins at python.org
Fri Dec 28 10:42:04 EST 2018


https://hg.python.org/jython/rev/d18511485bd5
changeset:   8207:d18511485bd5
user:        Jeff Allen <ja.py at farowl.co.uk>
date:        Thu Dec 27 14:08:48 2018 +0000
summary:
  Respond to deprecation warnings in ASM and JFFI.

Mechanical replacement of calls with (what seems to be) the intended
alternative. Regression tests have run ok.

files:
  src/org/python/expose/generate/NewExposer.java       |   2 +-
  src/org/python/modules/jffi/SkinnyMethodAdapter.java |  15 ++++++---
  src/org/python/modules/jffi/StructLayout.java        |   4 +-
  3 files changed, 13 insertions(+), 8 deletions(-)


diff --git a/src/org/python/expose/generate/NewExposer.java b/src/org/python/expose/generate/NewExposer.java
--- a/src/org/python/expose/generate/NewExposer.java
+++ b/src/org/python/expose/generate/NewExposer.java
@@ -50,7 +50,7 @@
         mv.visitVarInsn(ALOAD, 2);
         mv.visitVarInsn(ALOAD, 3);
         mv.visitVarInsn(ALOAD, 4);
-        mv.visitMethodInsn(INVOKESTATIC, onType.getInternalName(), name, NEW_DESCRIPTOR);
+        mv.visitMethodInsn(INVOKESTATIC, onType.getInternalName(), name, NEW_DESCRIPTOR, false);
         endMethod(ARETURN);
     }
 
diff --git a/src/org/python/modules/jffi/SkinnyMethodAdapter.java b/src/org/python/modules/jffi/SkinnyMethodAdapter.java
--- a/src/org/python/modules/jffi/SkinnyMethodAdapter.java
+++ b/src/org/python/modules/jffi/SkinnyMethodAdapter.java
@@ -153,19 +153,19 @@
     }
     
     public void invokestatic(String arg1, String arg2, String arg3) {
-        getMethodVisitor().visitMethodInsn(INVOKESTATIC, arg1, arg2, arg3);
+        getMethodVisitor().visitMethodInsn(INVOKESTATIC, arg1, arg2, arg3, false);
     }
     
     public void invokespecial(String arg1, String arg2, String arg3) {
-        getMethodVisitor().visitMethodInsn(INVOKESPECIAL, arg1, arg2, arg3);
+        getMethodVisitor().visitMethodInsn(INVOKESPECIAL, arg1, arg2, arg3, false);
     }
     
     public void invokevirtual(String arg1, String arg2, String arg3) {
-        getMethodVisitor().visitMethodInsn(INVOKEVIRTUAL, arg1, arg2, arg3);
+        getMethodVisitor().visitMethodInsn(INVOKEVIRTUAL, arg1, arg2, arg3, false);
     }
     
     public void invokeinterface(String arg1, String arg2, String arg3) {
-        getMethodVisitor().visitMethodInsn(INVOKEINTERFACE, arg1, arg2, arg3);
+        getMethodVisitor().visitMethodInsn(INVOKEINTERFACE, arg1, arg2, arg3, true);
     }
 
     public void aprintln() {
@@ -840,8 +840,13 @@
         getMethodVisitor().visitFieldInsn(arg0, arg1, arg2, arg3);
     }
 
+    @Deprecated
     public void visitMethodInsn(int arg0, String arg1, String arg2, String arg3) {
-        getMethodVisitor().visitMethodInsn(arg0, arg1, arg2, arg3);
+        getMethodVisitor().visitMethodInsn(arg0, arg1, arg2, arg3, arg0 == Opcodes.INVOKEINTERFACE);
+    }
+
+    public void visitMethodInsn(int arg0, String arg1, String arg2, String arg3, boolean arg4) {
+        getMethodVisitor().visitMethodInsn(arg0, arg1, arg2, arg3, arg4);
     }
 
     public void visitJumpInsn(int arg0, Label arg1) {
diff --git a/src/org/python/modules/jffi/StructLayout.java b/src/org/python/modules/jffi/StructLayout.java
--- a/src/org/python/modules/jffi/StructLayout.java
+++ b/src/org/python/modules/jffi/StructLayout.java
@@ -140,8 +140,8 @@
             }
 
             com.kenai.jffi.Type jffiType = isUnion
-                    ? new com.kenai.jffi.Union(fieldTypes)
-                    : new com.kenai.jffi.Struct(fieldTypes);
+                    ? com.kenai.jffi.Union.newUnion(fieldTypes)
+                    : com.kenai.jffi.Struct.newStruct(fieldTypes);
 
             return new StructLayout(fields, jffiType, MemoryOp.INVALID);
         }

-- 
Repository URL: https://hg.python.org/jython


More information about the Jython-checkins mailing list