Package private modifier in Scala 2.8

前端 未结 1 1405
面向向阳花
面向向阳花 2020-12-18 17:55

If I try

private[com.company.foo] def bar(xml: XmlPath) = {

I get

[error]     ... \']\' expected but \'.\' found.
[error]           


        
相关标签:
1条回答
  • 2020-12-18 18:48

    You can only define the enclosing package, within which the code is defined:

    package com.company.foo
    
    class Bar{
      private[foo] def bar(xml: XmlPath)
    }    
    

    and if you want to set it to company:

    private[company] def bar(xml: XmlPath)
    
    0 讨论(0)
提交回复
热议问题