Summary: | [compiler] Assert statement discrepancy with javac caused by an uninitialized variable | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Remy Suen <remy.suen> | ||||
Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> | ||||
Status: | VERIFIED FIXED | QA Contact: | |||||
Severity: | normal | ||||||
Priority: | P3 | CC: | jerome_lanneluc, philippe_mulet | ||||
Version: | 3.5 | ||||||
Target Milestone: | 3.5 M4 | ||||||
Hardware: | All | ||||||
OS: | All | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
Remy Suen
2008-11-12 05:42:41 EST
Scratch the above, I was trying to make a more compact test case and failed. Try this one. public class Test { protected void transform(boolean srcPts) { final float error; assert !(srcPts && (error = maxError()) > 0) : error; } private float maxError() { return 0; } } This is indeed our bug (for comment 1). The code should essentially be the same as: float foo1(boolean srcPts) { final float error2; if (!(srcPts && (error2 = maxError()) > 0)) { } else { return error2; } return 0; } where ECJ correctly accepts the code as correct. Created attachment 119813 [details]
Proposed patch
Added AssertionTest#test017 Released for 3.5M4. Fixed Verified for 3.5M4 using I20081211-0100 |