Robin Green
Robin Green

Reputation: 33033

Package private modifier in Scala 2.8

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...?

Upvotes: 25

Views: 17370

Answers (1)

Nikita Ignatov
Nikita Ignatov

Reputation: 7163

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)

Upvotes: 52

Related Questions