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 - Incorrect hint "Unused Assignment" for context with System.exit()
Summary: Incorrect hint "Unused Assignment" for context with System.exit()
Status: RESOLVED DUPLICATE of bug 243830
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-23 23:32 UTC by matthies
Modified: 2016-07-26 21:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***