Unusual generics behavior

    Accidentally discovered an atypical problem with parameterization and inheritance in Java.
    Immediately make a reservation that all this is only of academic interest . In real life, nobody will write so crookedly. But formally this should not be:
    Interface.java
    public interface Interface {
        void test (Class clazz);
    }

    BaseClass.java
    public abstract class BaseClass implements Interface {
        abstract public void test(Class clazz);
    }

    MyClass.java
    public class MyClass extends BaseClass {
        public void test(Class clazz) {
        }
    }
    Компилятор выдает ошибку:
    MyClass is not abstract and does not override abstract method test(java.lang.Class)

    Also popular now: