class TryMe {
private void someMethod(String str) {}
private void useIt() {
int n = 5;
someMethod(Integer.toString(n + 1).length() * 5);
}
}
When converted, you get:
class TryMe {
private def someMethod(str: String) {
}
private def useIt() {
val n = 5
someMethod(java.lang.Integer toString n + 1.length * 5)
}
}
This is incorrect, and in this case gives a compiler error on 1.length (although you can't rely on having an error). The n + 1 needs to be wrapped in brackets since that is the argument to toString.
I believe the problem is in ScalaDumpVisitor.scala line 744. If the method is one in the SHORT_FORM list and it has less than 2 arguments, the resulting scala will use a space rather than a dot and parenthesis. I think the condition needs to be strengthened: if there is an argument, the code for that argument must not contain a space.
I have the Java code:
When converted, you get:
This is incorrect, and in this case gives a compiler error on 1.length (although you can't rely on having an error). The
n + 1
needs to be wrapped in brackets since that is the argument totoString
.I believe the problem is in
ScalaDumpVisitor.scala
line 744. If the method is one in theSHORT_FORM
list and it has less than 2 arguments, the resulting scala will use a space rather than a dot and parenthesis. I think the condition needs to be strengthened: if there is an argument, the code for that argument must not contain a space.