"Constant expression required" in switch

I am developing a J2ME application for RIM BlackBerry.
In the BB Java API you've a character defined like this:

public static final char ESCAPE

In IDEA 5.0, when using a switch like this:

public boolean keyChar(char key, int status, int time) {
//intercept the ESC key - exit the app on its receipt
boolean retval = false;

switch (key) {
case Characters.ESCAPE:
onClose();
retval = true;
break;
}



you get Characters.ESCAPE underlined in red,
saying "Constant expression required". It compiles perfectly, though...

Huh?


Cheers,
Benjamin


Please sign in to leave a comment.