Community
Participate
Working Groups
import static java.lang.Math.PI; public class Foo {} gives a warning, that the static import is never used (OK). If you declare a PI, the warning disappears (not OK): import static java.lang.Math.PI; public class Foo { boolean PI; } It seems that it does not matter where such a variable is declared in the compilation unit the warning always disappears. Note: you can use PI from Math in a different scope (OK): import static java.lang.Math.PI; public class Foo { double d = PI; // from Math void f() { boolean PI; } } class Bla { double d = PI; // from Math }
The field hiding detection support is causing the unused import to be used.
Fixed along with bug 81724.
Added regression test: StaticImportTest#test019. Fixed
Verified in I20050214