From: Philip C. <re...@bu...> - 2008-02-29 20:12:28
|
New submission from Philip Crotwell: If there is a method of the same name as both static and on the object, the static one can't be called. For example Class.getName() works on URL because there is no getName() object method, but toString() does not because there is both a object toString() in URL and a toString() on the Class object: crotwell$ java -jar output/lib/jython-2.2.1.jar Jython 2.2.1 on java1.5.0_13 Type "copyright", "credits" or "license" for more information. >>> from java.net import URL >>> URL.getName() 'java.net.URL' >>> URL.toString() Traceback (innermost last): File "<console>", line 1, in ? TypeError: toString(): expected 1 args; got 0 >>> Interestingly, the str() function seems to find the toString on the class: >>> str(URL) 'java.net.URL' ---------- components: Core messages: 3057 nosy: crotwell severity: normal status: open title: static java methods on class hidden by object methods versions: 2.2.2 _______________________________________ Jython tracker <re...@bu...> <http://bugs.jython.org/issue1002> _______________________________________ |