Eclipse indigo, java 1.6
public interface I {
String getName();
}
/* and in another file */
public enum E implements I {
E1() {
String getName() { return "foo"; }
};
}
In Eclipse, this worked! Other classes could invoke getName() on references of type I. The actual javac rejected it, claiming that there was no such thing as getName() in the enum. Is this just an Eclipse bug?
Note that what’s wierd about this is the method definition inside the enumerator. It all works just fine in both Eclipse and Javac if I do the normal thing, and have the function defined at the bottom of the enum returning the value of a field.
First I agree with @yshavit.
Otherwise it can be related with this one: Workaround for javac compilation order bug in maven
I think it’s name order related. Try to rename your interface A, it may compile first and things should work.