Javac allows an inner class to have the same simple name as that of
one of it's enclosing classes. The language specification disallows
this situation.
The problem was discovered in Modena tests niner069, niner070,
and niner072. Both of the following sample source codes compile
even though they should not.
class X {
static {
class X {}
}
}
class Y {
void func() {
class Y {}
}
}
allan.jacobs@Eng 1997-11-21
Also fails with Modena test niner130.
class Z {
class I {
void f() {
class I{}
}
}
}
allan.jacobs@Eng 1997-11-21
one of it's enclosing classes. The language specification disallows
this situation.
The problem was discovered in Modena tests niner069, niner070,
and niner072. Both of the following sample source codes compile
even though they should not.
class X {
static {
class X {}
}
}
class Y {
void func() {
class Y {}
}
}
allan.jacobs@Eng 1997-11-21
Also fails with Modena test niner130.
class Z {
class I {
void f() {
class I{}
}
}
}
allan.jacobs@Eng 1997-11-21
- duplicates
-
JDK-4037746 javac compiles inner classes in local blocks incorrectly
- Closed