Scala double definition (2 methods have the same type erasure)
问题 I wrote this in scala and it won't compile: class TestDoubleDef{ def foo(p:List[String]) = {} def foo(p:List[Int]) = {} } the compiler notify: [error] double definition: [error] method foo:(List[String])Unit and [error] method foo:(List[Int])Unit at line 120 [error] have same type after erasure: (List)Unit I know JVM has no native support for generics so I understand this error. I could write wrappers for List[String] and List[Int] but I'm lazy :) I'm doubtful but, is there another way