IR: check visibility when building fake overrides
This fixes the difference at least in the IR text test testFakeOverridesForJavaNonStaticMembers. There's no fake override created anymore for `packagePrivateMethod` in Test2. #KT-61366 Fixed
This commit is contained in:
committed by
Space Team
parent
a23f2894b2
commit
bb381e7aef
+6
@@ -20,6 +20,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.descriptors.java.JavaVisibilities;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
|
||||
|
||||
@@ -41,6 +42,11 @@ public class JavaDescriptorVisibilities {
|
||||
) {
|
||||
return areInSamePackage(what, from);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visibleFromPackage(@NotNull FqName fromPackage, @NotNull FqName myPackage) {
|
||||
return fromPackage.equals(myPackage);
|
||||
}
|
||||
};
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.descriptors
|
||||
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue
|
||||
|
||||
abstract class DescriptorVisibility protected constructor() {
|
||||
@@ -78,6 +79,8 @@ abstract class DescriptorVisibility protected constructor() {
|
||||
|
||||
// Should be overloaded in Java visibilities
|
||||
fun customEffectiveVisibility(): EffectiveVisibility? = delegate.customEffectiveVisibility()
|
||||
|
||||
open fun visibleFromPackage(fromPackage: FqName, myPackage: FqName): Boolean = true
|
||||
}
|
||||
|
||||
abstract class DelegatedDescriptorVisibility(override val delegate: Visibility) : DescriptorVisibility() {
|
||||
|
||||
Reference in New Issue
Block a user