forbid access to package local statics via inheritance from another package (IDEA-66493)

This commit is contained in:
anna
2013-07-17 16:26:18 +02:00
parent 915fddf648
commit 650fdb9ff1
5 changed files with 33 additions and 1 deletions
@@ -0,0 +1,6 @@
package p1;
public class A {
static int FOO = 0;
static void foo(){}
}
@@ -0,0 +1,16 @@
package p1;
import p2.B;
public class C extends B {
void f(){
System.out.println(<error descr="'FOO' is not public in 'p1.A'. Cannot be accessed from outside package">FOO</error>);
<error descr="'foo()' is not public in 'p1.A'. Cannot be accessed from outside package">foo</error>();
System.out.println(A.FOO);
A.foo();
System.out.println(B.<error descr="'FOO' is not public in 'p1.A'. Cannot be accessed from outside package">FOO</error>);
B.<error descr="'foo()' is not public in 'p1.A'. Cannot be accessed from outside package">foo</error>();
}
}
@@ -0,0 +1,6 @@
package p2;
import p1.A;
public class B extends A {
}