Consider the following two classes:
// a.java
public class a
{
public static class $b
{
}
}
// a$.java
public class a$
{
public static class b
{
}
}
Obviously, due to inner/nested class name mangling, a$.b and a.$b will both be compiled to a class file named a$$b.class. When the command javac a.java a$.java
is executed, the Oracle Java compiler (javac 1.7.0_45) produces the following output:
a$.java:3: error: duplicate class: a.$b
public static class b
^
1 error
Where does it say in the Java Language Specification that these class names (a$.b
and a.$b
) clash, or is this just an established convention due to the output files having the same name?