Issue222871

classification
Title: getName conflicts/weirdness
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: bckfnn
Priority: low Keywords:

Created on 2000-11-18.19:44:29 by bckfnn, last changed 2000-11-18.23:16:25 by bckfnn.

Messages
msg191 (view) Author: Finn Bock (bckfnn) Date: 2000-11-18.19:44:29
For some reason, if a Java class defines a method 'public String getName()',
then
it breaks the getName() method on its class object.  For example, the following
program:

import java.awt.Button

b = java.awt.Button('hi')
c = b.getClass()
print c
print c.getName()

Fails with the output:

java.awt.Button
Traceback (innermost last):
  File "/tmp/bug.py", line 6, in ?
TypeError: getName(): expected 1 args; got 0

Other methods of the class object work (e.g., getDeclaredConstructors()), and
b.getName() works.

I have no idea of a cause or solution (although in my case it's easy to work
around
since "'%s' % c" gives me the name of the class).

msg192 (view) Author: Finn Bock (bckfnn) Date: 2000-11-18.23:16:25
Not a bug. JPython doesn't have separate class/instance namespaces. The workaround is to use java.lang.Class.getName(cls)
History
Date User Action Args
2000-11-18 19:44:29bckfnncreate