Community
Participate
Working Groups
Build Identifier: Version: Helios Service Release 2 Build id: 20110218-0911 Given these two classes: package p; public class A { protected int x; } package q; public class B extends A { public void bla(A a) { System.out.println(a.x); //(1) } } (1) is correctly identified as being in error (as we aren't in the same package as A, we can't access its protected variable "x". Note that since we haven't cast to B, it's irrelevant that B extends A, only the same-package rule is used.) However, as a fix eclipse suggests changing the visibility of x to protected, but it is already protected. If the "extends A" is removed from the definition of B, the eclipse-suggested fix is, Change x to be public. Which should be the suggested fix here too. Reproducible: Always Steps to Reproduce: Reproduced using these two packages/classes: package p; public class A { protected int x; } package q; public class B extends A { public void bla(A a) { System.out.println(a.x); } }
Moving to JDT/UI. See also bug 341209
*** This bug has been marked as a duplicate of bug 65876 ***