Exposed visibility deprecation warnings made errors + relevant test fixes

This commit is contained in:
Mikhail Glukhikh
2015-11-17 18:59:04 +03:00
parent e8e5d700d2
commit 4e44466cf9
63 changed files with 93 additions and 87 deletions
@@ -73,13 +73,13 @@ public interface Errors {
DiagnosticFactory3<PsiElement, DeclarationDescriptor, Visibility, DeclarationDescriptor> INVISIBLE_MEMBER = DiagnosticFactory3.create(ERROR, CALL_ELEMENT);
// Exposed visibility group
DiagnosticFactory2<KtProperty, EffectiveVisibility, EffectiveVisibility> EXPOSED_PROPERTY_TYPE = DiagnosticFactory2.create(WARNING);
DiagnosticFactory2<PsiElement, EffectiveVisibility, EffectiveVisibility> EXPOSED_FUNCTION_RETURN_TYPE = DiagnosticFactory2.create(WARNING);
DiagnosticFactory2<KtParameter, EffectiveVisibility, EffectiveVisibility> EXPOSED_PARAMETER_TYPE = DiagnosticFactory2.create(WARNING);
DiagnosticFactory2<KtTypeReference, EffectiveVisibility, EffectiveVisibility> EXPOSED_RECEIVER_TYPE = DiagnosticFactory2.create(WARNING);
DiagnosticFactory2<KtTypeParameter, EffectiveVisibility, EffectiveVisibility> EXPOSED_TYPE_PARAMETER_BOUND = DiagnosticFactory2.create(WARNING);
DiagnosticFactory2<KtDelegationSpecifier, EffectiveVisibility, EffectiveVisibility> EXPOSED_SUPER_CLASS = DiagnosticFactory2.create(WARNING);
DiagnosticFactory2<KtDelegationSpecifier, EffectiveVisibility, EffectiveVisibility> EXPOSED_SUPER_INTERFACE = DiagnosticFactory2.create(WARNING);
DiagnosticFactory2<KtProperty, EffectiveVisibility, EffectiveVisibility> EXPOSED_PROPERTY_TYPE = DiagnosticFactory2.create(ERROR);
DiagnosticFactory2<PsiElement, EffectiveVisibility, EffectiveVisibility> EXPOSED_FUNCTION_RETURN_TYPE = DiagnosticFactory2.create(ERROR);
DiagnosticFactory2<KtParameter, EffectiveVisibility, EffectiveVisibility> EXPOSED_PARAMETER_TYPE = DiagnosticFactory2.create(ERROR);
DiagnosticFactory2<KtTypeReference, EffectiveVisibility, EffectiveVisibility> EXPOSED_RECEIVER_TYPE = DiagnosticFactory2.create(ERROR);
DiagnosticFactory2<KtTypeParameter, EffectiveVisibility, EffectiveVisibility> EXPOSED_TYPE_PARAMETER_BOUND = DiagnosticFactory2.create(ERROR);
DiagnosticFactory2<KtDelegationSpecifier, EffectiveVisibility, EffectiveVisibility> EXPOSED_SUPER_CLASS = DiagnosticFactory2.create(ERROR);
DiagnosticFactory2<KtDelegationSpecifier, EffectiveVisibility, EffectiveVisibility> EXPOSED_SUPER_INTERFACE = DiagnosticFactory2.create(ERROR);
DiagnosticFactory1<KtElement, Collection<ClassDescriptor>> PLATFORM_CLASS_MAPPED_TO_KOTLIN = DiagnosticFactory1.create(WARNING);
@@ -112,13 +112,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, "Deprecated: 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, "Deprecated: 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, "Deprecated: 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, "Deprecated: 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, "Deprecated: 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, "Deprecated: 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, "Deprecated: 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, "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(REDECLARATION, "Redeclaration: {0}", STRING);
MAP.put(NAME_SHADOWING, "Name shadowed: {0}", STRING);
+1 -1
View File
@@ -1,5 +1,5 @@
class Foo(private val s: String) {
private inner class Inner {
inner class Inner {
private val x = {
this@Foo.s
}()
@@ -6,7 +6,7 @@ internal class B : A {
override fun foo() = "OK"
}
val global = B()
internal val global = B()
internal class C(x: Int) : A by global {
constructor(): this(1)
@@ -1,10 +1,10 @@
interface B : A {
internal interface B : A {
fun bar() = 1
}
interface C : B
internal interface C : B
class D : C {
internal class D : C {
override fun foo() {}
}
@@ -1,4 +1,4 @@
class fieldAccessViaSubclass {
public class fieldAccessViaSubclass {
public String fieldO;
public static String fieldK;
@@ -1,4 +1,4 @@
fun getInterface(): GenericInterface<String> {
internal fun getInterface(): GenericInterface<String> {
return GenericInterface { d, i, j, s ->
"OK"
}
@@ -1,4 +1,4 @@
class KotlinSubclass: JavaClass() {
internal class KotlinSubclass: JavaClass() {
}
fun box(): String {
@@ -1,4 +1,4 @@
class KotlinClass : JavaClass<String>() {
internal class KotlinClass : JavaClass<String>() {
fun doIt(): String {
var result = ""
execute("") {
@@ -1,4 +1,4 @@
class KotlinClass(): JavaClass(null) {
internal class KotlinClass(): JavaClass(null) {
}
fun box(): String {
@@ -1,6 +1,6 @@
var status: String = "fail" // global property to avoid issues with accessing closure from local class (KT-4174)
class KotlinClass(): JavaClass({status="OK"}) {
internal class KotlinClass(): JavaClass({status="OK"}) {
}
fun box(): String {
@@ -2,4 +2,4 @@ fun box(): String {
return f(JavaClass())
}
fun f(c: C) = c.ok
internal fun f(c: C) = c.ok
@@ -2,7 +2,7 @@ fun box(): String {
return JavaClass().doIt()
}
fun JavaClass.doIt(): String {
internal fun JavaClass.doIt(): String {
x = "OK"
return x
}
@@ -1,3 +1,3 @@
abstract class Test<F> {
public abstract class Test<F> {
protected final F value = null;
}
@@ -1,4 +1,4 @@
interface Simple {
public interface Simple {
default String test(String s) {
return s + "K";
}
@@ -1,4 +1,4 @@
interface Simple {
public interface Simple {
default String test(String s) {
return s + "K";
}
@@ -1,4 +1,4 @@
interface Simple {
public interface Simple {
default String test(String s) {
return s + "Fail";
}
@@ -1,4 +1,4 @@
fun bar(a: A<String, Int>, b: B<String>, c: C) {
internal fun bar(a: A<String, Int>, b: B<String>, c: C) {
val sa: String = a.foo()
val sb: String = b.foo()
val sc: String = c.foo()