Issue1338
Created on 2009-05-05.06:22:26 by MrMeanie, last changed 2009-05-29.02:35:03 by pjenvey.
msg4633 (view) |
Author: Geoffrey French (MrMeanie) |
Date: 2009-05-05.06:21:47 |
|
When two Java objects 'a' and 'b' are compared in Python with the ==
Python operator, and the class of 'b' is not a subclass of the class of
'a', the Java equals method on 'a' receives a PySingleton, representing
an error.
This is caused by the __eq__ implementation provided by PyJavaType
unwrapping the 'b' object, and asking for it to be cast to the same type
as 'a'.
This can be demonstrated by constructing a java.util.ArrayList and a
java.util.Vector, both with the same contents, and comparing them.
Using the 'equals()' method from the Jython shell will result in True,
but using == will result in 'False'.
|
msg4634 (view) |
Author: Geoffrey French (MrMeanie) |
Date: 2009-05-05.06:26:47 |
|
Please find attached a unit test that demonstrates this issue.
|
msg4635 (view) |
Author: Geoffrey French (MrMeanie) |
Date: 2009-05-05.06:29:40 |
|
Please find attached a patch that fixes this issue.
|
msg4638 (view) |
Author: Philip Jenvey (pjenvey) |
Date: 2009-05-06.02:44:07 |
|
Does this survive the regrtest?
Also I think we want:
Object oProxy = o.getProxy();
instead of
Object oAsJava = o.__tojava__(Object.class);
They should result in the same result while the former is slightly more
efficient
|
msg4639 (view) |
Author: Philip Jenvey (pjenvey) |
Date: 2009-05-06.02:45:12 |
|
Also the __ne__ below it needs the same fix and a test
|
msg4738 (view) |
Author: Geoffrey French (MrMeanie) |
Date: 2009-05-28.13:37:35 |
|
Please find attached a patch that:
- Uses getJavaProxy() instead of __tojava__(Object.class) as suggested
by pjenvey
- Applies the fix to __ne__() too
- Adds the unit test to test_java_integration
These modifications make no different to the output of the other
regression tests.
|
msg4754 (view) |
Author: Philip Jenvey (pjenvey) |
Date: 2009-05-29.02:35:02 |
|
applied in r6418, thanks!
|
|
Date |
User |
Action |
Args |
2009-05-29 02:35:03 | pjenvey | set | status: open -> closed resolution: fixed messages:
+ msg4754 |
2009-05-29 01:06:16 | pjenvey | set | assignee: pjenvey |
2009-05-28 13:37:37 | MrMeanie | set | files:
+ Issue1338_equals_fix_v2_20090528.patch messages:
+ msg4738 |
2009-05-06 02:45:12 | pjenvey | set | messages:
+ msg4639 |
2009-05-06 02:44:08 | pjenvey | set | nosy:
+ pjenvey messages:
+ msg4638 |
2009-05-05 20:07:34 | fwierzbicki | set | nosy:
+ fwierzbicki |
2009-05-05 06:30:02 | MrMeanie | set | files:
+ Issue1338_equals_fix_v1_20090505.patch keywords:
+ patch messages:
+ msg4635 |
2009-05-05 06:27:36 | MrMeanie | set | files:
+ Bug1338_test.py messages:
+ msg4634 |
2009-05-05 06:22:27 | MrMeanie | create | |
|