Redundant generic parameters

后端 未结 6 1869
没有蜡笔的小新
没有蜡笔的小新 2021-01-12 03:36

I have this two interfaces and classes:

public interface Identifiable {
    T getId();
}

public interface GenericRepository

        
6条回答
  •  清酒与你
    2021-01-12 04:33

    If I am not mistaken generics will all be compiled as if they were just Object. Now the syntax is (hard) checked to ensure that you are not putting apple with oranges because generics were added after the initial design of Java. this is why generics are so constrained...

提交回复
热议问题