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/4695: Error calling method from enclosing context in constructor



>Number:         4695
>Category:       java
>Synopsis:       Error calling method from enclosing context in constructor
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 25 20:16:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Bryce McKinlay
>Release:        trunk
>Organization:
>Environment:

>Description:
Another test case distilled from classpath's TreeMap.

GCJ reports: EnclosingCall.java:12: Can't reference `this' before the superclass constructor has been called.

... but we don't need to access this to call foo() - only this$0.
>How-To-Repeat:
public class EnclosingCall
{
  int foo()
  {
    return 5;
  }
  
  class Inner
  {
    Inner()
    {
      this(foo()); 
    }
    
    Inner (int i)
    {
    }
  }
}
>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]