What you want is not possible in Java, and is not useful.
So this should not be allowed:
Why not? What purpose does that serve? Generics is not for you to make arbitrary restrictions. Generics is only useful for eliminating casts that you would otherwise need, because it can prove that the cast is always safe.
As long as public class A implements MyInterface<B>
is type-safe, there is no point in making an arbitrary restriction that prohibits it.
You should simply define your interface as
public interface MyInterface<T> {
public void method(T object);
}
and you can define your class
public class A implements MyInterface<A> {
public void method(A object) {
}
}
and if somebody else defines a class
public class B implements MyInterface<A> {
public void method(A object) {
}
}
then so be it. Why do you care? What problem does it cause?