New J2K: Fix existing test data

This commit is contained in:
Ilya Kirillov
2018-12-01 15:55:37 +03:00
committed by Ilya Kirillov
parent 5236858c20
commit f752796408
330 changed files with 2800 additions and 60 deletions
@@ -0,0 +1,27 @@
internal class C(val myArg1: Int) {
var myArg2: Int
var myArg3: Int
constructor(arg1: Int, arg2: Int, arg3: Int) : this(arg1) {
myArg2 = arg2
myArg3 = arg3
}
constructor(arg1: Int, arg2: Int) : this(arg1) {
myArg2 = arg2
myArg3 = 0
}
init {
myArg2 = 0
myArg3 = 0
}
}
object User {
fun main() {
val c1 = C(100, 100, 100)
val c2 = C(100, 100)
val c3 = C(100)
}
}
@@ -0,0 +1,14 @@
// ERROR: Property must be initialized or be abstract
class Test {
private val s: String?
internal var b = false
internal var d = 0.0
constructor() {
b = true
}
constructor(s: String?) {
this.s = s
}
}
@@ -0,0 +1,41 @@
package org.test.customer
internal class Customer(val firstName: String?, val lastName: String?) {
init {
doSmthBefore()
doSmthAfter()
}
private fun doSmthBefore() {}
private fun doSmthAfter() {}
}
internal class CustomerBuilder {
var _firstName: String? = "Homer"
var _lastName: String? = "Simpson"
fun WithFirstName(firstName: String?): CustomerBuilder {
_firstName = firstName
return this
}
fun WithLastName(lastName: String?): CustomerBuilder {
_lastName = lastName
return this
}
fun Build(): Customer {
return Customer(_firstName, _lastName)
}
}
object User {
fun main() {
val customer = CustomerBuilder()
.WithFirstName("Homer")
.WithLastName("Simpson")
.Build()
println(customer.firstName)
println(customer.lastName)
}
}
@@ -0,0 +1,7 @@
internal class C(p: Int, c: C) {
var p = 0
init {
c.p = p
}
}
@@ -0,0 +1,10 @@
internal class C(p: Int) {
var p: Int
init {
this.p = 0
if (p > 0) {
this.p = p
}
}
}
@@ -0,0 +1,7 @@
internal class C(x: String?) {
var x: Any?
init {
this.x = x
}
}
@@ -0,0 +1,9 @@
internal class C(x: Any?, b: Boolean) {
var x: Any? = null
init {
if (b) {
this.x = x
}
}
}
@@ -0,0 +1,3 @@
internal open class Base(o: Any?, l: Int)
internal class C(private val string: String) : Base(string, string.length)
@@ -0,0 +1 @@
internal class C(@Deprecated("") private val p1: Int, private val myP2: Int, @SuppressWarnings("x") var p3: Int)
@@ -0,0 +1,28 @@
class Identifier<T> {
val name: T?
private var myHasDollar = false
private var myNullable = true
constructor(name: T?) {
this.name = name
}
constructor(name: T?, isNullable: Boolean) {
this.name = name
myNullable = isNullable
}
constructor(name: T?, hasDollar: Boolean, isNullable: Boolean) {
this.name = name
myHasDollar = hasDollar
myNullable = isNullable
}
}
object User {
fun main() {
val i1: Identifier<*> = Identifier<String?>("name", false, true)
val i2 = Identifier<String?>("name", false)
val i3 = Identifier<String?>("name")
}
}
@@ -0,0 +1,29 @@
// ERROR: Property must be initialized or be abstract
class Identifier {
val name: String?
private var myHasDollar = false
private var myNullable = true
constructor(name: String?) {
this.name = name
}
constructor(name: String?, isNullable: Boolean) {
this.name = name
myNullable = isNullable
}
constructor(name: String?, hasDollar: Boolean, isNullable: Boolean) {
this.name = name
myHasDollar = hasDollar
myNullable = isNullable
}
}
object User {
fun main() {
val i1 = Identifier("name", false, true)
val i2 = Identifier("name", false)
val i3 = Identifier("name")
}
}
@@ -0,0 +1,7 @@
internal class A @JvmOverloads constructor(nested: Nested? = Nested(Nested.FIELD)) {
internal class Nested(p: Int) {
companion object {
const val FIELD = 0
}
}
}
@@ -0,0 +1,11 @@
internal class A @JvmOverloads constructor(nested: Nested? = Nested(Nested.FIELD)) {
internal class Nested(p: Int) {
companion object {
const val FIELD = 0
}
}
}
internal class B {
var nested: A.Nested? = null
}
@@ -0,0 +1,13 @@
package pack
internal class A @JvmOverloads constructor(nested: Nested? = Nested(Nested.FIELD)) {
internal class Nested(p: Int) {
companion object {
const val FIELD = 0
}
}
}
internal class B {
var nested: A.Nested? = null
}
@@ -0,0 +1,13 @@
package pack
internal class A @JvmOverloads constructor(nested: Nested? = Nested(Nested.FIELD)) {
internal class Nested(p: Int) {
companion object {
const val FIELD = 0
}
}
}
internal class B {
var nested: A.Nested? = null
}
@@ -0,0 +1,9 @@
internal open class Base(nested: Nested?) {
internal class Nested(p: Int) {
companion object {
const val FIELD = 0
}
}
}
internal class Derived : Base(Base.Nested(Base.Nested.FIELD))
@@ -0,0 +1,12 @@
internal class A {
private var s: String? = ""
private var x = 0
constructor() {}
@JvmOverloads
constructor(p: Int, s: String?, x: Int = 1) {
this.s = s
this.x = x
}
}
@@ -0,0 +1,10 @@
internal class A() {
private var s: String? = ""
private var x = 0
@JvmOverloads
constructor(p: Int, s: String?, x: Int = 1) : this() {
this.s = s
this.x = x
}
}
@@ -0,0 +1,11 @@
internal class C() {
constructor(p: Int) : this() {
println(staticField1 + C.staticField2)
}
companion object {
private const val staticField1 = 0
private const val staticField2 = 0
}
}
@@ -0,0 +1,30 @@
// ERROR: Property must be initialized or be abstract
class Test {
private val myName: String?
internal var a = false
internal var b = 0.0
internal var c = 0f
internal var d: Long = 0
internal var e = 0
protected var f: Short = 0
protected var g = 0.toChar()
constructor() {}
constructor(name: String?) {
myName = foo(name)
}
companion object {
internal fun foo(n: String?): String {
return ""
}
}
}
object User {
fun main() {
val t = Test("name")
}
}