[java] report access to package-private members declared in production code from tests (IDEA-372858)

GitOrigin-RevId: 6f046186e0f0a587e1aaab31dd55b9f76a28db96
This commit is contained in:
Nikolay Chashnikov
2025-05-19 10:03:24 +00:00
committed by intellij-monorepo-bot
parent 4e72b9064c
commit d039e59e88
7 changed files with 80 additions and 15 deletions
@@ -0,0 +1,3 @@
package xxx;
class AnotherPackagePrivateClass {}
@@ -0,0 +1,15 @@
package xxx;
public class PackagePrivateClassTest extends PublicClass {
public void test1() {
new <warning descr="Class xxx.PackagePrivateClass is package-private and used in tests, but declared in the production source">PackagePrivateClass</warning>();
}
public void test2() {
new AnotherPackagePrivateClass();
}
@Override
public void <warning descr="Method packagePrivateMethod() in tests overrides a package-private method from class xxx.PublicClass which is declared in the production source">packagePrivateMethod</warning>(){
}
}