constant references in enums
John Rose
john.r.rose at oracle.com
Fri Jan 22 00:16:28 UTC 2016
Here's a little puzzler: Should this code compile, or is the forward reference illegal?
enum FooE {
FOOV(FOOC); // ?? error: illegal forward reference
FooE(int k) {}
public static final int FOOC = 42; // a constant variable
// look, JLS 8.9.2 says "...unless the field is a constant variable"
}
(I.e., should I file a bug if it fails to compile?)
Thanks,
— John
More information about the compiler-dev
mailing list