Allowed accessing private members from same package, but different package fragment instance.
This commit is contained in:
@@ -53,6 +53,11 @@ public class Visibilities {
|
||||
if (parent == fromParent) {
|
||||
return true;
|
||||
}
|
||||
if (fromParent instanceof PackageFragmentDescriptor) {
|
||||
return parent instanceof PackageFragmentDescriptor
|
||||
&& ((PackageFragmentDescriptor) parent).getFqName().equals(((PackageFragmentDescriptor) fromParent).getFqName())
|
||||
&& DescriptorUtils.areInSameModule(fromParent, parent);
|
||||
}
|
||||
fromParent = fromParent.getContainingDeclaration();
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -109,6 +109,12 @@ public class IncrementalJpsTestGenerated extends AbstractIncrementalJpsTest {
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class PureKotlin extends AbstractIncrementalJpsTest {
|
||||
@TestMetadata("accessPrivateMembers")
|
||||
public void testAccessPrivateMembers() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("jps-plugin/testData/incremental/pureKotlin/accessPrivateMembers/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("accessingFunctionsViaPackagePart")
|
||||
public void testAccessingFunctionsViaPackagePart() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("jps-plugin/testData/incremental/pureKotlin/accessingFunctionsViaPackagePart/");
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package test
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val x: Foo = Foo()
|
||||
foo()
|
||||
c
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package test
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val x: Foo = Foo()
|
||||
foo()
|
||||
c
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
Cleaning output files:
|
||||
out/production/module/test/TestPackage$bar$*.class
|
||||
out/production/module/test/TestPackage.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/bar.kt
|
||||
End of files
|
||||
@@ -0,0 +1,9 @@
|
||||
package test
|
||||
|
||||
private class Foo
|
||||
|
||||
private fun foo() {
|
||||
|
||||
}
|
||||
|
||||
private val c = 1
|
||||
Reference in New Issue
Block a user