0

I'm having a Scala trait A with an abstract method

trait A[T] {
  def self: T
}

Now it happened me that I want to extends a Java class not under my control with a field with the same name:

public class B<T> {
    protected T self;
}

I'd like to have a class C defined like

class C[T] extends B[T] with A[T] {
    override def self: T = /* the field `self` of `B` ??? */
}

Is it possible to access the field B.self somehow so that it doesn't resolve to the method A.self instead? Is it even possible to have a scenario like that?

Petr
  • 62,528
  • 13
  • 153
  • 317
  • Duplicate, see http://stackoverflow.com/a/16618569/1296806 which links to its duplicate – som-snytt Jul 09 '13 at 20:56
  • possible duplicate of [Making a public accessor from an inherited protected Java field](http://stackoverflow.com/questions/15591901/making-a-public-accessor-from-an-inherited-protected-java-field) – Petr Jul 09 '13 at 20:59

0 Answers0