EDIT: Turns out this is a long-standing bug with Eclipse and enums / array initializers, which is really unfortunate.
In Eclipse, I'm finding that I don't have access to any kind of code completion inside of enums. Here's a WIP, of course, snippet of code that I'm working with.
enum PlayerState implements State<Player> {
NORMAL(){
@Override
public void enter(Player player){
}
@Override
public void update(Player player){
}
},
JUMP_START(){
Timer jumpTimer = new Timer();
public void enter(Player player){
jumpTimer.set(1);
}
public void update(Player player){
}
},
GLOBAL_STATE(){
@Override
public void update(Player player){
}
};
@Override
public void enter(Player player) {
}
@Override
public void exit(Player player) {
}
@Override
public boolean onMessage(Player player, Telegram telegram) {
return false;
}
}
So in this code, I have no completion with "player.", or with "jumpTimer.". To note, I'm working with the GDX-AI library to manage a state machine, and it advises putting the states into an enum, like I have above. Note that I was able to have completion in IntelliJ. I've tried enabling "Java Proposals" in the Preferences/Java/Editor/Content Assist/Advanced section, but that didn't work, and restarting the IDE didn't help, either.
Any ideas?
EDIT: To confirm, this is just a snippet, and the code as a whole does compile. There's nothing wrong with the way it works so far, as far as I can tell; Eclipse isn't throwing any errors, so it's fine. The only issue is code completion, at the moment.
Oh, also, the strange thing is that Eclipse can tell me what's wrong with code (i.e. doing "changeState()" on the state machine from the state through the Player class will have a syntax error because I'm not providing an argument). So, there's some level of code checking, but no code hinting? I dunno...