J2K: use of new syntax for class intialization blocks
This commit is contained in:
@@ -12,7 +12,7 @@ class C(val myArg1: Int) {
|
||||
myArg3 = 0
|
||||
}
|
||||
|
||||
{
|
||||
init {
|
||||
myArg2 = 0
|
||||
myArg3 = 0
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package org.test.customer
|
||||
|
||||
class Customer(public val firstName: String, public val lastName: String) {
|
||||
|
||||
{
|
||||
init {
|
||||
doSmthBefore()
|
||||
doSmthAfter()
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class C(private val field: Int) {
|
||||
|
||||
{
|
||||
init {
|
||||
System.out.println(field)
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
class C(p: Int) {
|
||||
private val p: Int
|
||||
|
||||
{
|
||||
init {
|
||||
var p = p
|
||||
this.p = p
|
||||
System.out.println(p++)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class C(p: Int, c: C) {
|
||||
public var p: Int = 0
|
||||
|
||||
{
|
||||
init {
|
||||
c.p = p
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
class C(p: Int) {
|
||||
public var p: Int = 0
|
||||
|
||||
{
|
||||
init {
|
||||
this.p = 0
|
||||
if (p > 0) {
|
||||
this.p = p
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class C(x: String) {
|
||||
public var x: Any
|
||||
|
||||
{
|
||||
init {
|
||||
this.x = x
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
class C(x: Any, b: Boolean) {
|
||||
public var x: Any
|
||||
|
||||
{
|
||||
init {
|
||||
if (b) {
|
||||
this.x = x
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
class C(arg1: Int, arg2: Int = 0, arg3: Int = 0) {
|
||||
private val field: Int
|
||||
|
||||
{
|
||||
init {
|
||||
var arg1 = arg1
|
||||
var arg3 = arg3
|
||||
arg1++
|
||||
|
||||
Reference in New Issue
Block a user