I have a very specific problem about the method java.lang.Enum.values().
I would like to override its javadoc. Very precisely, the current javadoc for this is, after I created my own enum:
public static MyClass.MyEnum[] values()
...
This method may be used to iterate over the constants as follows:
for (MyClass.MyEnum c : MyClass.MyEnum.values())
System.out.println(c);
Returns:
...
But in my company System.out
calls are considered bad practice so I would like it not to be shown. My first try was to override values()
but it is apparently not possible. Is there another way I can do this? Or is the only possibility to update the generated doc ?
I am also curious about why values()
is not overridable. I read on other questions that "it is generated by the compiler". But can someone be more precise? It seems that it's generated from the enum's name, but it does not explain why.