-
Bug
-
Resolution: Won't Fix
-
P4
-
None
-
1.2.1
-
generic
-
generic
Name: skT88420 Date: 08/16/99
// Platform: Windows 98
// java version "1.2.1"
// Classic VM (build JDK-1.2.1-A, native threads)
/*
Bug: When I compile this source file the "javac" compiler gives me an error
that the variable 'f' is already defined in this method (Line 21) when I
think it shouldn't do that (variable shadowing! and 'f' in main() is not
final so anonymous classes can't access it anyway!). To be sure about that,
I recompiled this source file using Microsoft's "JVC" compiler and it didn't
generate any errors. And the 'java' VM was able to interpret it.
*/
public class CompilerBug {
public static void main(String[] Args) {
int f = 10;
(new Test() {
public void test(int z) {
int f = 50; // Variable 'f' is already defined in this method!!!?
System.out.println(z + f);
}
}).test(f);
}
}
interface Test {
public void test(int z);
}
(Review ID: 93838)
======================================================================