I have [a big amount of code that distills down to] this:
class Test {
enum Bool { False, True };
static boolean decode(Bool input) {
boolean b;
switch (input) {
case False: b = false; break;
case True: b = true; break;
}
return b;
}
}
javac
rejects it on the grounds that:
Main.java:11: error: variable b might not have been initialized
return b;
I'm a bit confused. I thought the point of enum
s was to have the values list pinned down at compile-time. In what case might my variable b
not have been initialized?