Revert "add strict check for internal visibility during compilation"
This reverts commit d1ee58186f.
This commit is contained in:
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.descriptors;
|
||||
import kotlin.KotlinPackage;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.descriptors.impl.PackageFragmentDescriptorImpl;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ClassReceiver;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
|
||||
@@ -122,26 +121,10 @@ public class Visibilities {
|
||||
@Override
|
||||
public boolean isVisible(@NotNull ReceiverValue receiver, @NotNull DeclarationDescriptorWithVisibility what, @NotNull DeclarationDescriptor from) {
|
||||
DeclarationDescriptor fromOrModule = from instanceof PackageViewDescriptor ? ((PackageViewDescriptor) from).getModule() : from;
|
||||
if (!isInFriendModule(what, fromOrModule)) return false;
|
||||
|
||||
return isWithSourcesOrFromIncrementalPackageFragment(what) || !isWithSourcesOrFromIncrementalPackageFragment(from);
|
||||
return isInFriendModule(what, fromOrModule);
|
||||
}
|
||||
};
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static boolean isWithSourcesOrFromIncrementalPackageFragment(@NotNull DeclarationDescriptor descriptor) {
|
||||
SourceElement sourceElement = DescriptorUtils.getSourceElement(descriptor);
|
||||
if (sourceElement.isKotlinSourceElement()) return true;
|
||||
|
||||
PackageFragmentDescriptor containingPackage = DescriptorUtils.getParentOfType(descriptor, PackageFragmentDescriptor.class, false);
|
||||
|
||||
if (containingPackage instanceof PackageFragmentDescriptorImpl) {
|
||||
return ((PackageFragmentDescriptorImpl)containingPackage).isIncremental();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static final Visibility PUBLIC = new Visibility("public", true) {
|
||||
@Override
|
||||
public boolean mustCheckInImports() {
|
||||
|
||||
@@ -589,23 +589,6 @@ public class DescriptorUtils {
|
||||
return getJvmNameAnnotation(annotated.getAnnotations());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static SourceElement getSourceElement(@NotNull DeclarationDescriptor descriptor) {
|
||||
if (descriptor instanceof PropertySetterDescriptor) {
|
||||
descriptor = ((PropertySetterDescriptor) descriptor).getCorrespondingProperty();
|
||||
}
|
||||
|
||||
if (descriptor instanceof CallableMemberDescriptor && ((CallableMemberDescriptor)descriptor).getSource() == SourceElement.NO_SOURCE) {
|
||||
descriptor = descriptor.getContainingDeclaration();
|
||||
}
|
||||
|
||||
if (descriptor instanceof DeclarationDescriptorWithSource) {
|
||||
return ((DeclarationDescriptorWithSource) descriptor).getSource();
|
||||
}
|
||||
|
||||
return SourceElement.NO_SOURCE;
|
||||
}
|
||||
|
||||
private static void getSubPackagesFqNames(PackageViewDescriptor packageView, Set<FqName> result) {
|
||||
FqName fqName = packageView.getFqName();
|
||||
if (!fqName.isRoot()) {
|
||||
|
||||
Reference in New Issue
Block a user