The error message keep disallow me to compile my project in eclipse lula. I found this only happen if my util class reading the message from resources bundle, else it is working fine.
Please advise.
Below is my code:
MessageUtil.java
private static final String MSG_FILE = "com.by.go.booking.ui.messages";
private final static ResourceBundle MESSAGE = ResourceBundle.getBundle(MSG_FILE);
public static final String LOGIN_ID_EXISTS = MESSAGE.getString("ERR1");
LoginBean.java
@AssertTrue(message = MessageUtil.LOGIN_ID_EXISTS)
public boolean isLoginIdUnique() {
boolean result = false;
// validate login ID exists
........
return result;
}
From the code above, eclipse will trigger the error message:"The value for annotation attribute AssertTrue.message must be a constant expression"
Anyway, if I modify the MessageUtil.java as below, that is not error in eclipse.
MessageUtil.java
public static final String LOGIN_ID_EXISTS = "Login is invalid";