mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-16 00:21:32 +00:00
Load Java static members from parents
This commit is contained in:
4
compiler/testData/codegen/boxWithJava/statics/fields/Child.java
vendored
Normal file
4
compiler/testData/codegen/boxWithJava/statics/fields/Child.java
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
class Child extends Parent {
|
||||
public static int b = 3;
|
||||
public static int c = 4;
|
||||
}
|
||||
4
compiler/testData/codegen/boxWithJava/statics/fields/Parent.java
vendored
Normal file
4
compiler/testData/codegen/boxWithJava/statics/fields/Parent.java
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
class Parent {
|
||||
public static int a = 1;
|
||||
public static int b = 2;
|
||||
}
|
||||
9
compiler/testData/codegen/boxWithJava/statics/fields/test.kt
vendored
Normal file
9
compiler/testData/codegen/boxWithJava/statics/fields/test.kt
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fun box(): String {
|
||||
if (Parent.a != 1) return "expected Parent.a == 1"
|
||||
if (Parent.b != 2) return "expected Parent.b == 2"
|
||||
if (Child.a != 1) return "expected Child.a == 1"
|
||||
if (Child.b != 3) return "expected Child.b == 3"
|
||||
if (Child.c != 4) return "expected Child.c == 4"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
8
compiler/testData/codegen/boxWithJava/statics/functions/Child.java
vendored
Normal file
8
compiler/testData/codegen/boxWithJava/statics/functions/Child.java
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
class Child extends Parent {
|
||||
public static String bar() {
|
||||
return "Child.bar";
|
||||
}
|
||||
public static String baz() {
|
||||
return "Child.baz";
|
||||
}
|
||||
}
|
||||
8
compiler/testData/codegen/boxWithJava/statics/functions/Parent.java
vendored
Normal file
8
compiler/testData/codegen/boxWithJava/statics/functions/Parent.java
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
class Parent {
|
||||
public static String foo() {
|
||||
return "Parent.foo";
|
||||
}
|
||||
public static String baz() {
|
||||
return "Parent.baz";
|
||||
}
|
||||
}
|
||||
9
compiler/testData/codegen/boxWithJava/statics/functions/test.kt
vendored
Normal file
9
compiler/testData/codegen/boxWithJava/statics/functions/test.kt
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
fun box(): String {
|
||||
if (Parent.foo() != "Parent.foo") return "expected: Parent.foo"
|
||||
if (Parent.baz() != "Parent.baz") return "expected: Parent.baz"
|
||||
if (Child.foo() != "Parent.foo") return "expected: Child.foo() != Parent.foo"
|
||||
if (Child.baz() != "Child.baz") return "expected: Child.baz"
|
||||
if (Child.bar() != "Child.bar") return "expected: Child.bar"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
9
compiler/testData/codegen/boxWithJava/statics/hidePrivateByPublic/Child.java
vendored
Normal file
9
compiler/testData/codegen/boxWithJava/statics/hidePrivateByPublic/Child.java
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
class Child extends Parent {
|
||||
public static String a = "2";
|
||||
public static String foo() {
|
||||
return "Child.foo()";
|
||||
}
|
||||
public static String foo(int i) {
|
||||
return "Child.foo(int)";
|
||||
}
|
||||
}
|
||||
6
compiler/testData/codegen/boxWithJava/statics/hidePrivateByPublic/Parent.java
vendored
Normal file
6
compiler/testData/codegen/boxWithJava/statics/hidePrivateByPublic/Parent.java
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
class Parent {
|
||||
private static int a = 1;
|
||||
private static String foo() {
|
||||
return "Parent.foo";
|
||||
}
|
||||
}
|
||||
7
compiler/testData/codegen/boxWithJava/statics/hidePrivateByPublic/test.kt
vendored
Normal file
7
compiler/testData/codegen/boxWithJava/statics/hidePrivateByPublic/test.kt
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
fun box(): String {
|
||||
if (Child.a != "2") return "Fail #1"
|
||||
if (Child.foo() != "Child.foo()") return "Fail #2"
|
||||
if (Child.foo(1) != "Child.foo(int)") return "Fail #3"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user