Community
Participate
Working Groups
example: package foo; class BaseFoo { public static final int VAL = 0; } package foo; public class NextFoo extends BaseFoo { } package bar; public class Bar { int v = NextFoo.VAL; // this line! } Eclipse displays warning on "this line" that "The static field NextFoo.VAL should be accessed directly", and Quick-Fixes this by changing "this line" to: int v = BaseFoo.VAL; // this line! witch is wrong, because BaseFoo is not public class, and Bar is in diferent package than BaseFoo. It causes compilation error.
Moving to JDT UI
Quick fixes don't promise to not break anything, they are more thought of helping the user as a step in its coding routine. So here, the next step would be to make the base class visible. The question is, should the compiler really mark this as a warning? The variable can't be accessed directly, so maybe it's better to not complain. Moving to jdt.core to discuss this.
Good point. The warning should only surface if the declaring class is actually visible, need an extra check before emitting the warning.
Released for 3.3M4. Added regression tests in org.eclipse.jdt.core.tests.compiler.regression.FieldAccessTest#test001/004
Verified for 3.3 M4 using build I20061212-0010.