Community
Participate
Working Groups
Try this source code fragment in Eclipse 3.1M7 it has some incorrect: import static java.lang.Math.sqrt; public class PointRadius { public static void main(String[] args) { double radius = 0; radius = sqrt(pondArea / Math.PI); } } Now try to remove Math. before Math.PI, it will have an warning "The import java.lang.Math.sqrt is never used". It's not correct! Please check it!
Created attachment 21412 [details] Figure
I guess it says that because once you have an error in "pondArea / PI", the method binding for sqrt(...) could not be retrieved leading to the warning.
Yes, when I try to remove "Math." before "PI", it means PI is not declared, then it shows the warning. But I think it's not correct when show this warning. I used sqrt(...), my problem is I did not declare PI variable only. Is it clear?
Yes, this is inconsistent. Normally in presence of errors, this warning doesn't show up. But we do seem to have a bug here. Reproduced.
*** Bug 89047 has been marked as a duplicate of this bug. ***
The check for unused imports was only disabled in presence of syntax errors. But in certain situations, some errors may hinder its accuracy. Changed check to only perform if after resolution no error got detected. Fixed, toggled various tests which exposed old behavior.
Verified on build I20050527-0010.