I'm having a strange issue which I'm not sure if it's a compiler problem or my understanding of enums with interfaces. I'm using IntelliJ IDEA 12, building an Android project, and I have a class like this:
public class ClassWithEnum {
private MyEnum myEnum;
//Trying to access it internally here throws the error
public boolean isActionable() {
return myEnum.isActionable();
}
public enum MyEnum implements Action {
ACTIONABLE() {
@Override
public boolean isActionable() { return true; }
},
NOT_ACTIONABLE() {
@Override
public boolean isActionable() { return false; }
}
}
public interface Action {
public boolean isActionable();
}
}
Now, this was working initially, but now the compiler is complaining (and I've tried this in a brand new project as well with the same results) with the error:
java: /Users/kcoppock/Documents/Projects/EnumInterfaceTest/src/com/example/EnumInterfaceTest/ClassWithEnum.java:11: cannot find symbol
symbol : method isActionable()
location: class com.example.EnumInterfaceTest.ClassWithEnum.MyEnum
I've done this before (enumerations with behaviors defined by an interface) with no issues. Any thoughts?