Deprecate visibility of static members inherited from Java
Now they are not visible by short name through companion objects, just like classifiers in KT-21515 ^KT-25333 In progress
This commit is contained in:
committed by
Dmitry Savvinov
parent
63202fe560
commit
76c651421b
@@ -0,0 +1,48 @@
|
||||
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
// FILE: test/Java.java
|
||||
package test;
|
||||
|
||||
public class Java {
|
||||
public static void method() { }
|
||||
public static int property = 42;
|
||||
public static class Classifier { }
|
||||
public static void syntheticSam(Runnable r) { }
|
||||
|
||||
public static int getStaticSyntheticProperty() { return 42; }
|
||||
public static int setStaticSyntheticProperty(int x) { return 42; }
|
||||
|
||||
public int getInstanceSyntheticProperty() { return 42; }
|
||||
public int setInstanceSyntheticProperty(int x) { return 42; }
|
||||
}
|
||||
|
||||
// FILE: Kotlin.kt
|
||||
package test
|
||||
|
||||
open class Base {
|
||||
companion object : Java() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
fun test(javaStaticInTypePosition: <!UNRESOLVED_REFERENCE!>Classifier<!>) {
|
||||
<!UNRESOLVED_REFERENCE!>method<!>()
|
||||
<!UNRESOLVED_REFERENCE!>property<!>
|
||||
<!UNRESOLVED_REFERENCE!>Classifier<!>()
|
||||
<!UNRESOLVED_REFERENCE!>syntheticSam<!> { }
|
||||
|
||||
// Instance members shouldn't be affected, but we check them, just in case
|
||||
val y = instanceSyntheticProperty
|
||||
instanceSyntheticProperty = 43
|
||||
|
||||
// Note that statics actually aren't converted into synthetic property in Kotlin
|
||||
val x = <!UNRESOLVED_REFERENCE!>syntheticProperty<!>
|
||||
<!UNRESOLVED_REFERENCE!>syntheticProperty<!> = 42
|
||||
}
|
||||
|
||||
class JavaStaticInSupertypeList : <!UNRESOLVED_REFERENCE!>Classifier<!>() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package
|
||||
|
||||
package test {
|
||||
|
||||
public open class Base {
|
||||
public constructor Base()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public companion object Companion : test.Java {
|
||||
private constructor Companion()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun getInstanceSyntheticProperty(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun setInstanceSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
public final class Derived : test.Base {
|
||||
public constructor Derived()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun test(/*0*/ javaStaticInTypePosition: [ERROR : Classifier]): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public final class JavaStaticInSupertypeList {
|
||||
public constructor JavaStaticInSupertypeList()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
public open class Java {
|
||||
public constructor Java()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun getInstanceSyntheticProperty(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun setInstanceSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public open class Classifier {
|
||||
public constructor Classifier()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
// Static members
|
||||
public final var property: kotlin.Int
|
||||
public open fun getStaticSyntheticProperty(): kotlin.Int
|
||||
public open fun method(): kotlin.Unit
|
||||
public open fun setStaticSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||
public open fun syntheticSam(/*0*/ r: java.lang.Runnable!): kotlin.Unit
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
// FILE: test/Java.java
|
||||
package test;
|
||||
|
||||
public class Java {
|
||||
public static void method() { }
|
||||
public static int property = 42;
|
||||
public static class Classifier { }
|
||||
public static void syntheticSam(Runnable r) { }
|
||||
|
||||
public static int getStaticSyntheticProperty() { return 42; }
|
||||
public static int setStaticSyntheticProperty(int x) { return 42; }
|
||||
|
||||
public int getInstanceSyntheticProperty() { return 42; }
|
||||
public int setInstanceSyntheticProperty(int x) { return 42; }
|
||||
}
|
||||
|
||||
// FILE: Kotlin.kt
|
||||
package test
|
||||
|
||||
open class Base {
|
||||
companion object : Java() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
fun test(javaStaticInTypePosition: <!DEPRECATED_ACCESS_BY_SHORT_NAME!>Classifier<!>) {
|
||||
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>method()<!>
|
||||
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>property<!>
|
||||
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>Classifier()<!>
|
||||
<!DEPRECATED_ACCESS_BY_SHORT_NAME!>syntheticSam { }<!>
|
||||
|
||||
// Instance members shouldn't be affected, but we check them, just in case
|
||||
val y = instanceSyntheticProperty
|
||||
instanceSyntheticProperty = 43
|
||||
|
||||
// Note that statics actually aren't converted into synthetic property in Kotlin
|
||||
val x = <!UNRESOLVED_REFERENCE!>syntheticProperty<!>
|
||||
<!UNRESOLVED_REFERENCE!>syntheticProperty<!> = 42
|
||||
}
|
||||
|
||||
class JavaStaticInSupertypeList : <!DEPRECATED_ACCESS_BY_SHORT_NAME!>Classifier<!>() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package
|
||||
|
||||
package test {
|
||||
|
||||
public open class Base {
|
||||
public constructor Base()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public companion object Companion : test.Java {
|
||||
private constructor Companion()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun getInstanceSyntheticProperty(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun setInstanceSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
public final class Derived : test.Base {
|
||||
public constructor Derived()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun test(/*0*/ javaStaticInTypePosition: test.Java.Classifier): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public final class JavaStaticInSupertypeList : test.Java.Classifier {
|
||||
public constructor JavaStaticInSupertypeList()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
public open class Java {
|
||||
public constructor Java()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun getInstanceSyntheticProperty(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun setInstanceSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public open class Classifier {
|
||||
public constructor Classifier()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
// Static members
|
||||
public final var property: kotlin.Int
|
||||
public open fun getStaticSyntheticProperty(): kotlin.Int
|
||||
public open fun method(): kotlin.Unit
|
||||
public open fun setStaticSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||
public open fun syntheticSam(/*0*/ r: java.lang.Runnable!): kotlin.Unit
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
// !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
// FILE: test/Java.java
|
||||
package test;
|
||||
|
||||
public class Java {
|
||||
public static void method() { }
|
||||
public static int property = 42;
|
||||
public static class Classifier { }
|
||||
public static void syntheticSam(Runnable r) { }
|
||||
|
||||
public static int getStaticSyntheticProperty() { return 42; }
|
||||
public static int setStaticSyntheticProperty(int x) { return 42; }
|
||||
|
||||
public int getInstanceSyntheticProperty() { return 42; }
|
||||
public int setInstanceSyntheticProperty(int x) { return 42; }
|
||||
}
|
||||
|
||||
// FILE: Kotlin.kt
|
||||
package test
|
||||
|
||||
import test.Java.method
|
||||
import test.Java.Classifier
|
||||
import test.Java.property
|
||||
import test.Java.syntheticSam
|
||||
|
||||
open class Base {
|
||||
companion object : Java() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
fun test(javaStaticInTypePosition: Classifier) {
|
||||
method()
|
||||
property
|
||||
Classifier()
|
||||
syntheticSam { }
|
||||
|
||||
// Instance members shouldn't be affected, but we check them, just in case
|
||||
val y = instanceSyntheticProperty
|
||||
instanceSyntheticProperty = 43
|
||||
|
||||
// Note that statics actually aren't converted into synthetic property in Kotlin
|
||||
val x = <!UNRESOLVED_REFERENCE!>syntheticProperty<!>
|
||||
<!UNRESOLVED_REFERENCE!>syntheticProperty<!> = 42
|
||||
}
|
||||
|
||||
class JavaStaticInSupertypeList : Classifier() {
|
||||
|
||||
}
|
||||
}
|
||||
Vendored
+58
@@ -0,0 +1,58 @@
|
||||
package
|
||||
|
||||
package test {
|
||||
|
||||
public open class Base {
|
||||
public constructor Base()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public companion object Companion : test.Java {
|
||||
private constructor Companion()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun getInstanceSyntheticProperty(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun setInstanceSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
public final class Derived : test.Base {
|
||||
public constructor Derived()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun test(/*0*/ javaStaticInTypePosition: test.Java.Classifier): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public final class JavaStaticInSupertypeList : test.Java.Classifier {
|
||||
public constructor JavaStaticInSupertypeList()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
public open class Java {
|
||||
public constructor Java()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun getInstanceSyntheticProperty(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun setInstanceSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public open class Classifier {
|
||||
public constructor Classifier()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
// Static members
|
||||
public final var property: kotlin.Int
|
||||
public open fun getStaticSyntheticProperty(): kotlin.Int
|
||||
public open fun method(): kotlin.Unit
|
||||
public open fun setStaticSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||
public open fun syntheticSam(/*0*/ r: java.lang.Runnable!): kotlin.Unit
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
// !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
// FILE: test/Java.java
|
||||
package test;
|
||||
|
||||
public class Java {
|
||||
public static void method() { }
|
||||
public static int property = 42;
|
||||
public static class Classifier { }
|
||||
public static void syntheticSam(Runnable r) { }
|
||||
|
||||
public static int getStaticSyntheticProperty() { return 42; }
|
||||
public static int setStaticSyntheticProperty(int x) { return 42; }
|
||||
|
||||
public int getInstanceSyntheticProperty() { return 42; }
|
||||
public int setInstanceSyntheticProperty(int x) { return 42; }
|
||||
}
|
||||
|
||||
// FILE: Kotlin.kt
|
||||
package test
|
||||
|
||||
import test.Java.method
|
||||
import test.Java.Classifier
|
||||
import test.Java.property
|
||||
import test.Java.syntheticSam
|
||||
|
||||
open class Base {
|
||||
companion object : Java() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
fun test(javaStaticInTypePosition: Classifier) {
|
||||
method()
|
||||
property
|
||||
Classifier()
|
||||
syntheticSam { }
|
||||
|
||||
// Instance members shouldn't be affected, but we check them, just in case
|
||||
val y = instanceSyntheticProperty
|
||||
instanceSyntheticProperty = 43
|
||||
|
||||
// Note that statics actually aren't converted into synthetic property in Kotlin
|
||||
val x = <!UNRESOLVED_REFERENCE!>syntheticProperty<!>
|
||||
<!UNRESOLVED_REFERENCE!>syntheticProperty<!> = 42
|
||||
}
|
||||
|
||||
class JavaStaticInSupertypeList : Classifier() {
|
||||
|
||||
}
|
||||
}
|
||||
Vendored
+58
@@ -0,0 +1,58 @@
|
||||
package
|
||||
|
||||
package test {
|
||||
|
||||
public open class Base {
|
||||
public constructor Base()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public companion object Companion : test.Java {
|
||||
private constructor Companion()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun getInstanceSyntheticProperty(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun setInstanceSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
public final class Derived : test.Base {
|
||||
public constructor Derived()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun test(/*0*/ javaStaticInTypePosition: test.Java.Classifier): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public final class JavaStaticInSupertypeList : test.Java.Classifier {
|
||||
public constructor JavaStaticInSupertypeList()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
public open class Java {
|
||||
public constructor Java()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun getInstanceSyntheticProperty(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun setInstanceSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
public open class Classifier {
|
||||
public constructor Classifier()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
// Static members
|
||||
public final var property: kotlin.Int
|
||||
public open fun getStaticSyntheticProperty(): kotlin.Int
|
||||
public open fun method(): kotlin.Unit
|
||||
public open fun setStaticSyntheticProperty(/*0*/ x: kotlin.Int): kotlin.Int
|
||||
public open fun syntheticSam(/*0*/ r: java.lang.Runnable!): kotlin.Unit
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user