scalagen
scalagen copied to clipboard
Matching constructor parameter name and member variable name leads to invalid code
this:
class Foo {
private int bar;
public Foo(int bar) {
this.bar = bar * 2; // ok in Java
}
}
gets converted to:
class Foo(bar: Int) {
private val bar = bar * 2 // compiler complains that recursive val requires type
}
Should be handled for example by prefixing the member variable with _
perhaps; or the other way around, especially when the member variable is public and naming matters.