This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 262557

Summary: Incorrect hint "Unused Assignment" for context with System.exit()
Product: java Reporter: matthies <matthies>
Component: HintsAssignee: Svata Dedic <sdedic>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P3    
Version: 8.1   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:

Description matthies 2016-06-23 23:32:41 UTC
Example:

    void foo(boolean condition)
    {
        String s = null;
        if (condition)
        {
            s = "foo";
        }
        else {
            System.exit(0);
        }
        System.out.println(s);
    }

This shows the hint for 's = null'. However, when removing the assignment, the result is a compile error on the last line, "variable s might not have been initialized".

The hint shouldn't take the exit() call into account because the Java compiler doesn't either.
Comment 1 Svata Dedic 2016-07-26 21:14:14 UTC

*** This bug has been marked as a duplicate of bug 243830 ***