logo       

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

lang.scala

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

On 2/10/06, Adriaan Moors <adriaan.moors@xxxxxxxxxxxxxx> wrote:

As far as I know, this is consistent with how it works in Java: static members aren't inherited. So I guess that it's intended to work this way.


Hmmmm... empirically this does not appear to be the 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.java

import test.*;

class Test
{
    public static void main(String[] args) {
        System.out.println(I2.i); // ok
        System.out.println(I2.s); // ok
    }
}

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

News | FAQ | advertise