From: <bc...@wo...> - 2001-11-02 15:46:59
|
[dman] >I'm trying to use Jython(c) to allow using Moshe Zadka's PMS framework >along with a Java/Swing GUI for a school project. (The other group >members are writing the gui and they don't know python) I've run into >a couple of problems, though, all related to java's type system. > >There are several modules in the PMS package. I have taken the base >classes of the inheritance tree and made them inherit from >java.lang.Object and added the @sig lines. A simplified example : > >----- PMS/AbstractFolder.py >class AbstractFolder( java.lang.Object ) : pass > >----- PMS/Folder.py >import AbstractFolder >class Folder( AbstractFolder.AbstractFolder ) : pass > > >I also have the following class as a factory for the GUI to create a >hardcoded folder for the prototype demo. > >----- DemoFolder1.py >class DemoFolder1( java.lang.Object ) : > def make( self , name ) : > """ > @sig public Object make( String name ) > """ > > server = PMS.MaildirServer.MaildirServer( "server_name" , "." ) > PMS.Configuration.Configuration().servers[ server ] = lambda x : x > folder = PMS.Folder.Folder( server , name ) > folder.create() > > print folder.__class__ # correctly prints "PMS.Folder.Folder" > return folder > > > >I used jythonc to compile the stuff, and everything compiles fine. >The Java code that uses this looks like : > > > Object folder = (new DemoFolder1()).make( "Demo1" ); > MailMessage.Message message = new MailMessage.Message(); > > // This line prints out > // org.python.proxies.PMS.Folder$Folder$2 > System.out.println( folder.getClass() ) ; The strange classname comes from the dynamic proxy generation. Verify if jythonc created a java class for the Folder class. You check that in the stdout from jythonc where there should be a line like: Folder extends java.lang.Object If no such line is written, it is because jythonc failed to detect that Folder is a java subclass. regards, finn |