title: Inheriting a package-protected method by a class in a different package
body: <p>I'm in a situation where I have a need to mix in a trait defined in another package. To assist with testing, a protected method in this trait is package qualified. Here is an example:</p>
  
  <pre><code>package A {
    trait X {
      protected[A] def method(arg: Int)
    }
  }
  
  package B {
    class Y extends A.X {
      protected[A] def method(arg: Int) { }
    }
  }
  </code></pre>
  
  <p>Compiling this with scalac 2.9.1 yields:</p>
  
  <pre><code>test.scala:9: error: A is not an enclosing class
      protected[A] def method(arg: Int) { }
  </code></pre>
  
  <p>Changing the "protected[A]" in class Y to any other access modifier results in this:</p>
  
  <pre><code>test.scala:9: error: overriding method method in trait X of type (arg: Int)Unit;
   method method has weaker access privileges; it should be at least protected[A]
      override protected def method(arg: Int) { }
  </code></pre>
  
  <p>My question is this: Assuming the definition of trait X can not change, is there any change to class Y that would allow it to extend trait X? (while retaining some level of 'protected' access)</p>
  
  <p>If this is not possible, are there any other recommended design strategies to work around this? (other than making 'method' public)</p>