type erasure in implementation of ArrayList in Java

前端 未结 3 1358
自闭症患者
自闭症患者 2021-02-08 00:16

I was reading this article on Java Generics and there it is mentioned that the constructor for an ArrayList looks somewhat like this:

class ArrayLis         


        
3条回答
  •  春和景丽
    2021-02-08 00:35

    Good Question.The type checking is done first.If everything compiles(that is,after it has provided compile type safety) does type erasure occur.

    Again,lot of things happen as part of type erasure which includes:-

    1)Adding casts 
    2) creating bridge methods
    

    But type checking is done first,everything happens later

提交回复
热议问题