does Java type erasure erase my generic type?

前端 未结 5 1565
执念已碎
执念已碎 2020-12-25 07:53

I\'ve thought java erasure wipes generic types out in compile time however when i test it by myself i realized there are some information about generic types in Bytecode.

5条回答
  •  旧时难觅i
    2020-12-25 08:54

    Erasure means that generic typing is not incorporated in the byte code (when the list is created or used).

    The signature you see is used just to indicate that the field is generic.

提交回复
热议问题