Why doesn't Eclipse open the declaration of such enum methods?
Because they're not declared in source code at all. They're automatically supplied by the compiler - where would you expect to be taken? Ctrl-clicking on MyEnum
(rather than the values()
method) should open the enum with no problems though.
From section 8.9.3 of the JLS:
The members of an enum type E are all of the following:
- ...
The following implicitly declared methods:
/* javadoc... */ public static E[] values(); /* javadoc... */ public static E valueOf(String name);
Note that the normal "go to declaration" techniques should work for any methods which genuinely exist in source code.