Method has the same erasure as another method in type

前端 未结 7 846
时光取名叫无心
时光取名叫无心 2020-11-22 05:50

Why is it not legal to have the following two methods in the same class?

class Test{
   void add(Set ii){}
   void add(Set ss){}         


        
7条回答
  •  时光取名叫无心
    2020-11-22 06:46

    It could be possible that the compiler translates Set(Integer) to Set(Object) in java byte code. If this is the case, Set(Integer) would be used only at compile phase for syntax checking.

提交回复
热议问题