Change in javac handling of anonymous/local classes (original) (raw)

Alex Buckley alex.buckley at oracle.com
Wed Feb 27 13:16:30 PST 2013


On 2/27/2013 12:33 PM, John Spicer wrote:

Javac 1.7 has what is a surprising difference from 1.6 with regard to this example:

For example, abstract class TT { void f1(String s) {} void f1(int i1, int i2) {} // Note: no f2 void f3(String s) {} } abstract class X1 { void f1(int i) {} void f2(int i) {} void f3(int i) {} void bar() { new TT() { { f1(0); // 1.6 error, 1.7 accepts if TT has > 1 f1, finds X1.f1 f2(0); // 1.6 and 1.7 accept, find X1.f2 f3(0); // 1.6 and 1.7 error, finds TT.f3 } }; } }

Let's focus solely on 'f3(0);' for now, so we can be sure about the rules:

Alex



More information about the compiler-dev mailing list