History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEA-19200
Type: Bug Bug
Status: Open Open
Assignee: Alexey Kudravtsev
Reporter: Serge Baranov
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
IDEA: Feedback

Bad code is green: cannot reference this before supertype constructor has been called

Created: 18 Aug 08 12:49   Updated: 10 Oct 08 14:10
Component/s: Editor. Error Highlighting

Build: 7,941
Severity: Medium


 Description  « Hide
Support feedback:
public class Test {
  protected Test() {
  }
  /* static */ class Test1 extends Test {
    Test1() {
      super();
    }
  }
  static class Test2 extends Test1 {
    Test2() {
      super();
    }
  }
  public static void main(String[] args) {
     new Test2();
  }
}

Compilation error:

Error(19,6) cannot reference this before supertype constructor has been called

java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode, sharing)



 All   Comments   Work Log   Change History      Sort Order:
Eugene Vigdorchik - 10 Oct 08 14:10
Javac error is not really helpful. What I see happening is Test1 class expected to be constructed in the environment including outer class' instance. However when calling 'super()' from Test2 constructor no such instance is given since Test2 is static.