This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
java/10335: Runtime error when trying to access an initialized static member.
- From: marcel dot offermans at luminis dot nl
- To: gcc-gnats at gcc dot gnu dot org
- Date: 7 Apr 2003 11:55:43 -0000
- Subject: java/10335: Runtime error when trying to access an initialized static member.
- Reply-to: marcel dot offermans at luminis dot nl
>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: