Scala avoid using null

前端 未结 5 1959
情深已故
情深已故 2021-01-18 04:07

I hava a project on github that is analysed by codacy . The analysis suggest to \"Avoid using null\" for the following line of code:

def doS         


        
5条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-18 04:16

    If path might actually be null this is probably the simplest.

    require(Option(path).isDefined, "Must have a real Path")
    

提交回复
热议问题