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]

java/1313: NullPointerException trying to access field in outer class from inner class initializer



>Number:         1313
>Category:       java
>Synopsis:       NullPointerException trying to access field in outer class from inner class initializer
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apbianco
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 20 12:18:56 PST 2000
>Closed-Date:    Fri Oct 20 03:29:58 PDT 2000
>Last-Modified:  Fri Oct 20 03:30:01 PDT 2000
>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:

Formerly PR gcj/291

State-Changed-From-To: open->feedback
State-Changed-By: apbianco
State-Changed-When: Thu Oct 19 21:23:01 2000
State-Changed-Why:
    I think yesterday's patch fixed it:
      http://gcc.gnu.org/ml/gcc-patches/2000-10/msg00629.html

From: apbianco@cygnus.com
To: apbianco@cygnus.com, bryce@albatross.co.nz,
  java-gnats@sourceware.cygnus.com
Cc:  
Subject: Re: gcj/291
Date: 20 Oct 2000 04:23:01 -0000

 Synopsis: NullPointerException trying to access field in outer class from inner class initializer
 
 State-Changed-From-To: open->feedback
 State-Changed-By: apbianco
 State-Changed-When: Thu Oct 19 21:23:01 2000
 State-Changed-Why:
     I think yesterday's patch fixed it:
       http://gcc.gnu.org/ml/gcc-patches/2000-10/msg00629.html
 
 http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view&pr=291&database=java
State-Changed-From-To: feedback->closed
State-Changed-By: bryce
State-Changed-When: Fri Oct 20 03:29:58 2000
State-Changed-Why:
    Fix works for me. Thanks.

From: bryce@albatross.co.nz
To: apbianco@cygnus.com, bryce@albatross.co.nz,
  java-gnats@sourceware.cygnus.com
Cc:  
Subject: Re: gcj/291
Date: 20 Oct 2000 10:29:58 -0000

 Synopsis: NullPointerException trying to access field in outer class from inner class initializer
 
 State-Changed-From-To: feedback->closed
 State-Changed-By: bryce
 State-Changed-When: Fri Oct 20 03:29:58 2000
 State-Changed-Why:
     Fix works for me. Thanks.
 
 http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view&pr=291&database=java
>Unformatted:



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