Issue1558
Created on 2010-02-17.20:47:10 by MrMeanie, last changed 2010-07-20.05:20:31 by zyasoft.
msg5540 (view) |
Author: Geoffrey French (MrMeanie) |
Date: 2010-02-17.20:47:08 |
|
A Python function can be passed as a parameter to a Java method, where the corresponding argument is a single method interface. This is accomplished by having PyFunction.__tojava__ perform the conversion/wrapping.
While the resulting wrapped PyFunction works properly when the interface method is invoked, it malfunctions if the Java code attempts to access a method those defined in java.lang.Object, hashCode() or toString() for example.
I believe others have run into this difficulty.
I believe others have discovered that this can block the use of method specifically coded to accept PyFunctions or PyObjects - for example, given the two java methods:
void myMethod(PyFunction x);
void myMethod(SingleMethodInterface x);
The PyFunction.__tojava__() modification would result in the second method being chosen over the first, despite the fact that the first may be desirable.
Many Thanks.
Regards
Geoffrey French
|
msg5541 (view) |
Author: Nicholas Riley (nriley) |
Date: 2010-02-18.02:13:36 |
|
Attaching patch as permissions are currently broken.
|
msg5910 (view) |
Author: Jim Baker (zyasoft) |
Date: 2010-07-20.05:20:30 |
|
Tobias fixed this earlier, in r6982. As of r7081, added a simple test to verify that object methods like toString can be passed functions.
|
|
Date |
User |
Action |
Args |
2010-07-20 05:20:31 | zyasoft | set | status: open -> closed resolution: fixed messages:
+ msg5910 |
2010-04-26 01:27:48 | zyasoft | set | nosy:
+ zyasoft |
2010-04-11 02:13:15 | pjenvey | set | nosy:
+ thobes |
2010-02-18 15:32:29 | fwierzbicki | set | nosy:
+ fwierzbicki |
2010-02-18 02:13:38 | nriley | set | files:
+ Jython_r6980_PyFunction_tojava_patch_20100217_v1.patch keywords:
+ patch messages:
+ msg5541 nosy:
+ nriley |
2010-02-17 20:47:10 | MrMeanie | create | |
|