Consider this simple enumerated type:
class Foo {
foo, bar;
Foo() {
if( equals(foo) ) {
// ...
}
}
}
javac rightfully points out the illegal access to foo in the
initializer for the enumerated type. However, javac 1.6.0_01
cheerfully accepts
class Foo {
foo, bar;
Foo() {
switch(this) {
case foo:
break;
}
}
}
, which of course is broken and fails at runtime. My question: is
javac right to accept this code (meaning that the language definition
might need some work), or should I file a bug report?

Signature
C. Benson Manica | I *should* know what I'm talking about - if I
cbmanica(at)gmail.com | don't, I need to know. Flames welcome.
Christopher Benson-Manica - 05 Jul 2007 19:41 GMT
> Consider this simple enumerated type:
> class Foo {
Canny observers will notice that Foo is not an enum. Obviously I
meant enum Foo. Apologies.

Signature
C. Benson Manica | I *should* know what I'm talking about - if I
cbmanica(at)gmail.com | don't, I need to know. Flames welcome.