Files
kotlin-fork/compiler/testData/codegen/box/statics/protectedStatic2.kt
T
Ilya Matveev a5e4e0284e Mute some box tests for native backend
This patch mutes the following test categories:
   * Tests with java dependencies (System class,
     java stdlib, jvm-oriented annotations etc).
   * Coroutines tests.
   * Reflection tests.
   * Tests with an inheritance from the standard
     collections.
2017-03-10 19:59:37 +03:00

62 lines
1.3 KiB
Kotlin
Vendored

// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// FILE: Base.java
public class Base {
protected static String BASE_ONLY = "BASE";
protected static String baseOnly() {
return BASE_ONLY;
}
protected static String TEST = "BASE";
protected static String test() {
return TEST;
}
public static class Derived extends Base {
protected static String TEST = "DERIVED";
protected static String test() {
return TEST;
}
}
}
// FILE: Kotlin.kt
package anotherPackage
import Base.Derived
import Base
class Kotlin : Base.Derived() {
fun doTest(): String {
if ({ TEST }() != "DERIVED") return "fail 1"
if ({ test() }() != "DERIVED") return "fail 2"
if ({ Derived.TEST }() != "DERIVED") return "fail 3"
if ({ Derived.test() }() != "DERIVED") return "fail 4"
if ({ Base.TEST }() != "BASE") return "fail 5"
if ({ Base.test() }() != "BASE") return "fail 6"
if ({ Base.BASE_ONLY }() != "BASE") return "fail 7"
if ({ Base.baseOnly() }() != "BASE") return "fail 8"
if ({ BASE_ONLY }() != "BASE") return "fail 9"
if ({ baseOnly() }() != "BASE") return "fail 10"
return "OK"
}
}
fun box(): String {
return Kotlin().doTest()
}