Summary: | [compiler][null] Warning about Redundant assignment conflicts with definite assignment analysis | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | keesvr | ||||
Component: | Core | Assignee: | Stephan Herrmann <stephan.herrmann> | ||||
Status: | VERIFIED FIXED | QA Contact: | |||||
Severity: | normal | ||||||
Priority: | P3 | CC: | amj87.iitr, stephan.herrmann | ||||
Version: | 3.7 | ||||||
Target Milestone: | 3.7 M6 | ||||||
Hardware: | Macintosh | ||||||
OS: | Mac OS X - Carbon (unsup.) | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
keesvr
2011-02-26 06:30:55 EST
I can reproduce in HEAD using the following self-contained version of the test case: import java.io.File; import java.io.IOException; public class Bug338303 { Object test(Object in, final File f) { Object local; try { local = in; if (local == null) local = loadEntry(f, false); } catch (final IOException e) { e.printStackTrace(); local = null; } return local; } private Object loadEntry(File f, boolean b) throws IOException { throw new IOException(); } } We'll look into this. Thanks for the report. Created attachment 189900 [details]
test & proposed fix
I was pleased to see how well localized this can be fixed: with this
patch we simply refuse to report an assignment to a local as redundant
if the lhs has the bit FirstAssignmentToLocal set.
I believe that's exactly what we need to express here.
Compiler regression tests are currently running.
Released for 3.7M6 Verified for 3.7M6 using build I20110301-1357 |