Implement package protected visibility

This commit is contained in:
Natalia.Ukhorskaya
2013-02-06 14:13:17 +04:00
parent 88e3b9e190
commit 11273f3035
23 changed files with 202 additions and 9 deletions
@@ -0,0 +1,9 @@
package protectedPack;
import java.lang.String;
public class overrideProtectedFunInPackage {
protected String foo() {
return "fail";
}
}
@@ -0,0 +1,17 @@
package protectedPackKotlin
import protectedPack.overrideProtectedFunInPackage
class Derived: overrideProtectedFunInPackage() {
protected override fun foo(): String? {
return "OK"
}
fun test(): String {
return foo()!!
}
}
fun box(): String {
return Derived().test()
}
@@ -0,0 +1,9 @@
package protectedPack;
import java.lang.String;
public class protectedFunInPackage {
protected String foo() {
return "OK";
}
}
@@ -0,0 +1,5 @@
package protectedPack
fun box(): String {
return protectedFunInPackage().foo()!!
}
@@ -0,0 +1,7 @@
package protectedPack;
import java.lang.String;
public class protectedPropertyInPackage {
protected String foo = "OK";
}
@@ -0,0 +1,5 @@
package protectedPack
fun box(): String {
return protectedPropertyInPackage().foo!!
}
@@ -0,0 +1,11 @@
package protectedPack;
import java.lang.String;
public class protectedStaticClass {
protected static class Inner {
public String foo() {
return "OK";
}
}
}
@@ -0,0 +1,11 @@
package protectedPack
class Derived(): protectedStaticClass() {
fun test(): String {
return protectedStaticClass.Inner().foo()!!
}
}
fun box(): String {
return Derived().test()
}