natural / java2python

Simple but effective library to translate Java source code to Python.
GNU Lesser General Public License v2.1
564 stars 243 forks source link

translated constant arrays result in syntax errors #48

Open yucer opened 8 years ago

yucer commented 8 years ago

A little problem translating array initializers. This Java code:

public class XParser extends BaseParser
{
    private static final char[] MYCHARARR = new char[] { 'a', 'b', 'c', 'd' };
    # ....
}

results in this invalid syntax:

class COSParser(BaseParser):
    MYCHARARR = [None] * 

it should be:

class COSParser(BaseParser):
    MYCHARARR = ['a', 'b', 'c', 'd']