Firstly, I'd like to thank Henry Wong for his piece on this subject ( see the forum FAQ if you haven't seen it ).
I still have a few issues with this subject though. I should explain that there seems to be some incorrect or out of date info on Java constants on the web, which increases the confusion level.
So here are my questions/assumptions:
1. Do "Load time constants" exist?
I have seen some suggestions that they do, but the examples given fail to compile.
For example the code:
I've also read that emuns are load time constants that are somehow fudged to
work as switch case expressions by the compiler.
So my assumption is that there are only compile time constants. Am I correct?
2. The definition of the constant expression in the JLS makes no distinction between instance constants or class constants ( or any scope ).
Can I then assume that there are no differences or exceptions based on where the constant is defined?
3 As a follow up to point 2, why can't I use a final method parameter in a switch statement?
an example:
The constant 'one' above cannot be used in the switch, so:
a. Is it a constant?
b. What part of the JLS definition of the ConstantExpression does it break?