Summary: | Bug in Java Parser | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Marcin Brodziak <brodziak> |
Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
Status: | CLOSED INVALID | QA Contact: | |
Severity: | major | ||
Priority: | P3 | ||
Version: | 3.1 | ||
Target Milestone: | 3.1 M4 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Marcin Brodziak
2004-12-04 16:39:23 EST
the if condition is not a constant, therefore it is possible that the then clause is not executed. So b might not be initialized. This is perfectly fine. You can notice that javac and jikes are reporting the same problem. Ok to close? Closing. The compiler is implementing the definite assignment rules strictly. Rather blame the language specification. I suppose you're right. Eclipse works in the same way as the compiler, so we cannot say, that this is as a bug. Although I still think, that it's silly. Conservative flow analysis is quite restrictive indeed. Also note that the null check 'if (a!=null)' is useless, and removing it will make your problem go away. FYI, we are working in adding an optional warning to our compiler to diagnose such unnecessary null checks. You'll get something like: ---------- 1. WARNING in d:\src\X.java (at line 9) if(a!=null) ^ The variable a cannot be null; it was either set to a non-null value or assumed to be non-null when last used ---------- |