@Override
public <E extends Enum<E>> E getValue(){
return (E) super.getValue();
}
Why is this overriding not working? The error that Idea is returning is that both methods have the same erasure but they are not overriding each other.
Edit:
Cannot Overload a Method Where the Formal Parameter Types of Each Overload Erase to the Same Raw Type
A class cannot have two overloaded methods that will have the same signature after type erasure.
public class Example {
public void print(Set<String> strSet) { }
public void print(Set<Integer> intSet) { }
}
The overloads would all share the same classfile representation and will generate a compile-time error.
Source: https://docs.oracle.com/javase/tutorial/java/generics/restrictions.html#cannotOverload