logo       

issue with inherited static members in java interfaces (possible bug?): msg#00047

lang.scala

Subject: issue with inherited static members in java interfaces (possible bug?)

Hi,

Noticed something a bit odd (am using Scala2), here is a minimal test case:

// I1.java
package test;

public interface I1 {
    public static final int i = 1;
}

// I2.java
package test;

public interface I2 extends I1 {
    public static final String s = "foo";
}

// test.scala
object testi {
  import test._;
  import test.I2._;

  def main(args: Array[String]): Unit = {
    I1.i; // ok
    I2.s // ok
    I2.i; // nope. compile-time error: 'value i is not a member of test.I2'

    s; // ok
    i; // still no luck: ' error: not found: value i'
  }
}

Is this a bug or intended behavior?

Thanks,
Jason
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise