Menu

#355 Null Boolean autoboxing to boolean and instantly using

3.x
closed-rejected
nobody
5
2018-03-12
2016-04-06
No

Came across an issues that might be useful if FindBugs could detect.

1; public Boolean getter() {
2; return null;
3; }
4;
5; public void test() {
6; System.out.println( !getter() );
7; }

FindBugs already displays a warning for line 2, regarding potential null.

But line 6 regarding autoboxing a Boolean to boolean throws a NullPointerException, so might be useful to class as error for others.

Discussion

  • Andrey Loskutov

    Andrey Loskutov - 2017-10-22
    • Labels: --> report on spotbugs
    • Status: open --> closed-rejected
     

Log in to post a comment.