-
Bug
-
Resolution: Fixed
-
P3
-
5.0
-
None
-
rc
-
generic
-
solaris_8
The enum spec is unclear if local enum types should be allowed.
Logically, a local type is a fresh type each time its declaration is
executed. That's why local types can never be static and cannot have
static members.
Enum types, on the other hand, are always the same type, are always static
and always have static members.
This conflict suggests that local enum types should not be allowed.
However, the spec does not forbid them. But neither does the spec
provide any semantics for them if they do occur. For example, can a
local enum type capture final variables from the enclosing scope?
I recommend local enum types be forbidden.
Logically, a local type is a fresh type each time its declaration is
executed. That's why local types can never be static and cannot have
static members.
Enum types, on the other hand, are always the same type, are always static
and always have static members.
This conflict suggests that local enum types should not be allowed.
However, the spec does not forbid them. But neither does the spec
provide any semantics for them if they do occur. For example, can a
local enum type capture final variables from the enclosing scope?
I recommend local enum types be forbidden.
- relates to
-
JDK-5019609 javac fails to reject local enums
- Resolved