Issue1761748

classification
Title: Patch for [ 1748817 ] Python __repr__ added to Java class is
Type: Severity: normal
Components: None Versions:
Milestone:
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: cgroves, ukeshav
Priority: normal Keywords: patch

Created on 2007-07-27.04:26:53 by ukeshav, last changed 2007-07-30.02:45:36 by cgroves.

Files
File name Uploaded Description Edit Remove
PyJavaInstance.patch ukeshav, 2007-07-27.04:26:53 patch
Messages
msg2759 (view) Author: keshav upadhyaya (ukeshav) Date: 2007-07-27.04:26:53
Hi i have Done some changes in PyJavaInstance.java and it   tried with test cases and it works fine now . Please look at the attached patch below.
msg2760 (view) Author: Charlie Groves (cgroves) Date: 2007-07-30.02:45:36
Instead of using the code in this patch, I implemented this by having the superclass of PyJavaInstance, PyInstance, defer to a method makeDefaultRepr in its __repr__ if the class represented by that PyInstance doesn't define a custom __repr__ method.  Then I overrode the new method in PyJavaInstance to provide the Java instance specific behavior of calling toString on the javaProxy.

This has a couple benefits over the code in the patch.  It doesn't recreate a lot of the code already in PyInstance to conditionally call a method on a class that the patch has in the __finditem__ then __finditem__.__call__ section.  It also correctly chains calls from __str__ to __repr__ if __str__ doesn't exist instead of the other way around.  This was wrong in PyJavaInstance as it stood, but it didn't matter up until now since __str__ and __repr__ were always identical.
History
Date User Action Args
2007-07-27 04:26:53ukeshavcreate