This is the mail archive of the java-discuss@sources.redhat.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

GCJ Bug accessing field of inner class (gcc version 2.97 20010117)


GCJ appears to be unable to access the field of an inner class from within a different class.  Here's a simple example:


package A;

public class HasInnerClass {

    InnerClass ic0;

    public HasInnerClass() {
        ic0 = new InnerClass();
        System.err.println("In HasInnerClass(), ic0.s = " + ic0.s);
    }

    public class InnerClass {
        String s;
        int i;

        public InnerClass() {
            s = "A stringggggggggggggggggggggggggggggggggggggggg";
            i = 123;
        }
    }

    public InnerClass newInnerClass() { return( new InnerClass() ); }
}
 


package A;

public class UsesInnerClass {

    public UsesInnerClass() {
 
        HasInnerClass hic = new HasInnerClass();
        System.err.println( "In UsesInnerClass(), hic.ic0.s = " + hic.ic0.s);
    }

    public static void main(String[] argv) { new UsesInnerClass(); }
}


After compiling with gcj, gcc version 2.97 20010117 (experimental),  running  it yields

In HasInnerClass(), ic0.s = A stringggggggggggggggggggggggggggggggggggggggg
Out of Memory!  Returning NIL!
instead of
In HasInnerClass(), ic0.s = A stringggggggggggggggggggggggggggggggggggggggg
In UsesInnerClass(), hic.ic0.s = A stringggggggggggggggggggggggggggggggggggggggg
 
Is this a known bug?

Regards,

Barnet Wagman


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]