-
Bug
-
Resolution: Unresolved
-
P4
-
7u51, 8u101, 9
// C.java, compiled first
public class C {
Object o = new Object() {};
}
// Test.java, compiled second
public class Test {
C$1 var;
}
This compiles without error, even though there exists no in-scope class with name "C$1" (see JLS 6.5.5.1).
JDK-8023945 noticed that I can extend the class, but it shouldn't even be possible to name the class.
Related cases behave as expected:
- If I introduce a member class D, an error occurs for C$D.
- If I use a qualified name -- "p.C$1" -- an error occurs.
- If I use a qualified name and *then* use an unqualified name ("p.C$1 var1; C$1 var2;"), I get two errors -- something stateful is going on
public class C {
Object o = new Object() {};
}
// Test.java, compiled second
public class Test {
C$1 var;
}
This compiles without error, even though there exists no in-scope class with name "C$1" (see JLS 6.5.5.1).
JDK-8023945 noticed that I can extend the class, but it shouldn't even be possible to name the class.
Related cases behave as expected:
- If I introduce a member class D, an error occurs for C$D.
- If I use a qualified name -- "p.C$1" -- an error occurs.
- If I use a qualified name and *then* use an unqualified name ("p.C$1 var1; C$1 var2;"), I get two errors -- something stateful is going on
- relates to
-
JDK-8166209 Binary names of local & inner classes can be referenced
- Open