diff --git a/jnius/jnius_conversion.pxi b/jnius/jnius_conversion.pxi index 000d0ec..488e576 100644 --- a/jnius/jnius_conversion.pxi +++ b/jnius/jnius_conversion.pxi @@ -270,7 +270,7 @@ cdef convert_jarray_to_python(JNIEnv *j_env, definition, jobject j_object): elif r == 'J': j_longs = j_env[0].GetLongArrayElements( j_env, j_object, &iscopy) - ret = [(j_longs[i]) for i in range(array_size)] + ret = [(j_longs[i]) for i in range(array_size)] j_env[0].ReleaseLongArrayElements( j_env, j_object, j_longs, 0) diff --git a/jnius/jnius_export_class.pxi b/jnius/jnius_export_class.pxi index 00242de..15f9ce7 100644 --- a/jnius/jnius_export_class.pxi +++ b/jnius/jnius_export_class.pxi @@ -439,7 +439,7 @@ cdef class JavaField(object): elif r == 'J': j_long = j_env[0].GetLongField( j_env, j_self, self.j_field) - ret = j_long + ret = j_long elif r == 'F': j_float = j_env[0].GetFloatField( j_env, j_self, self.j_field) @@ -510,7 +510,7 @@ cdef class JavaField(object): elif r == 'J': j_long = j_env[0].GetStaticLongField( j_env, self.j_cls, self.j_field) - ret = j_long + ret = j_long elif r == 'F': j_float = j_env[0].GetStaticFloatField( j_env, self.j_cls, self.j_field) @@ -697,7 +697,7 @@ cdef class JavaMethod(object): with nogil: j_long = j_env[0].CallLongMethodA( j_env, j_self, self.j_method, j_args) - ret = j_long + ret = j_long elif r == 'F': with nogil: j_float = j_env[0].CallFloatMethodA( @@ -785,7 +785,7 @@ cdef class JavaMethod(object): with nogil: j_long = j_env[0].CallStaticLongMethodA( j_env, self.j_cls, self.j_method, j_args) - ret = j_long + ret = j_long elif r == 'F': with nogil: j_float = j_env[0].CallStaticFloatMethodA( diff --git a/tests/java-src/org/jnius/BasicsTest.java b/tests/java-src/org/jnius/BasicsTest.java index 9fa4abf..b1d7802 100644 --- a/tests/java-src/org/jnius/BasicsTest.java +++ b/tests/java-src/org/jnius/BasicsTest.java @@ -8,7 +8,7 @@ public class BasicsTest { static public char methodStaticC() { return 'k'; }; static public short methodStaticS() { return 32767; }; static public int methodStaticI() { return 2147483467; }; - static public long methodStaticJ() { return 2147483467; }; + static public long methodStaticJ() { return 9223372036854775807L; }; static public float methodStaticF() { return 1.23456789f; }; static public double methodStaticD() { return 1.23456789; }; static public String methodStaticString() { return new String("helloworld"); } @@ -18,7 +18,7 @@ public class BasicsTest { public char methodC() { return 'k'; }; public short methodS() { return 32767; }; public int methodI() { return 2147483467; }; - public long methodJ() { return 2147483467; }; + public long methodJ() { return 9223372036854775807L; }; public float methodF() { return 1.23456789f; }; public double methodD() { return 1.23456789; }; public String methodString() { return new String("helloworld"); } @@ -39,7 +39,7 @@ public class BasicsTest { static public char fieldStaticC = 'k'; static public short fieldStaticS = 32767; static public int fieldStaticI = 2147483467; - static public long fieldStaticJ = 2147483467; + static public long fieldStaticJ = 9223372036854775807L; static public float fieldStaticF = 1.23456789f; static public double fieldStaticD = 1.23456789; static public String fieldStaticString = new String("helloworld"); @@ -49,7 +49,7 @@ public class BasicsTest { public char fieldC = 'k'; public short fieldS = 32767; public int fieldI = 2147483467; - public long fieldJ = 2147483467; + public long fieldJ = 9223372036854775807L; public float fieldF = 1.23456789f; public double fieldD = 1.23456789; public String fieldString = new String("helloworld"); @@ -99,7 +99,7 @@ public class BasicsTest { }; public long[] methodArrayJ() { long[] x = new long[3]; - x[0] = x[1] = x[2] = 2147483467; + x[0] = x[1] = x[2] = 9223372036854775807L; return x; }; public float[] methodArrayF() { @@ -122,7 +122,7 @@ public class BasicsTest { public boolean methodParamsZBCSIJFD(boolean x1, byte x2, char x3, short x4, int x5, long x6, float x7, double x8) { return (x1 == true && x2 == 127 && x3 == 'k' && x4 == 32767 && - x5 == 2147483467 && x6 == 2147483467 && + x5 == 2147483467 && x6 == 9223372036854775807L && (Math.abs(x7 - 1.23456789f) < EPSILON) && (Math.abs(x8 - 1.23456789) < EPSILON)); } @@ -196,7 +196,7 @@ public class BasicsTest { } public boolean testFieldSetJ() { - return (fieldSetJ == 2147483467); + return (fieldSetJ == 9223372036854775807L); } public boolean testFieldSetF() { diff --git a/tests/test_basics.py b/tests/test_basics.py index d6ebd5c..d6a5fb8 100644 --- a/tests/test_basics.py +++ b/tests/test_basics.py @@ -13,7 +13,7 @@ class BasicsTest(unittest.TestCase): self.assertEquals(Test.methodStaticC(), 'k') self.assertEquals(Test.methodStaticS(), 32767) self.assertEquals(Test.methodStaticI(), 2147483467) - self.assertEquals(Test.methodStaticJ(), 2147483467) + self.assertEquals(Test.methodStaticJ(), 9223372036854775807) self.assertAlmostEquals(Test.methodStaticF(), 1.23456789) self.assertEquals(Test.methodStaticD(), 1.23456789) self.assertEquals(Test.methodStaticString(), 'helloworld') @@ -25,7 +25,7 @@ class BasicsTest(unittest.TestCase): self.assertEquals(Test.fieldStaticC, 'k') self.assertEquals(Test.fieldStaticS, 32767) self.assertEquals(Test.fieldStaticI, 2147483467) - self.assertEquals(Test.fieldStaticJ, 2147483467) + self.assertEquals(Test.fieldStaticJ, 9223372036854775807) self.assertAlmostEquals(Test.fieldStaticF, 1.23456789) self.assertEquals(Test.fieldStaticD, 1.23456789) self.assertEquals(Test.fieldStaticString, 'helloworld') @@ -37,7 +37,7 @@ class BasicsTest(unittest.TestCase): self.assertEquals(test.methodC(), 'k') self.assertEquals(test.methodS(), 32767) self.assertEquals(test.methodI(), 2147483467) - self.assertEquals(test.methodJ(), 2147483467) + self.assertEquals(test.methodJ(), 9223372036854775807) self.assertAlmostEquals(test.methodF(), 1.23456789) self.assertEquals(test.methodD(), 1.23456789) self.assertEquals(test.methodString(), 'helloworld') @@ -49,7 +49,7 @@ class BasicsTest(unittest.TestCase): self.assertEquals(test.fieldC, 'k') self.assertEquals(test.fieldS, 32767) self.assertEquals(test.fieldI, 2147483467) - self.assertEquals(test.fieldJ, 2147483467) + self.assertEquals(test.fieldJ, 9223372036854775807) self.assertAlmostEquals(test.fieldF, 1.23456789) self.assertEquals(test.fieldD, 1.23456789) self.assertEquals(test.fieldString, 'helloworld') @@ -65,7 +65,7 @@ class BasicsTest(unittest.TestCase): test.fieldSetC = ord('k') test.fieldSetS = 32767 test.fieldSetI = 2147483467 - test.fieldSetJ = 2147483467 + test.fieldSetJ = 9223372036854775807 test.fieldSetF = 1.23456789 test.fieldSetD = 1.23456789 @@ -86,7 +86,7 @@ class BasicsTest(unittest.TestCase): self.assertEquals(test.methodArrayC(), ['k'] * 3) self.assertEquals(test.methodArrayS(), [32767] * 3) self.assertEquals(test.methodArrayI(), [2147483467] * 3) - self.assertEquals(test.methodArrayJ(), [2147483467] * 3) + self.assertEquals(test.methodArrayJ(), [9223372036854775807] * 3) ret = test.methodArrayF() ref = [1.23456789] * 3 @@ -100,7 +100,7 @@ class BasicsTest(unittest.TestCase): def test_instances_methods_params(self): test = autoclass('org.jnius.BasicsTest')() self.assertEquals(test.methodParamsZBCSIJFD( - True, 127, 'k', 32767, 2147483467, 2147483467, 1.23456789, 1.23456789), True) + True, 127, 'k', 32767, 2147483467, 9223372036854775807, 1.23456789, 1.23456789), True) self.assertEquals(test.methodParamsString('helloworld'), True) self.assertEquals(test.methodParamsArrayI([1, 2, 3]), True) self.assertEquals(test.methodParamsArrayString([