java2python icon indicating copy to clipboard operation
java2python copied to clipboard

AttributeError: 'NoneType' object has no attribute 'token'

Open ghost opened this issue 12 years ago • 1 comments

The below code compiles and executes correctly via java, but I receive an error when trying to use java2python to convert the code to python:

class helloworld { public static void main(String[] args) { String result = String.format("The format method is %s!" + " blah ", "great");

    System.out.println(result);
}

}

The statement + " blah" is causing the problem.. These types of statements occur frequently in gwt, and other libraries.

Billy

ghost avatar Aug 27 '12 19:08 ghost

These types of statements occur frequently in gwt, and other libraries.

This sucks, because support for String.format() is just basically implemented and it's implementation is also not very extendable.

I'm afraid you'll have to do it by hand for now. If you turn that:

String result = String.format("The format method is %s!" + " blah ", "great");

into something like:

String result = String.format("The format method is %s! blah ", "great");

it should work fine. (a SED script could do that)

(One more feature could be added specifically for this case, but some other cases will probably rise and it is not robust at all)

iuliux avatar Aug 29 '12 08:08 iuliux