Issue1659616

classification
Title: jythonc creates transient method causing compilation to fail
Type: Severity: normal
Components: Jythonc compiler Versions:
Milestone:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: pqu, zyasoft
Priority: normal Keywords:

Created on 2007-02-14.09:38:02 by pqu, last changed 2008-09-14.01:22:14 by zyasoft.

Messages
msg1451 (view) Author: Peter Quade (pqu) Date: 2007-02-14.09:38:02
Using the SwingWorker backport: https://swingworker.dev.java.net/

The publish method is protected, generic and has a variable number of arguments. Jythonc creates a transient super__publish method. Javac does not like transient methods.

Code sample
========

import  org.jdesktop.swingworker.SwingWorker as SwingWorker

class MySwingWorker(SwingWorker):
    def doInBackground(self):
        # Explicitly creating a list seems to be necessary 
        self.super__publish([""])

Works with jython (does nothing), breaks in jythonc.

jythonc output
=========
[...]
1  ./jpywork/swbug.java:93: modifier transient not allowed here
        public transient void super__publish(java.lang.Object[] arg0) {
[...]

system information
============

Mac OS X 10.4.8
     (Darwin 8.8.1 Darwin Kernel Version 8.8.1: Mon Sep 25 19:42:00 PDT 2006; root:xnu-792.13.8.obj~1/RELEASE_I386 i386)

java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-112)
Java HotSpot(TM) Client VM (build 1.5.0_06-64, mixed mode, sharing)

        
 
msg1452 (view) Author: Peter Quade (pqu) Date: 2007-02-14.09:53:04
jython2.2b1

Sorry. I frogot. I am currently investigating this with the svn HEAD version. The supplied codesample works, but the code in my project still breaks...
msg1453 (view) Author: Peter Quade (pqu) Date: 2007-02-14.09:54:39
no. it still won't compile if swing-worker.jar is in the classpath.
msg1454 (view) Author: Peter Quade (pqu) Date: 2007-02-14.11:10:03
It's me again. Still investigating with the SwingWorker class. It looks like jython is innocent. Using pure Java code to extract the methods of the class,
I found out that java itself thinks the publish method is transient.

--- snip ---
import java.lang.reflect.Method;
import org.jdesktop.swingworker.SwingWorker;

public class demo{
    public static final void main(String[] args) {
        System.out.println(SwingWorker.class.getName());
        for (Method method : SwingWorker.class.getDeclaredMethods())    {
            System.out.println(method.toString());
        }
    }
}

--- snap ----

$ java demo|grep publish
protected final transient void org.jdesktop.swingworker.SwingWorker.publish(java.lang.Object[])

javap get's it right... interesting. for jython this case is closed. sorry.
msg1455 (view) Author: Peter Quade (pqu) Date: 2007-02-14.11:18:32
It seems jython still has to handle this problem:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6516895

varargs are marked transient by java.lang.reflect.Modifiers. This has to be filtered out for methods.
I will try and create a patch.
msg1456 (view) Author: Peter Quade (pqu) Date: 2007-02-14.11:48:38
The Patch:

Index: Tools/jythonc/proxies.py
===================================================================
--- Tools/jythonc/proxies.py    (revision 3105)
+++ Tools/jythonc/proxies.py    (working copy)
@@ -252,6 +252,12 @@
         for name in names:
             for sig, (access, ret, throws) in self.jmethods[name].items():
                 #print name, access, isProtected(access), isFinal(access)
+                
+                if isTransient(access):
+                    # transient uses the same bits as vararg, transient make no sense for methods
+                    # same problem might occur with bridge methods and volatile
+                    access &= ~TRANSIENT
+                
                 if isProtected(access):
                     supername = name
                     if isFinal(access):
msg3571 (view) Author: Jim Baker (zyasoft) Date: 2008-09-14.01:22:14
jythonc will not be fixed
History
Date User Action Args
2008-09-14 01:22:14zyasoftsetstatus: open -> closed
resolution: wont fix
messages: + msg3571
nosy: + zyasoft
2007-02-14 09:38:02pqucreate