Implement package protected visibility
This commit is contained in:
+9
@@ -0,0 +1,9 @@
|
||||
package protectedPack;
|
||||
|
||||
import java.lang.String;
|
||||
|
||||
public class overrideProtectedFunInPackage {
|
||||
protected String foo() {
|
||||
return "fail";
|
||||
}
|
||||
}
|
||||
+17
@@ -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()!!
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package protectedPack;
|
||||
|
||||
import java.lang.String;
|
||||
|
||||
public class protectedPropertyInPackage {
|
||||
protected String foo = "OK";
|
||||
}
|
||||
+5
@@ -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()
|
||||
}
|
||||
@@ -2,5 +2,5 @@ package test
|
||||
|
||||
public open class JFrame : awt.Frame {
|
||||
public constructor JFrame()
|
||||
protected final var accessibleContext : jet.String?
|
||||
protected/*protected and package*/ final var accessibleContext : jet.String?
|
||||
}
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package test;
|
||||
|
||||
public class ProtectedPackageConstructor {
|
||||
protected static class Foo { }
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package test
|
||||
|
||||
public open class ProtectedPackageConstructor : java.lang.Object {
|
||||
public constructor ProtectedPackageConstructor()
|
||||
|
||||
protected/*protected static*/ open class Foo : java.lang.Object {
|
||||
protected/*protected and package*/ constructor Foo()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package test;
|
||||
|
||||
public class ProtectedPackageFun {
|
||||
protected void foo() {}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package test
|
||||
|
||||
public open class ProtectedPackageFun : java.lang.Object {
|
||||
public constructor ProtectedPackageFun()
|
||||
protected/*protected and package*/ open fun foo() : Unit
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package test;
|
||||
|
||||
public class ProtectedPackageProperty {
|
||||
protected int foo = 1;
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package test
|
||||
|
||||
public open class ProtectedPackageProperty : java.lang.Object {
|
||||
public constructor ProtectedPackageProperty()
|
||||
protected/*protected and package*/ final var foo : jet.Int
|
||||
}
|
||||
+1
-1
@@ -4,6 +4,6 @@ public open class ConstructorInProtectedStaticNestedClass : java.lang.Object {
|
||||
public constructor ConstructorInProtectedStaticNestedClass()
|
||||
|
||||
protected/*protected static*/ open class Inner : java.lang.Object {
|
||||
protected constructor Inner()
|
||||
protected/*protected and package*/ constructor Inner()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user