| Summary: | "The local variable is never read" warning is not shown after "if (true) return" | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | ivan.vergiliev |
| Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
| Status: | ASSIGNED --- | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | ivan.vergiliev, Olivier_Thomann, stephan.herrmann |
| Version: | 3.7 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | stalebug | ||
Since the code is never generated, the warning is not reported. If you enable the warning for dead code, you would get a dead code warning. The generation of this warning will be revisited for 3.8. My point with the last line was that if I write this:
void f() {
if (true) {
return;
}
int a = 5;
a = a;
}
I do get a warning about a = a, even though that code is supposedly not generated - meaning that only some warnings are hidden, not all.
This just depends at what moment in the compilation process the warning is reported. The warning for local variable being unread is right now generated at the code generation time. Some others warnings are reported during type resolution. Stephan, do you think we can tackle this one with the changes you wanted to make into the code analysis ? (In reply to comment #3) > Stephan, do you think we can tackle this one with the changes you wanted to > make into the code analysis ? Were you thinking about the group around bug 328830? I'll look at it once some of the other bugs with work in progress are resolved. Not much I can do without a solution in bug 328830. That one, however, should better be addressed in some M1 or M2 at the latest. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
Build Identifier: 20110124_1224 In the following code: void f() { if (true) { return; } int a = 5; } no warning is shown about the variable a not being read. If I add "a = a;" afterwards, I do get a "The assignment to variable a has no effect" warning. Reproducible: Always