This is the mail archive of the gcc-bugs@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/1970: Can't instantiate local class in static method



>Number:         1970
>Category:       java
>Synopsis:       Can't instantiate local class in static method
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 13 18:36:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Bryce McKinlay
>Release:        gcc version 2.97 20010207 (experimental)
>Organization:
>Environment:

>Description:
Try to compile the test case below.

gcj reports:

$ gcj -c StaticLocal.java 
StaticLocal.java: In class `StaticLocal':
StaticLocal.java: In method `StaticLocal.a()':
StaticLocal.java:7: No enclosing instance for inner class `StaticLocal$Foo' is in scope.
       new Foo();
           ^
1 error
>How-To-Repeat:
class StaticLocal
{
  static void a()
  {
    class Foo {}    
    new Foo();
  }
}
>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]