|
From: Kent J. <kjo...@tr...> - 2001-04-02 16:26:17
|
Hello,
I am having a problem in Jython-2.1a1 subclassing a Java class that
has overloaded methods.
The setup is a little complicated.
I have a Java class SortedProperties with a nested class
IteratorCallback. IteratorCallback has these two methods:
class IteratorCallback {
public void startLanguagePair(SortedProperties.LanguagePair inPair)
{
// Forward to two-argument version
startLanguagePair(inPair.text, inPair.userClass);
}
public void startLanguagePair(String inName, String inUserClass)
{
// Default implementation does nothing
}
}
SortedProperties has a method iterate(IteratorCallback, boolean) that
calls the one-argument startLanguagePair.
I am using this in a jython servlet using PyServlet. Here is the
callback class:
class Titlelister(SortedProperties.IteratorCallback):
def __init__(self, inPage):
self.page = inPage
def startLanguagePair(self, inPair):
self.page.add(Heading(2, inPair.text))
# def startLanguagePair(self, inText, inUserClass):
# self.page.add(Heading(2, inText))
This version, using the one-argument startLanguagePair, works fine.
If I comment out the first startLanguagePair and uncomment the second
one, I get the error
File ".\FileBase\jython\TitleTest.py", line 28, in doGet
TypeError: startLanguagePair() takes at least 3 arguments (2 given)
line 28 is
sortedProps.iterate(Titlelister(page), 0)
It looks like the jython call mechanism is missing the base class
method somehow.
I'm not sure if I am doing something wrong or if there is a bug here.
Kent Johnson Transparent Language, Inc.
kjo...@tr... http://www.transparent.com
|