Description
Consider these two classes:
class S {
private def foo(x: Int) = x*x
}
class S2 {
private def foo(x: Int) = x*x
def bar = 1 to 5 map foo
}
And the generated code:
// S1
private int foo(int);
// S2
public final int S2$$$$foo(int);
I realize that in S2 a public method must be created so S2$$$$anonfun$$bar$$1 can access it, however I propose the original private method ought to be generated as well, simply forwarding to the public method.
This came up because I'm spending time porting various java tools to scala in parallel with working on a bytecode library. People use reflection in all manner of interesting ways, among them calling getDeclaredMethod (which considers private methods) expecting to find a method with the same name as the one in the source. Seems like a reasonable expectation.
I realize there will most likely be situations where scala bytecode can't be as predictable as java, however this doesn't like one of them.