gcj/291: NullPointerException trying to access field in outer class from inner class initializer
bryce@albatross.co.nz
bryce@albatross.co.nz
Mon Jul 24 04:16:00 GMT 2000
>Number: 291
>Category: gcj
>Synopsis: NullPointerException trying to access field in outer class from inner class initializer
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: apbianco
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jul 24 04:16:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Bryce McKinlay
>Release: gcc version 2.96 20000723 (experimental)
>Organization:
>Environment:
>Description:
Trying to access a field in an outer class from an inner class
field initializer results in a runtime crash.
>How-To-Repeat:
Compile and run this test case. The culprit is the "foo = bar"
statement.
public class InnerInitializer
{
public static void main(String args[])
{
new InnerInitializer().a();
}
int bar;
void a()
{
bar = 7;
new A();
}
class A
{
int foo = bar;
}
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Java-prs
mailing list