Issue839683

classification
Title: Jython classes in @sig statements
Type: Severity: normal
Components: Jythonc compiler Versions:
Milestone:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: fwierzbicki, knardi, pedronis
Priority: low Keywords:

Created on 2003-11-11.01:18:07 by anonymous, last changed 2009-03-13.23:32:41 by fwierzbicki.

Files
File name Uploaded Description Edit Remove
example.tgz nobody, 2003-11-11.01:18:08 A.py and B.py
jythonc-self-ref.patch.txt pedronis, 2003-11-11.01:28:47 patch
Messages
msg875 (view) Author: Nobody/Anonymous (nobody) Date: 2003-11-11.01:18:07
When using jythonc to compile a Jython class that 
references an uncompiled class in a @sig statement:

# A.py
	
import B
	
class A:
    def setB(self, b):
        """@sig public void setB(B b)"""
        self.b = b

# B.py

class B:
    def doSomething(self):
        """@sig public void doSomething()"""
        print "I am doing something"

Jythonc produces an error with the following output:

    processing A
    processing B
    
    Required packages:
    
    Creating adapters:
    
    Creating .java files:
      B module
      A module
    Traceback (innermost last):
      File "C:\jython-2.1\Tools\jythonc\jythonc.py", line 
5, in ?
      File "c:\jython-2.1\Tools\jythonc\main.py", line 301, 
in main
      File "c:\jython-2.1\Tools\jythonc\main.py", line 221, 
in doCompile
      File "c:\jython-2.1\Tools\jythonc\compile.py", line 
389, in dump
      File "c:\jython-2.1\Tools\jythonc\compile.py", line 
325, in preprocessModule
      File "c:\jython-2.1\Tools\jythonc\compile.py", line 
312, in makeJavaProxy
      File "c:\jython-2.1\Tools\jythonc\compile.py", line 
58, in getsig
      File "c:\jython-2.1\Tools\jythonc\compile.py", line 
84, in insistJavaClass
    ValueError: can not find class: B

While compiling B.py first would work for this example, it 
is not really a solution for large builds.

To reproduce, in the directory that A.py and B.py reside 
in:
jythonc *.py
or
jythonc A.py B.py
msg876 (view) Author: Samuele Pedroni (pedronis) Date: 2003-11-11.01:28:47
Logged In: YES 
user_id=61408

here's a patch to try. It just let 'B' through into the
.java files.
Depending on the sitatuation B could need to be fully
qualified, basically it should be correct for .java files
compilation time.

(Btw , in a concrete case both A and B should inherit from
some java class otherwise the @sig is analyzed but has no
effect.)
msg877 (view) Author: Kevin Nardi (knardi) Date: 2003-11-20.23:43:43
Logged In: YES 
user_id=848973

Thanks a lot, the patch works wonderfully and we are now 
using it in our build process.  I will post again if there are any 
problems, but I don't forsee any.

Thanks again.
msg4265 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2009-03-13.23:32:41
jythonc is no longer maintained
History
Date User Action Args
2009-03-13 23:32:41fwierzbickisetstatus: open -> closed
nosy: + fwierzbicki
resolution: wont fix
messages: + msg4265
2003-11-11 01:18:07anonymouscreate