diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index ae11b637fcf..1f833a5b7a2 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -74,13 +74,13 @@ public interface Errors { DiagnosticFactory3 INVISIBLE_MEMBER = DiagnosticFactory3.create(ERROR, CALL_ELEMENT); // Exposed visibility group - DiagnosticFactory2 EXPOSED_PROPERTY_TYPE = DiagnosticFactory2.create(ERROR); - DiagnosticFactory2 EXPOSED_FUNCTION_RETURN_TYPE = DiagnosticFactory2.create(ERROR); - DiagnosticFactory2 EXPOSED_PARAMETER_TYPE = DiagnosticFactory2.create(ERROR); - DiagnosticFactory2 EXPOSED_RECEIVER_TYPE = DiagnosticFactory2.create(ERROR); - DiagnosticFactory2 EXPOSED_TYPE_PARAMETER_BOUND = DiagnosticFactory2.create(ERROR); - DiagnosticFactory2 EXPOSED_SUPER_CLASS = DiagnosticFactory2.create(ERROR); - DiagnosticFactory2 EXPOSED_SUPER_INTERFACE = DiagnosticFactory2.create(ERROR); + DiagnosticFactory3 EXPOSED_PROPERTY_TYPE = DiagnosticFactory3.create(ERROR); + DiagnosticFactory3 EXPOSED_FUNCTION_RETURN_TYPE = DiagnosticFactory3.create(ERROR); + DiagnosticFactory3 EXPOSED_PARAMETER_TYPE = DiagnosticFactory3.create(ERROR); + DiagnosticFactory3 EXPOSED_RECEIVER_TYPE = DiagnosticFactory3.create(ERROR); + DiagnosticFactory3 EXPOSED_TYPE_PARAMETER_BOUND = DiagnosticFactory3.create(ERROR); + DiagnosticFactory3 EXPOSED_SUPER_CLASS = DiagnosticFactory3.create(ERROR); + DiagnosticFactory3 EXPOSED_SUPER_INTERFACE = DiagnosticFactory3.create(ERROR); DiagnosticFactory2> INACCESSIBLE_TYPE = DiagnosticFactory2.create(ERROR); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index 2999e293565..a5cb609370d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -114,13 +114,13 @@ public class DefaultErrorMessages { MAP.put(INVISIBLE_REFERENCE, "Cannot access ''{0}'': it is ''{1}'' in {2}", NAME, TO_STRING, NAME_OF_PARENT_OR_FILE); MAP.put(INVISIBLE_MEMBER, "Cannot access ''{0}'': it is ''{1}'' in {2}", NAME, TO_STRING, NAME_OF_PARENT_OR_FILE); - MAP.put(EXPOSED_PROPERTY_TYPE, "Property effective visibility ''{0}'' should be the same or less permissive than its type effective visibility ''{1}''", TO_STRING, TO_STRING); - MAP.put(EXPOSED_FUNCTION_RETURN_TYPE, "Function effective visibility ''{0}'' should be the same or less permissive than its return type effective visibility ''{1}''", TO_STRING, TO_STRING); - MAP.put(EXPOSED_PARAMETER_TYPE, "Function effective visibility ''{0}'' should be the same or less permissive than its parameter type effective visibility ''{1}''", TO_STRING, TO_STRING); - MAP.put(EXPOSED_RECEIVER_TYPE, "Member effective visibility ''{0}'' should be the same or less permissive than its receiver type effective visibility ''{1}''", TO_STRING, TO_STRING); - MAP.put(EXPOSED_TYPE_PARAMETER_BOUND, "Generic effective visibility ''{0}'' should be the same or less permissive than its type parameter bound effective visibility ''{1}''", TO_STRING, TO_STRING); - MAP.put(EXPOSED_SUPER_CLASS, "Subclass effective visibility ''{0}'' should be the same or less permissive than its superclass effective visibility ''{1}''", TO_STRING, TO_STRING); - MAP.put(EXPOSED_SUPER_INTERFACE, "Sub-interface effective visibility ''{0}'' should be the same or less permissive than its super-interface effective visibility ''{1}''", TO_STRING, TO_STRING); + MAP.put(EXPOSED_PROPERTY_TYPE, "''{0}'' property exposes its ''{2}'' type{1}", TO_STRING, TO_STRING, TO_STRING); + MAP.put(EXPOSED_FUNCTION_RETURN_TYPE, "''{0}'' function exposes its ''{2}'' return type{1}", TO_STRING, TO_STRING, TO_STRING); + MAP.put(EXPOSED_PARAMETER_TYPE, "''{0}'' function exposes its ''{2}'' parameter type{1}", TO_STRING, TO_STRING, TO_STRING); + MAP.put(EXPOSED_RECEIVER_TYPE, "''{0}'' member exposes its ''{2}'' receiver type{1}", TO_STRING, TO_STRING, TO_STRING); + MAP.put(EXPOSED_TYPE_PARAMETER_BOUND, "''{0}'' generic exposes its ''{2}'' parameter bound type{1}", TO_STRING, TO_STRING, TO_STRING); + MAP.put(EXPOSED_SUPER_CLASS, "''{0}'' subclass exposes its ''{2}'' supertype{1}", TO_STRING, TO_STRING, TO_STRING); + MAP.put(EXPOSED_SUPER_INTERFACE, "''{0}'' sub-interface exposes its ''{2}'' supertype{1}", TO_STRING, TO_STRING, TO_STRING); MAP.put(INACCESSIBLE_TYPE, "Type {0} is inaccessible in this context due to: {1}", RENDER_TYPE, RENDER_COLLECTION_OF_TYPES); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.kt index d9102701336..423758ca810 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.kt @@ -278,9 +278,10 @@ class DeclarationsChecker( classDescriptor.declaredTypeParameters.forEachIndexed { i, typeParameterDescriptor -> if (i >= typeParameterList.size) return for (upperBound in typeParameterDescriptor.upperBounds) { - val upperBoundVisibility = upperBound.effectiveVisibility() - if (!upperBoundVisibility.sameOrMorePermissive(classVisibility)) { - trace.report(EXPOSED_TYPE_PARAMETER_BOUND.on(typeParameterList[i], classVisibility, upperBoundVisibility)) + val restricting = upperBound.dependentDescriptors().leastPermissive(classVisibility) + if (restricting != null) { + trace.report(EXPOSED_TYPE_PARAMETER_BOUND.on(typeParameterList[i], classVisibility, + restricting, restricting.effectiveVisibility())) break } } @@ -298,13 +299,15 @@ class DeclarationsChecker( if (superIsInterface != isInterface) { return@forEachIndexed } - val superTypeVisibility = superType.effectiveVisibility() - if (!superTypeVisibility.sameOrMorePermissive(classVisibility)) { + val restricting = superType.dependentDescriptors().leastPermissive(classVisibility) + if (restricting != null) { if (isInterface) { - trace.report(EXPOSED_SUPER_INTERFACE.on(delegationList[i], classVisibility, superTypeVisibility)) + trace.report(EXPOSED_SUPER_INTERFACE.on(delegationList[i], classVisibility, + restricting, restricting.effectiveVisibility())) } else { - trace.report(EXPOSED_SUPER_CLASS.on(delegationList[i], classVisibility, superTypeVisibility)) + trace.report(EXPOSED_SUPER_CLASS.on(delegationList[i], classVisibility, + restricting, restricting.effectiveVisibility())) } } } @@ -635,17 +638,19 @@ class DeclarationsChecker( if (typeReference == null) return val receiverParameterDescriptor = memberDescriptor.extensionReceiverParameter ?: return val memberVisibility = memberDescriptor.effectiveVisibility() - val receiverTypeVisibility = receiverParameterDescriptor.type.effectiveVisibility() - if (!receiverTypeVisibility.sameOrMorePermissive(memberVisibility)) { - trace.report(EXPOSED_RECEIVER_TYPE.on(typeReference, memberVisibility, receiverTypeVisibility)) + val restricting = receiverParameterDescriptor.type.dependentDescriptors().leastPermissive(memberVisibility) + if (restricting != null) { + trace.report(EXPOSED_RECEIVER_TYPE.on(typeReference, memberVisibility, + restricting, restricting.effectiveVisibility())) } } private fun checkPropertyExposedType(property: KtProperty, propertyDescriptor: PropertyDescriptor) { val propertyVisibility = propertyDescriptor.effectiveVisibility() - val typeVisibility = propertyDescriptor.type.effectiveVisibility() - if (!typeVisibility.sameOrMorePermissive(propertyVisibility)) { - trace.report(EXPOSED_PROPERTY_TYPE.on(property.nameIdentifier ?: property, propertyVisibility, typeVisibility)) + val restricting = propertyDescriptor.type.dependentDescriptors().leastPermissive(propertyVisibility) + if (restricting != null) { + trace.report(EXPOSED_PROPERTY_TYPE.on(property.nameIdentifier ?: property, propertyVisibility, + restricting, restricting.effectiveVisibility())) } checkMemberReceiverExposedType(property.receiverTypeReference, propertyDescriptor) } @@ -712,15 +717,17 @@ class DeclarationsChecker( private fun checkFunctionExposedType(function: KtFunction, functionDescriptor: FunctionDescriptor) { val functionVisibility = functionDescriptor.effectiveVisibility() if (function !is KtConstructor<*>) { - val returnTypeVisibility = functionDescriptor.returnType?.effectiveVisibility() - if (returnTypeVisibility != null && !returnTypeVisibility.sameOrMorePermissive(functionVisibility)) { - trace.report(EXPOSED_FUNCTION_RETURN_TYPE.on(function.nameIdentifier ?: function, functionVisibility, returnTypeVisibility)) + val restricting = functionDescriptor.returnType?.dependentDescriptors()?.leastPermissive(functionVisibility) + if (restricting != null) { + trace.report(EXPOSED_FUNCTION_RETURN_TYPE.on(function.nameIdentifier ?: function, functionVisibility, + restricting, restricting.effectiveVisibility())) } } functionDescriptor.valueParameters.forEachIndexed { i, parameterDescriptor -> - val typeVisibility = parameterDescriptor.type.effectiveVisibility() - if (!typeVisibility.sameOrMorePermissive(functionVisibility) && i < function.valueParameters.size) { - trace.report(EXPOSED_PARAMETER_TYPE.on(function.valueParameters[i], functionVisibility, typeVisibility)) + val restricting = parameterDescriptor.type.dependentDescriptors().leastPermissive(functionVisibility) + if (restricting != null && i < function.valueParameters.size) { + trace.report(EXPOSED_PARAMETER_TYPE.on(function.valueParameters[i], functionVisibility, + restricting, restricting.effectiveVisibility())) } } checkMemberReceiverExposedType(function.receiverTypeReference, functionDescriptor) diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/EffectiveVisibility.kt b/core/descriptors/src/org/jetbrains/kotlin/descriptors/EffectiveVisibility.kt index 8c2eb90fd1e..157477844ea 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/EffectiveVisibility.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/EffectiveVisibility.kt @@ -18,8 +18,8 @@ package org.jetbrains.kotlin.descriptors import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.types.KotlinType -import org.jetbrains.kotlin.types.TypeConstructor import org.jetbrains.kotlin.descriptors.EffectiveVisibility.* +import org.jetbrains.kotlin.descriptors.RelationToType.* sealed class EffectiveVisibility(val name: String, val publicApi: Boolean = false, val privateApi: Boolean = false) { @@ -179,11 +179,6 @@ sealed class EffectiveVisibility(val name: String, val publicApi: Boolean = fals abstract internal fun relation(other: EffectiveVisibility): Permissiveness - fun sameOrMorePermissive(other: EffectiveVisibility) = when (relation(other)) { - Permissiveness.SAME, Permissiveness.MORE -> true - Permissiveness.LESS, Permissiveness.UNKNOWN -> false - } - open internal fun lowerBound(other: EffectiveVisibility) = when (relation(other)) { Permissiveness.SAME, Permissiveness.LESS -> this Permissiveness.MORE -> other @@ -214,6 +209,9 @@ private fun lowerBound(first: EffectiveVisibility, second: EffectiveVisibility) private fun lowerBound(first: EffectiveVisibility, args: List) = args.fold(first, { x, y -> x.lowerBound(y) }) +private fun lowerBound(args: List) = + if (args.isEmpty()) Public else lowerBound(args.first(), args.subList(1, args.size)) + private fun Visibility.forVisibility(descriptor: ClassDescriptor? = null): EffectiveVisibility = when (this) { Visibilities.PRIVATE, Visibilities.PRIVATE_TO_THIS -> Private Visibilities.PROTECTED -> Protected(descriptor) @@ -225,9 +223,30 @@ private fun Visibility.forVisibility(descriptor: ClassDescriptor? = null): Effec fun effectiveVisibility(visibility: Visibility, descriptor: ClassDescriptor?) = visibility.forVisibility(descriptor) -private fun ClassifierDescriptor.effectiveVisibility(): EffectiveVisibility = - lowerBound(if (this is ClassDescriptor) this.effectiveVisibility() else Public, - (this.containingDeclaration as? ClassifierDescriptor)?.effectiveVisibility() ?: Public) +enum class RelationToType(val description: String) { + CONSTRUCTOR(""), + CONTAINER(" containing declaration"), + ARGUMENT(" argument"), + ARGUMENT_CONTAINER(" argument containing declaration"); + + fun containerRelation() = when (this) { + CONSTRUCTOR, CONTAINER -> CONTAINER + ARGUMENT, ARGUMENT_CONTAINER -> ARGUMENT_CONTAINER + } + + override fun toString() = description +} + +data class DescriptorWithRelation(val descriptor: ClassifierDescriptor, val relation: RelationToType) { + fun effectiveVisibility() = + (descriptor as? ClassDescriptor)?.visibility?.effectiveVisibility(descriptor.containingDeclaration as? ClassDescriptor) ?: Public + + override fun toString() = "$relation ${descriptor.name}" +} + +private fun ClassifierDescriptor.dependentDescriptors(ownRelation: RelationToType): Set = + setOf(DescriptorWithRelation(this, ownRelation)) + + ((this.containingDeclaration as? ClassifierDescriptor)?.dependentDescriptors(ownRelation.containerRelation()) ?: emptySet()) fun ClassDescriptor.effectiveVisibility() = effectiveVisibility(emptySet()) @@ -237,15 +256,28 @@ private fun ClassDescriptor.effectiveVisibility(classes: Set): lowerBound(visibility.effectiveVisibility(this), this?.effectiveVisibility(classes + this@effectiveVisibility) ?: Public) } -fun KotlinType.effectiveVisibility() = effectiveVisibility(emptySet()) +// Should collect all dependent classifier descriptors, to get verbose diagnostic +fun KotlinType.dependentDescriptors() = dependentDescriptors(emptySet(), CONSTRUCTOR) -private fun KotlinType.effectiveVisibility(types: Set): EffectiveVisibility = - if (this in types) Public - else lowerBound(constructor.effectiveVisibility(), - arguments.map { it.type.effectiveVisibility(types + this) }) +private fun KotlinType.dependentDescriptors(types: Set, ownRelation: RelationToType): Set { + if (this in types) return emptySet() + val ownDependent = constructor.declarationDescriptor?.dependentDescriptors(ownRelation) ?: emptySet() + val argumentDependent = arguments.map { it.type.dependentDescriptors(types + this, ARGUMENT) }.flatten() + return ownDependent + argumentDependent +} -private fun TypeConstructor.effectiveVisibility() = - this.declarationDescriptor?.effectiveVisibility() ?: Public +fun Set.leastPermissive(base: EffectiveVisibility): DescriptorWithRelation? { + for (descriptorWithRelation in this) { + val currentVisibility = descriptorWithRelation.effectiveVisibility() + when (currentVisibility.relation(base)) { + Permissiveness.LESS, Permissiveness.UNKNOWN -> { + return descriptorWithRelation + } + else -> {} + } + } + return null +} fun DeclarationDescriptorWithVisibility.effectiveVisibility(): EffectiveVisibility = lowerBound(visibility.effectiveVisibility(this.containingDeclaration as? ClassDescriptor), diff --git a/idea/testData/checker/ExposedContainerType.kt b/idea/testData/checker/ExposedContainerType.kt new file mode 100644 index 00000000000..facfd49cc38 --- /dev/null +++ b/idea/testData/checker/ExposedContainerType.kt @@ -0,0 +1,20 @@ +class A { + internal companion object { + class B { + class C + interface D + companion object {} + } + } +} + +fun A.Companion.B.C.foo() {} + +interface E : A.Companion.B.D + +val x = A.Companion.B + +class F<T : A.Companion.B>(val x: T) + + + diff --git a/idea/testData/checker/ExposedInferredType.kt b/idea/testData/checker/ExposedInferredType.kt new file mode 100644 index 00000000000..b331234ed08 --- /dev/null +++ b/idea/testData/checker/ExposedInferredType.kt @@ -0,0 +1,19 @@ +private class A + +open class B(val x: T) + +class C(x: A): B(x) + +private class D { + class E +} + +fun create() = A() + +fun create(a: A) = B(a) + +val x = create() + +val y = create(x) + +val z: B? = null diff --git a/idea/tests/org/jetbrains/kotlin/checkers/PsiCheckerTestGenerated.java b/idea/tests/org/jetbrains/kotlin/checkers/PsiCheckerTestGenerated.java index 48aa4bb8c48..6515002845f 100644 --- a/idea/tests/org/jetbrains/kotlin/checkers/PsiCheckerTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/checkers/PsiCheckerTestGenerated.java @@ -127,6 +127,18 @@ public class PsiCheckerTestGenerated extends AbstractPsiCheckerTest { doTest(fileName); } + @TestMetadata("ExposedContainerType.kt") + public void testExposedContainerType() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/checker/ExposedContainerType.kt"); + doTest(fileName); + } + + @TestMetadata("ExposedInferredType.kt") + public void testExposedInferredType() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/checker/ExposedInferredType.kt"); + doTest(fileName); + } + @TestMetadata("ExtensionFunctions.kt") public void testExtensionFunctions() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/checker/ExtensionFunctions.kt"); diff --git a/jps-plugin/testData/general/CircularDependenciesInternalFromAnotherModule/errors.txt b/jps-plugin/testData/general/CircularDependenciesInternalFromAnotherModule/errors.txt index 16909f08763..de432978151 100644 --- a/jps-plugin/testData/general/CircularDependenciesInternalFromAnotherModule/errors.txt +++ b/jps-plugin/testData/general/CircularDependenciesInternalFromAnotherModule/errors.txt @@ -1,10 +1,10 @@ 'internal open val member: kotlin.Int defined in test.ClassBB1' has no access to 'internal abstract val member: kotlin.Int defined in test.ClassB1', so it cannot override it at line 14, column 14 +'public' subclass exposes its 'internal' supertype InternalClass1 at line 8, column 36 +'public' subclass exposes its 'internal' supertype InternalClass2 at line 18, column 36 +'public' subclass exposes its 'internal' supertype InternalClass2 at line 19, column 15 Cannot access 'InternalClass1': it is 'internal' in 'test' at line 5, column 13 Cannot access 'InternalClass1': it is 'internal' in 'test' at line 8, column 36 Cannot access 'InternalClass2': it is 'internal' in 'test' at line 19, column 15 Cannot access 'InternalClassAnnotation': it is 'internal' in 'test' at line 10, column 2 Cannot access 'InternalFileAnnotation': it is 'internal' in 'test' at line 1, column 7 -Cannot access 'member': it is 'invisible_fake' in 'ClassAA1' at line 27, column 25 -Subclass effective visibility 'public' should be the same or less permissive than its superclass effective visibility 'internal' at line 18, column 36 -Subclass effective visibility 'public' should be the same or less permissive than its superclass effective visibility 'internal' at line 19, column 15 -Subclass effective visibility 'public' should be the same or less permissive than its superclass effective visibility 'internal' at line 8, column 36 \ No newline at end of file +Cannot access 'member': it is 'invisible_fake' in 'ClassAA1' at line 27, column 25 \ No newline at end of file diff --git a/jps-plugin/testData/general/InternalFromAnotherModule/errors.txt b/jps-plugin/testData/general/InternalFromAnotherModule/errors.txt index 6da24d6c7e8..9627524678f 100644 --- a/jps-plugin/testData/general/InternalFromAnotherModule/errors.txt +++ b/jps-plugin/testData/general/InternalFromAnotherModule/errors.txt @@ -1,8 +1,8 @@ 'internal open val member: kotlin.Int defined in test.ClassBB1' has no access to 'internal abstract val member: kotlin.Int defined in test.ClassB1', so it cannot override it at line 14, column 14 +'public' subclass exposes its 'internal' supertype InternalClass1 at line 8, column 36 +'public' subclass exposes its 'internal' supertype InternalClass2 at line 18, column 36 Cannot access 'InternalClass1': it is 'internal' in 'test' at line 5, column 13 Cannot access 'InternalClass1': it is 'internal' in 'test' at line 8, column 36 Cannot access 'InternalClassAnnotation': it is 'internal' in 'test' at line 10, column 2 Cannot access 'InternalTestAnnotation': it is 'internal' in 'test' at line 1, column 7 -Cannot access 'member': it is 'invisible_fake' in 'ClassAA1' at line 27, column 25 -Subclass effective visibility 'public' should be the same or less permissive than its superclass effective visibility 'internal' at line 18, column 36 -Subclass effective visibility 'public' should be the same or less permissive than its superclass effective visibility 'internal' at line 8, column 36 \ No newline at end of file +Cannot access 'member': it is 'invisible_fake' in 'ClassAA1' at line 27, column 25 \ No newline at end of file diff --git a/jps-plugin/testData/incremental/classHierarchyAffected/classBecamePrivate/build.log b/jps-plugin/testData/incremental/classHierarchyAffected/classBecamePrivate/build.log index cedab0eaa5d..51b1fa9217c 100644 --- a/jps-plugin/testData/incremental/classHierarchyAffected/classBecamePrivate/build.log +++ b/jps-plugin/testData/incremental/classHierarchyAffected/classBecamePrivate/build.log @@ -52,22 +52,22 @@ Exit code: ABORT ------------------------------------------ COMPILATION FAILED Cannot access 'A': it is 'private' in file -Subclass effective visibility 'public' should be the same or less permissive than its superclass effective visibility 'private' -Generic effective visibility 'public' should be the same or less permissive than its type parameter bound effective visibility 'private' +'public' subclass exposes its 'private' supertype A +'public' generic exposes its 'private' parameter bound type A Cannot access 'A': it is 'private' in file Cannot access 'A': it is 'private' in file -Function effective visibility 'public' should be the same or less permissive than its parameter type effective visibility 'private' +'public' function exposes its 'private' parameter type A Cannot access 'A': it is 'private' in file Cannot access 'A': it is 'private' in file -Function effective visibility 'public' should be the same or less permissive than its return type effective visibility 'private' +'public' function exposes its 'private' return type A Cannot access 'A': it is 'private' in file Cannot access 'A': it is 'private' in file Cannot access 'A': it is 'private' in file Cannot access 'A': it is 'private' in file -Function effective visibility 'public' should be the same or less permissive than its return type effective visibility 'private' +'public' function exposes its 'private' return type A Cannot access 'A': it is 'private' in file Cannot access 'A': it is 'private' in file -Function effective visibility 'public' should be the same or less permissive than its return type effective visibility 'private' +'public' function exposes its 'private' return type A ================ Step #2 ================= diff --git a/jps-plugin/testData/incremental/classHierarchyAffected/flagsAndMemberInSameClassChanged/build.log b/jps-plugin/testData/incremental/classHierarchyAffected/flagsAndMemberInSameClassChanged/build.log index a8ac9c69ed3..2856771b984 100644 --- a/jps-plugin/testData/incremental/classHierarchyAffected/flagsAndMemberInSameClassChanged/build.log +++ b/jps-plugin/testData/incremental/classHierarchyAffected/flagsAndMemberInSameClassChanged/build.log @@ -33,8 +33,8 @@ Exit code: ABORT ------------------------------------------ COMPILATION FAILED Cannot access 'A': it is 'private' in file -Subclass effective visibility 'public' should be the same or less permissive than its superclass effective visibility 'private' -Function effective visibility 'public' should be the same or less permissive than its return type effective visibility 'private' +'public' subclass exposes its 'private' supertype A +'public' function exposes its 'private' return type A Cannot access 'A': it is 'private' in file Cannot access 'A': it is 'private' in file Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type kotlin.Any? diff --git a/jps-plugin/testData/incremental/classHierarchyAffected/multiModuleExported/build.log b/jps-plugin/testData/incremental/classHierarchyAffected/multiModuleExported/build.log index 172203c7fdc..23d3560344a 100644 --- a/jps-plugin/testData/incremental/classHierarchyAffected/multiModuleExported/build.log +++ b/jps-plugin/testData/incremental/classHierarchyAffected/multiModuleExported/build.log @@ -25,7 +25,7 @@ Exit code: ABORT ------------------------------------------ COMPILATION FAILED Cannot access 'A': it is 'private' in file -Subclass effective visibility 'public' should be the same or less permissive than its superclass effective visibility 'private' +'public' subclass exposes its 'private' supertype A ================ Step #2 ================= diff --git a/jps-plugin/testData/incremental/classHierarchyAffected/multiModuleSimple/build.log b/jps-plugin/testData/incremental/classHierarchyAffected/multiModuleSimple/build.log index 8e64961e1d0..fe2e77d7cc9 100644 --- a/jps-plugin/testData/incremental/classHierarchyAffected/multiModuleSimple/build.log +++ b/jps-plugin/testData/incremental/classHierarchyAffected/multiModuleSimple/build.log @@ -25,7 +25,7 @@ Exit code: ABORT ------------------------------------------ COMPILATION FAILED Cannot access 'A': it is 'private' in file -Subclass effective visibility 'public' should be the same or less permissive than its superclass effective visibility 'private' +'public' subclass exposes its 'private' supertype A Cannot access 'A': it is 'private' in file ================ Step #2 ================= diff --git a/jps-plugin/testData/incremental/multiModule/simpleDependencyErrorOnAccessToInternal1/build.log b/jps-plugin/testData/incremental/multiModule/simpleDependencyErrorOnAccessToInternal1/build.log index efea0e1b9ce..97d0b6d11e8 100644 --- a/jps-plugin/testData/incremental/multiModule/simpleDependencyErrorOnAccessToInternal1/build.log +++ b/jps-plugin/testData/incremental/multiModule/simpleDependencyErrorOnAccessToInternal1/build.log @@ -28,6 +28,6 @@ Cannot access 'A': it is 'internal' in 'a' Cannot access 'FileAnnotation': it is 'internal' in 'a' Cannot access 'ClassAnnotation': it is 'internal' in 'a' Cannot access 'ClassAnnotation': it is 'internal' in 'a' -Function effective visibility 'public' should be the same or less permissive than its parameter type effective visibility 'internal' +'public' function exposes its 'internal' parameter type A Cannot access 'A': it is 'internal' in 'a' Cannot access 'a': it is 'internal' in 'a' diff --git a/jps-plugin/testData/incremental/multiModule/simpleDependencyErrorOnAccessToInternal1/experimental-ic-build.log b/jps-plugin/testData/incremental/multiModule/simpleDependencyErrorOnAccessToInternal1/experimental-ic-build.log index c105d8ab425..b4c4f0f17d3 100644 --- a/jps-plugin/testData/incremental/multiModule/simpleDependencyErrorOnAccessToInternal1/experimental-ic-build.log +++ b/jps-plugin/testData/incremental/multiModule/simpleDependencyErrorOnAccessToInternal1/experimental-ic-build.log @@ -32,6 +32,6 @@ Cannot access 'A': it is 'internal' in 'a' Cannot access 'FileAnnotation': it is 'internal' in 'a' Cannot access 'ClassAnnotation': it is 'internal' in 'a' Cannot access 'ClassAnnotation': it is 'internal' in 'a' -Function effective visibility 'public' should be the same or less permissive than its parameter type effective visibility 'internal' +'public' function exposes its 'internal' parameter type A Cannot access 'A': it is 'internal' in 'a' Cannot access 'a': it is 'internal' in 'a'