This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

java/10335: Runtime error when trying to access an initialized static member.


>Number:         10335
>Category:       java
>Synopsis:       Runtime error when trying to access an initialized static member.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 07 11:56:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     marcel dot offermans at luminis dot nl
>Release:        gcc-3.2.2
>Organization:
>Environment:
RedHat Linux 7.3
>Description:
Compile the class below like this:

gcj --main=A A.java

And it will give you a NPE when you run it. Uncomment the System.out.println statement which accesses B.a prior to assigning anything to B.a.a and everything works fine.

public class A {
    public static void main(String[] args) {
        //System.out.println("" + B.a);
        B.a.a = "test";
    }
}

class B {
    public static class C {
        public String a;
    }
    public static C a = new C();
}
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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