Message3057

Author crotwell
Recipients crotwell
Date 2008-02-29.20:12:23
SpamBayes Score 0.011961705
Marked as misclassified No
Message-id <1204315944.13.0.112053891956.issue1002@psf.upfronthosting.co.za>
In-reply-to
Content
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'
History
Date User Action Args
2008-02-29 20:12:24crotwellsetspambayes_score: 0.0119617 -> 0.011961705
recipients: + crotwell
2008-02-29 20:12:24crotwellsetspambayes_score: 0.0119617 -> 0.0119617
messageid: <1204315944.13.0.112053891956.issue1002@psf.upfronthosting.co.za>
2008-02-29 20:12:24crotwelllinkissue1002 messages
2008-02-29 20:12:23crotwellcreate