Forum Stats

  • 3,733,357 Users
  • 2,246,747 Discussions
  • 7,856,667 Comments

Discussions

javac in 8u20 reports errors 8u11 does not

The following builds with 8u11, but not 8u20.  I think this ultimately found a logic error in the code I was working on that had been lingering there for years, but I just want to confirm that this is not a compiler issue.

public class A  {

  public static class B {

    private int stuff;

  }

  private final B [] things;

  public A(boolean b, B ... things) {

    super();

    if (b && this.things == null) { // error reported against 'things' on this line

      this.things = new B[] { };

    } else {

      this.things = things;

    }

  }

}

I believe the original intention was to check the parameter "things" not the field "this.things" anyway.. but I found it interesting that the code didn't report any issues until 8u20.

This discussion has been closed.