Message1052

Author strandpyper
Recipients
Date 2005-10-19.11:13:09
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Consider the the following 3 java classes.

// ---- A.java ----
package x;

// package private class
class A {
    public void f() {
    System.out.println("f");
    }
}

// ---- B.java ----
package x;

// public class extending from a package private class
public class B extends A {
    public void g() {
    System.out.println("g");
    }
}

// ---- C.java ----
import x.*;

public class C {
    public static void main(String[] args) {
        B.g();
        B.f();
    }
}

The class C compiles without errors and runs without any 
problems. But it does not work in jython.


    >>> from x import B
    >>> dir(B)
    ['g']
    >>> b = B()
    >>> b.g()
    g
    >>> b.f()
    Traceback (innermost last):
      File "<console>", line 1, in ?
    AttributeError: 'javainstance' object has no attribute 'f'

    # but there are available in java.
    >>> for m in B.getMethods(): print m.getName()
    g
    f
    hashCode
    getClass
    wait
    wait
    wait
    equals
    notify
    notifyAll
    toString
History
Date User Action Args
2008-02-20 17:17:26adminlinkissue1331437 messages
2008-02-20 17:17:26admincreate