From: dman <ds...@ri...> - 2001-11-01 23:45:10
|
Hi all. This probably isn't appropriate for the -dev list, but too frequently I don't get a response on the -users list. 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() ) ; try { ((Folder)folder).save_message( message ); } catch ( Exception err ) { // I get a ClassCastException here } Even though the Python factory returns an object that should match the generated java class, it doesn't match and java can't handle it. I also tried : Folder f = new Folder( new MaildirServer( "name" , "." ) , "Demo2" ) ; f.save_message( message ) ; This works if I write it in Python, but written in Java gives : Exception occurred during event dispatching: Traceback (innermost last): (no code object) at line 0 TypeError: __init__() takes at least 3 arguments (1 given) As you can see, too much debugging info was lost in the translation to java so I have no idea where this error is occurring. I can think of 2 workarounds to the problem, but neither is very desirable, so any suggestions, hints, pointers, or even wild guesses are greatly appreciated. As an additional annoyance, it seems that a jythonc-compiled python module can't import any python modules that are not translated to java. Is this limitation real, or am I just doing something wrong? TIA! -D |
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 |
From: dman <ds...@ri...> - 2001-11-02 16:40:20
|
On Fri, Nov 02, 2001 at 03:50:12PM +0000, Finn Bock wrote: | [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. Yeah, the name is nicely self-documenting :-). | 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. What I see is : AbstractFolder module AbstractFolder extends java.lang.Object NoSuchMessageError extends java.lang.Exception Folder module Folder extends AbstractFolder So Folder is indirectly a java subclass. I had originally tried class Folder( java.lang.Object , AbstractFolder.AbstractFolder ) : pass but jythonc raises : TypeError: no multiple inheritance for Java classes: org.python.proxies.AbstractFolder$AbstractFolder$6 and java.lang.Object Kevin Butler wrote to me off-list and mentioned trying the __tojava__ stuff. This fails because I can't cast the above class to PyObject. If I change the @sig to return PyObject, then the __tojava__ call succeeds, but gives me a PySingleton instance, not a Folder instance. Is there a solution other than creating a python class to provide pseudo-reflection to java? (it takes a java.lang.Object and a name and invokes it in python ; this works but isn't natural from the java side) Thanks for your response! -D |
From: pragmatico <ro...@pr...> - 2001-11-02 17:12:23
|
hi, hi i am looking for the getmtime-function from os.path. its missing in jython 21a3. is this a bug or a oversight? ciao robertj ------------------------------------------------------------ the trinity of desirables of (software) architecture: Firmitas, Utilitas, Venustas (marcus vitruvius 20 BC) strength, utility, beauty |
From: <bc...@wo...> - 2001-11-02 19:07:14
|
[robertj] >hi i am looking for the getmtime-function from >os.path. its missing in jython 21a3. >is this a bug or a oversight? It is both <wink>. I have added a SF bug report: >http://sourceforge.net/tracker/index.php?func=detail&aid=477608&group_id=12867&atid=112867 regards, finn |
From: <rob...@ya...> - 2001-11-03 17:17:14
|
hi, i am having trouble running the following script in jython (21a3). it works in python (python2.0). >>>>>SCRIPT<<<<<<<< import re EOLZre = re.compile(r'(?:\r\n|\r|\n|\Z)') src = """ This is line one! This is line two! """ pos = 0 size = len(src) while pos < size: match = EOLZre.search(src, pos) pos = match.end() print "match:" + str((match.start(), match.end())) >>>>>OUTPUT<<<<<<<< PYTHON match:(0, 1) match:(18, 19) match:(36, 37) JYTHON match:(0, 1) match:(2, 2) match:(2, 2) match:(2, 2) match:(2, 2) match:(2, 2) any explanations beside that its a bug? ciao robertj ------------------------------------------------------------ Robert Kuzelj the trinity of desirables of (software) architecture: Firmitas, Utilitas, Venustas (marcus vitruvius 20 BC) strength, utility, beauty |
From: <rob...@ya...> - 2001-11-04 15:33:49
|
hi finn, what i dont get is: why dont you use the os-module that comes with cpython? >>>>>copy of os.py<<<<<< import sys _names = sys.builtin_module_names altsep = None if 'posix' in _names: <<<<<<<<<<<<<<<<<<<<<<<<<<< if sys.builtin_module_names would return the nt or so everything would just run fine (id assume ;-) ) ciao robertj > >hi i am looking for the getmtime-function from > >os.path. its missing in jython 21a3. > >is this a bug or a oversight? > > It is both <wink>. > > I have added a SF bug report: > > >http://sourceforge.net/tracker/index.php?func=detail&aid=477608&group_id=12 867&atid=112867 > > regards, > finn > ------------------------------------------------------------ Robert Kuzelj the trinity of desirables of (software) architecture: Firmitas, Utilitas, Venustas (marcus vitruvius 20 BC) strength, utility, beauty |
From: dman <ds...@ri...> - 2001-11-04 17:56:03
|
On Sun, Nov 04, 2001 at 04:13:55PM +0100, rob...@ya... wrote: | hi finn, | | what i dont get is: why dont you use the os-module | that comes with cpython? | | >>>>>copy of os.py<<<<<< | import sys | | _names = sys.builtin_module_names | altsep = None | if 'posix' in _names: | <<<<<<<<<<<<<<<<<<<<<<<<<<< | | if sys.builtin_module_names would return the | nt or so everything would just run fine (id | assume ;-) ) | the os module implementation stuff relies on the C api of the os itself, if you go deep enough. Java is, in a sense, a separate OS because it doesn't follow POSIX or Windows but does its own thing. -D |
From: dman <ds...@ri...> - 2001-11-02 19:53:41
|
On Fri, Nov 02, 2001 at 03:50:12PM +0000, Finn Bock wrote: | [dman] | > // 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: I have now identified the source of the problem and I think it is a bug in jython/jythonc. Kevin tried out the code I had posted, and showed me that it worked for him. I then tried it in a separate directory with just the 3 python and 1 java class, and it worked for me. He suggested that maybe the wrong "Folder" class was being found, and it seemed probable. I renamed the class, and even cut down the app to just the 3 python classes (with all implementation commented out) and a new java class containing only a bare minimum main(). Nothing would work. I then took the minimal sample that did work and put 2 of the python classes (the parent and child class) into a python package. It failed the same way my project has been failing. My conclusion is that jython does not correctly convert to a native java object an instance of a class that is in a python package. I'm wondering if telling jythonc to put all the classes into a java package would make any difference, but I'll just remove the python package for now. -D |
From: <bc...@wo...> - 2001-11-13 19:27:23
|
[dman] >I have now identified the source of the problem and I think it is a >bug in jython/jythonc. > >... > >I then took the minimal sample that did work and put 2 of the python >... Could you please make a bugreport that includes the minimal sample. I have lost track of the issue and without a bugreport I can safely predict that the bug will never be fixed. regards, finn |
From: dman <ds...@ri...> - 2001-11-27 23:23:12
|
On Tue, Nov 13, 2001 at 07:30:38PM +0000, Finn Bock wrote: | [dman] | | >I have now identified the source of the problem and I think it is a | >bug in jython/jythonc. | > | >... | > | >I then took the minimal sample that did work and put 2 of the python | >... | | Could you please make a bugreport that includes the minimal sample. | | I have lost track of the issue and without a bugreport I can safely | predict that the bug will never be fixed. I have now isolated the exact conditions which cause this problem. If the python class name is the same as the module name, and it is in a python package, then the problem occurs. I tried submitting a bug report (with a file attachment) but got the following instead of the confirmation page : Fatal error: Call to a member function on a non-object in common/tracker/ArtifactFile.class on line 106 When I tried going back and pressing submit again, I was told I had already submitted it and I should try double-submitting. I haven't yet gotten the mail from SF telling me that I submitted the report and I don't see it listed in the browse section yet. I can open a new report if you would like me to. -D -- If we confess our sins, He is faithful and just and will forgive us our sins and purify us from all unrighteousness. I John 1:9 |
From: Peter B. <bri...@ma...> - 2001-11-27 23:43:51
|
Hi! On Tue, Nov 27, 2001 at 06:23:08PM -0500, dman wrote: > I have now isolated the exact conditions which cause this problem. If > the python class name is the same as the module name, and it is in a > python package, then the problem occurs. This sounds awfully familiar. I submitted a similar bug report (jython-Bugs-451746) a while ago, and Samuele Pedroni has since fixed it. Best, Peter |
From: dman <ds...@ri...> - 2001-11-27 23:52:11
|
On Tue, Nov 27, 2001 at 05:43:48PM -0600, Peter Brinkmann wrote: | | Hi! | | On Tue, Nov 27, 2001 at 06:23:08PM -0500, dman wrote: | > I have now isolated the exact conditions which cause this problem. If | > the python class name is the same as the module name, and it is in a | > python package, then the problem occurs. | | This sounds awfully familiar. I submitted a similar bug report | (jython-Bugs-451746) a while ago, and Samuele Pedroni has since | fixed it. It looks like you are reporting a different manifestation of the same bug (it appears that 2.1a3 ends up overwriting the module class with the class class or something similar). Samuele already responded saying he followed my instructions (he didn't have my example source) but couldn't reproduce it with the CVS version of jython. [in repsonse to my post] The report submission was successful, though the example attachment wasn't. I added a comment to my report with a URL to retrieve the example source from. -D -- A)bort, R)etry, D)o it right this time |
From: Samuele P. <ped...@bl...> - 2001-11-28 00:17:04
|
[dman] > On Tue, Nov 27, 2001 at 05:43:48PM -0600, Peter Brinkmann wrote: > | > | Hi! > | > | On Tue, Nov 27, 2001 at 06:23:08PM -0500, dman wrote: > | > I have now isolated the exact conditions which cause this problem. If > | > the python class name is the same as the module name, and it is in a > | > python package, then the problem occurs. > | > | This sounds awfully familiar. I submitted a similar bug report > | (jython-Bugs-451746) a while ago, and Samuele Pedroni has since > | fixed it. > > It looks like you are reporting a different manifestation of the same > bug (it appears that 2.1a3 ends up overwriting the module class with > the class class or something similar). > > Samuele already responded saying he followed my instructions (he didn't have > my example source) but couldn't reproduce it with the CVS version of > jython. > > > [in repsonse to my post] > The report submission was successful, though the example attachment > wasn't. I added a comment to my report with a URL to retrieve the > example source from. > After a )renaming package to pkg (package is a Java keyword !) b) jythonc -deep ... c) import PythonClass changed in import pkg.PythonClass in Main.java d) compiling Main.java ;-) C:\exp\jc3\example>java -Dpython.home=\jython -classpath \jython;jpywork;. Main hello world done So I will close the bug. regards, Samuele. |
From: Kevin B. <kb...@ca...> - 2001-11-02 17:06:50
|
dman's jythonc use brought up an interesting limitation in jythonc: A java-object method cannot return an instance of a java-object subclass created by jythonc. For example, in the following code, a method on 'ep' can't return an instance of 'ep' (the same failure occurs if the 'returned value' and the class-returning the value are separate classes in separate files.) --- ep.py import java class ep( java.lang.Object ): def go( self ): """@sig public ep go()""" return None jythonc complains that it cannot find the 'ep' class: cd e:/work/kb/jythonc/extendPython/ jythonc ep.py processing ep Required packages: java.lang Creating adapters: Creating .java files: ep module Traceback (innermost last): File "w:/tools/jython\Tools\jythonc\jythonc.py", line 5, in ? File "w:\tools\jython\Tools\jythonc\main.py", line 300, in main File "w:\tools\jython\Tools\jythonc\main.py", line 221, in doCompile File "w:\tools\jython\Tools\jythonc\compile.py", line 381, in dump File "w:\tools\jython\Tools\jythonc\compile.py", line 318, in processModule File "w:\tools\jython\Tools\jythonc\compile.py", line 147, in makeJavaProxy File "w:\tools\jython\Tools\jythonc\compile.py", line 53, in getsig File "w:\tools\jython\Tools\jythonc\compile.py", line 84, in insistJavaClass ValueError: can not find class: ep The reason this fails is that compile.py insists that any Java classes exist (presumably to prevent you from trying to return a Python object that isn't a java subclass - the generated Java code would fail in that case.) Because the generated code hasn't been compiled w/ javac yet, compile.py can't find the Java class, and throws the ValueError. Is this a bug, a quirk, or "a bug but we're not about to fix it"? :-) kb dman wrote: > > On Fri, Nov 02, 2001 at 03:50:12PM +0000, Finn Bock wrote: > | [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. > > Yeah, the name is nicely self-documenting :-). > > | 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. > > What I see is : > > AbstractFolder module > AbstractFolder extends java.lang.Object > NoSuchMessageError extends java.lang.Exception > Folder module > Folder extends AbstractFolder > > So Folder is indirectly a java subclass. > > I had originally tried > > class Folder( java.lang.Object , AbstractFolder.AbstractFolder ) : pass > > but jythonc raises : > > TypeError: no multiple inheritance for Java classes: org.python.proxies.AbstractFolder$AbstractFolder$6 and java.lang.Object > > Kevin Butler wrote to me off-list and mentioned trying the __tojava__ > stuff. This fails because I can't cast the above class to PyObject. > If I change the @sig to return PyObject, then the __tojava__ call > succeeds, but gives me a PySingleton instance, not a Folder instance. > > Is there a solution other than creating a python class to provide > pseudo-reflection to java? (it takes a java.lang.Object and a name > and invokes it in python ; this works but isn't natural from the java > side) > > Thanks for your response! > > -D > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users |
From: Kevin B. <kb...@ca...> - 2001-11-02 17:16:11
|
I should have clarified that slightly (I knew what I was saying, didn't you?) The problem is the signature of the 'go' method. It is declared to return 'ep', which jythonc can't find. If it is declared to return 'Object', the compilation works just fine, but clients have to downcast 'Object' instances to 'ep' instances. This isn't a problem for most jythonc users, because they are usually extending Java interfaces, rather than defining classes/interfaces in Python to be used in Java. kb Kevin Butler wrote: > > dman's jythonc use brought up an interesting limitation in jythonc: > > A java-object method cannot return an instance of a java-object subclass created by jythonc. > > For example, in the following code, a method on 'ep' can't return an instance of 'ep' (the same failure occurs if the 'returned value' and the class-returning the value are separate classes in separate files.) > > --- ep.py > import java > class ep( java.lang.Object ): > def go( self ): > """@sig public ep go()""" > return None > > > jythonc complains that it cannot find the 'ep' class: > > cd e:/work/kb/jythonc/extendPython/ > jythonc ep.py > processing ep > > Required packages: > java.lang > > Creating adapters: > > Creating .java files: > ep module > Traceback (innermost last): > File "w:/tools/jython\Tools\jythonc\jythonc.py", line 5, in ? > File "w:\tools\jython\Tools\jythonc\main.py", line 300, in main > File "w:\tools\jython\Tools\jythonc\main.py", line 221, in doCompile > File "w:\tools\jython\Tools\jythonc\compile.py", line 381, in dump > File "w:\tools\jython\Tools\jythonc\compile.py", line 318, in processModule > File "w:\tools\jython\Tools\jythonc\compile.py", line 147, in makeJavaProxy > File "w:\tools\jython\Tools\jythonc\compile.py", line 53, in getsig > File "w:\tools\jython\Tools\jythonc\compile.py", line 84, in insistJavaClass > ValueError: can not find class: ep > > The reason this fails is that compile.py insists that any Java classes exist (presumably to prevent you from trying to return a Python object that isn't a java subclass - the generated Java code would fail in that case.) Because the generated code hasn't been compiled w/ javac yet, compile.py can't find the Java class, and throws the ValueError. > > Is this a bug, a quirk, or "a bug but we're not about to fix it"? > > :-) > > kb > > > > dman wrote: > > > > On Fri, Nov 02, 2001 at 03:50:12PM +0000, Finn Bock wrote: > > | [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. > > > > Yeah, the name is nicely self-documenting :-). > > > > | 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. > > > > What I see is : > > > > AbstractFolder module > > AbstractFolder extends java.lang.Object > > NoSuchMessageError extends java.lang.Exception > > Folder module > > Folder extends AbstractFolder > > > > So Folder is indirectly a java subclass. > > > > I had originally tried > > > > class Folder( java.lang.Object , AbstractFolder.AbstractFolder ) : pass > > > > but jythonc raises : > > > > TypeError: no multiple inheritance for Java classes: org.python.proxies.AbstractFolder$AbstractFolder$6 and java.lang.Object > > > > Kevin Butler wrote to me off-list and mentioned trying the __tojava__ > > stuff. This fails because I can't cast the above class to PyObject. > > If I change the @sig to return PyObject, then the __tojava__ call > > succeeds, but gives me a PySingleton instance, not a Folder instance. > > > > Is there a solution other than creating a python class to provide > > pseudo-reflection to java? (it takes a java.lang.Object and a name > > and invokes it in python ; this works but isn't natural from the java > > side) > > > > Thanks for your response! > > > > -D > > > > _______________________________________________ > > Jython-users mailing list > > Jyt...@li... > > https://lists.sourceforge.net/lists/listinfo/jython-users > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users |