Value classes introduce unwanted public methods

前端 未结 5 2276
孤街浪徒
孤街浪徒 2021-02-19 03:44

Looking at some scala-docs of my libraries, it appeared to me that there is some unwanted noise from value classes. For example:

implicit class RichInt(val i: In         


        
5条回答
  •  遇见更好的自我
    2021-02-19 04:06

    In Scala 2.11 you can make the val private, which fixes this issue:

    implicit class RichInt(private val i: Int) extends AnyVal {
      def squared = i * i
    }
    

提交回复
热议问题