Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 431965 - [compiler][null] Warnings not reported for objects not initialized
Summary: [compiler][null] Warnings not reported for objects not initialized
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.4   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 431722 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-04-03 23:54 EDT by shankha banerjee CLA
Modified: 2014-04-04 06:05 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description shankha banerjee CLA 2014-04-03 23:54:39 EDT
Refiling the issue as misunderstood the original issue (Bug 431722).

@NonNullByDefault
class Y {}
public class X {
	Y y;    // Warning should be reported here.
	Y[] y1; // Warning should be reported.
        void bar () {
            y = new Y();
            y1 = new Y[0];
        }
}

Warnings should be reported as the fields y and y1 are not initialized either through constructor or initialization as part of field declaration.

If any one of the constructors does not initialize the field we should report 
a warning.

Thanks
Comment 1 shankha banerjee CLA 2014-04-03 23:55:10 EDT
*** Bug 431722 has been marked as a duplicate of this bug. ***
Comment 2 Stephan Herrmann CLA 2014-04-04 06:05:47 EDT
You still don't have a @NonNullByDefault affecting X.

If you correct the test all expected warnings will be shown.