Consider this code:
public interface Foo extends Comparable<Foo> {}
public enum FooImpl implements Foo {}
Due to the restrictions of type erasure, I receive the following error:
java.lang.Comparable cannot be inherited with different arguments:
<Foo>and<FooImpl>
I have the following requirements:
FooImplneeds to be an enum, because I need to use it as a default value in annotations.- The contract of my interface is that it needs to be comparable.
I already tried using generic bounds in the interface, but this is not supported in Java.
public interface Foopublic enum FooImpl implements Foo, Comparable<FooImpl> {...}FooImplalready implementsComparable<FooImpl>.RoleasComparable, a comment won't help here.public enum..., add://Note: implements Comparable.