biddyweb / checker-framework

Automatically exported from code.google.com/p/checker-framework
Other
0 stars 1 forks source link

Implicit "this" passed through non-static inner class loses @UnderInitialization #409

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The following code fails at runtime with an NPE, but does not cause an error in 
the checker framework. I'm guessing, but I believe this is because when I call 
p.call(), the "this" which is passed through to the inner class loses it's 
@UnderInitialization.

class Callback {
  static interface Proc {
    void call();
  }

  Proc p;

  class MyProc implements Proc {
    @Override
    public void call() {
      doStuff();
    }
  }

  String foo;

  Callback() {
    p = new MyProc();
    p.call();
    foo = "hello";
  }

  void doStuff() {
    System.out.println(foo.toLowerCase());
  }

  public static void main(String[] args) {
    new Callback();
  }
}

Original issue reported on code.google.com by eatnumb...@google.com on 9 Mar 2015 at 8:41

GoogleCodeExporter commented 9 years ago
Ping. Can someone take a look at this?

Original comment by eatnumb...@google.com on 17 Mar 2015 at 12:30

GoogleCodeExporter commented 9 years ago
Thanks for the test case! I can reproduce the issue and am looking into it.

Original comment by wdi...@gmail.com on 17 Mar 2015 at 3:03