javac will not compile enum, ( Windows Sun 1.6 --> OpenJDK 1.6)
Posted
by
avgvstvs
on Stack Overflow
See other posts from Stack Overflow
or by avgvstvs
Published on 2011-11-11T03:39:36Z
Indexed on
2011/11/12
17:51 UTC
Read the original article
Hit count: 202
package com.scheduler.process;
public class Process {
public enum state {
NOT_SUBMITTED, SUBMITTED, BLOCKED, READY, RUNNING, COMPLETED
}
private state currentState;
public state getCurrentState() {
return currentState;
}
public void setCurrentState(state currentState) {
this.currentState = currentState;
}
}
package com.scheduler.machine;
import com.scheduler.process.Process;
import com.scheduler.process.Process.state;
public class Machine {
com.scheduler.process.Process p = new com.scheduler.process.Process();
state s = state.READY; //fails if I don't also explicitly import Process.state
p.setCurrentState(s); //says I need a declarator id after 's'... this is wrong.
p.setCurrentState(state.READY);
}
Modified the example to try and direct to the issue. I cannot change the state on this code. Eclipse suggests importing Process.state like
I had on my previous example, but this doesn't work either. This allows state s = state.READY
but the call to p.setCurrentState(s);
fails as does p.setCurrentState(state.READY);
© Stack Overflow or respective owner