Getting generic parameter from supertype class

后端 未结 3 1523
死守一世寂寞
死守一世寂寞 2021-01-21 06:56

Say I have a parent interface/class like so

interface Parent {}

And a number of implementing interfaces that fix the generic type.

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-21 07:23

    I don't think so. Read about type erasure: the generic types are used only for compile-time checking, and then discarded. They're not stored in the compiled class files so they're not available at runtime.

提交回复
热议问题