So, I have this bit of wild, crazy code, that is making the compiler spit in my face for some hours the following error:
The inherited method Object.clone() cannot hide the public abstract method in IOrderable<T>
The culprit classes are the following (the error appears right in the T of the generic):
public class MyInterval<T extends Xpto & Successorable<T>> implements Cloneable {
public MyInterval<T> clone(){
MyInterval<T> it = null;
try {
it = (MyInterval<T>) super.clone();
it.max = it.max.clone();
it.min = (T) it.min.clone();
} catch (CloneNotSupportedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return it;
}
}
public interface Xpto {}
public interface Successorable<Y> extends IOrderable<Y> {
Y suc();
}
interface IOrderable<J> extends Rankable<J>, Cloneable {
boolean greaterEq(J e);
J clone();
}
public interface Rankable<P> {
int rank(P e);
}
Yes, they seem kinda random. They solely exist to test some weird things in a compiler/java_byte_code_instrumentation-like project I am doing. How can I make this work while keeping the logic intact?
Thanks