Summary: | [compiler][null] non String objects references involved into string concatenation should not raise null ref. warnings | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | John Arthorne <john.arthorne> | ||||
Component: | Core | Assignee: | Maxime Daniel <maxime_daniel> | ||||
Status: | VERIFIED FIXED | QA Contact: | |||||
Severity: | normal | ||||||
Priority: | P3 | CC: | eclipse, max.gilead, michael.bartmann, nils.hammar, ricky_clarkson, tacpub | ||||
Version: | 3.2 | ||||||
Target Milestone: | 3.2 M6 | ||||||
Hardware: | PC | ||||||
OS: | Windows 2000 | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
John Arthorne
2006-02-14 16:58:37 EST
I guess this is similar enough (first use of o is treated as 'assumed to be non-null') to be considered second test case for this bug: public class Test { public void set(Object o) { System.out.println(o + (o == null ? "" : o.toString())); }} o == null part is reported as error: "The variable o cannot be null; it was either set to a non-null value or assumed to be non-null when last used". Sorry, after sumbitting last comment I was redirected to bug #128546 which, coincidentally, describes the issue I was describing. *** Bug 128546 has been marked as a duplicate of this bug. *** Changing the bug title, since the support for String concatenation was ok for String typed variables. Created attachment 35400 [details]
Fix with test cases
Applies to v_643.
Checked the current expression type for String into binary expressions and compound assignments, instead of doing a per local variable check.
Added NullReferenceTest tests # 123, 124 and 125.
Fixed and released in HEAD. *** Bug 132867 has been marked as a duplicate of this bug. *** *** Bug 133335 has been marked as a duplicate of this bug. *** Verified for 3.2 M6 using warm-up build I20060327-0010. *** Bug 136512 has been marked as a duplicate of this bug. *** |