Consider the following classes:
//A.java:
public interface A {
public static final String HIGHER = "higher";
}
//B.java:
public class B implements A {
public static final String LOWER = "lower";
}
In java code I have access to both HIGHER and LOWER fields:
//JavaClient.java:
public class JavaClient {
public static void main(String[] args) {
System.out.println(B.HIGHER);
System.out.println(B.LOWER);
}
}
But I cannot do the same thing in Scala!
//ScalaClient.scala:
object ScalaClient {
def main (args: Array[String]) {
println(B.HIGHER) // Compilation error
println(B.LOWER) // OK
}
}
This is very unexpected for me. Why Scala cannot see inherited psf field? How to workaround?
Note: In my real code I don't have access to interface A, since it is protected and nested in another class.