25

If I try

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

I get

[error]     ... ']' expected but '.' found.
[error]     private[com.
[error]                ^

What's with that? I can only make it package-private to com.*, or...?

Robin Green
  • 32,079
  • 16
  • 104
  • 187
  • Answered by @Nikita, but I like Robin's syntax better ... should propose it to be added as a language feature, makes more sense to me ... – YoYo Mar 27 '15 at 23:04

1 Answers1

51

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)
Nikita Ignatov
  • 6,872
  • 2
  • 34
  • 34