Make protected static visibility reach members in the same package
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
// FILE: test/JavaClass.java
|
||||
|
||||
package test;
|
||||
|
||||
public class JavaClass {
|
||||
protected static int field;
|
||||
|
||||
protected static String method() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
package test
|
||||
|
||||
fun test() {
|
||||
JavaClass.field
|
||||
JavaClass.method()
|
||||
}
|
||||
@@ -5032,6 +5032,11 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
doTest("compiler/testData/diagnostics/tests/j+k/packageVisibility.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("protectedStaticSamePackage.kt")
|
||||
public void testProtectedStaticSamePackage() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/j+k/protectedStaticSamePackage.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("recursiveRawUpperBound.kt")
|
||||
public void testRecursiveRawUpperBound() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/j+k/recursiveRawUpperBound.kt");
|
||||
|
||||
+4
@@ -54,6 +54,10 @@ public class JavaVisibilities {
|
||||
public static final Visibility PROTECTED_STATIC_VISIBILITY = new Visibility("protected_static", false) {
|
||||
@Override
|
||||
protected boolean isVisible(@NotNull DeclarationDescriptorWithVisibility what, @NotNull DeclarationDescriptor from) {
|
||||
if (areInSamePackage(what, from)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
ClassDescriptor fromClass = DescriptorUtils.getParentOfType(from, ClassDescriptor.class, false);
|
||||
if (fromClass == null) return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user