This question is a continuation: Why can't I call a method outside of an anonymous class with the same name
This previous question answer why , but now I want to know if javac should find run (int bar)? (See the previous question for why run (42) is executing)
If it is not, is it because of the specification? Does it produce ambiguous code? I think this is a mistake. Although the previous question explained why this code was not compiled, I believe that it should compile if javac searched above in the tree, if it could not find a match at the current level. IE If this.run () does not match, it should automatically check NotApplicable.this for the execution method.
Also note that foo (int bar) is correctly found. If you give any reason why run (int bar) should not be found, it should also explain why foo (int bar) was found.
public class NotApplicable { public NotApplicable() { new Runnable() { public void run() {
source share