Support visibility for protected static members
#KT-2999 Fixed
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
import java.lang.String;
|
||||
|
||||
public class protectedStaticClass {
|
||||
protected static class Inner {
|
||||
public Inner() {}
|
||||
public String foo() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class Derived(): protectedStaticClass() {
|
||||
fun test(): String {
|
||||
return protectedStaticClass.Inner().foo()!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Derived().test()
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
import java.lang.String;
|
||||
|
||||
public class protectedStaticClass2 {
|
||||
public static class A {
|
||||
protected static class B {
|
||||
public B() {
|
||||
}
|
||||
|
||||
public String foo() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class Derived(): protectedStaticClass2.A() {
|
||||
fun test(): String {
|
||||
return protectedStaticClass2.A.B().foo()!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Derived().test()
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
public class protectedStaticFun {
|
||||
protected static String protectedFun() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class Derived(): protectedStaticFun() {
|
||||
fun test(): String {
|
||||
return protectedStaticFun.protectedFun()!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Derived().test()
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
import java.lang.String;
|
||||
|
||||
public class protectedStaticFunCallInConstructor {
|
||||
|
||||
protected final String protectedProperty;
|
||||
|
||||
public protectedStaticFunCallInConstructor(String str) {
|
||||
protectedProperty = str;
|
||||
}
|
||||
|
||||
protected static String protectedFun() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class A: protectedStaticFunCallInConstructor(protectedStaticFunCallInConstructor.protectedFun()) {
|
||||
fun test(): String {
|
||||
return protectedProperty!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return A().test()
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
public class protectedStaticFunClassObject {
|
||||
|
||||
protected static String protectedFun() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
class A {
|
||||
class object: protectedStaticFunClassObject() {
|
||||
fun test(): String {
|
||||
return protectedStaticFunClassObject.protectedFun()!!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return A.test()
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
public class protectedStaticFunGenericClass<T> {
|
||||
protected static String protectedFun() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class Derived(): protectedStaticFunGenericClass<String>() {
|
||||
fun test(): String {
|
||||
return protectedStaticFunGenericClass.protectedFun()!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Derived().test()
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
public class protectedStaticFunNestedStaticClass {
|
||||
public static class Inner {
|
||||
protected static String protectedFun() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class Derived(): protectedStaticFunNestedStaticClass.Inner() {
|
||||
fun test(): String {
|
||||
return protectedStaticFunNestedStaticClass.Inner.protectedFun()!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Derived().test()
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
public class protectedStaticFunNestedStaticClass2 {
|
||||
public static class A {
|
||||
public static class B {
|
||||
protected static String protectedFun() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class Derived(): protectedStaticFunNestedStaticClass2.A.B() {
|
||||
fun test(): String {
|
||||
return protectedStaticFunNestedStaticClass2.A.B.protectedFun()!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Derived().test()
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
public class protectedStaticFunNestedStaticGenericClass<T> {
|
||||
public static class Inner<S> {
|
||||
protected static String protectedFun() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class Derived(): protectedStaticFunNestedStaticGenericClass<String>.Inner<String>() {
|
||||
fun test(): String {
|
||||
return protectedStaticFunNestedStaticGenericClass.Inner.protectedFun()!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Derived().test()
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
public class protectedStaticFunNotDirectSuperClass {
|
||||
protected static String protectedFun() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
open class A : protectedStaticFunNotDirectSuperClass() {}
|
||||
|
||||
class Derived(): A() {
|
||||
fun test(): String {
|
||||
return protectedStaticFunNotDirectSuperClass.protectedFun()!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Derived().test()
|
||||
}
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
public class protectedStaticFunObject {
|
||||
|
||||
protected static String protectedFun() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
object A: protectedStaticFunObject() {
|
||||
fun test(): String {
|
||||
return protectedStaticFunObject.protectedFun()!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return A.test()
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
public class protectedStaticProperty {
|
||||
protected static final String protectedProperty = "OK";
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class Derived(): protectedStaticProperty() {
|
||||
fun test(): String {
|
||||
return protectedStaticProperty.protectedProperty!!
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return Derived().test()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user