This is not allowed due to possible anti-intuitive behavior with respect to several blocks init { ... }
, which can lead to subtle errors:
class C {
init {
if (someCondition) return
}
init {
}
}
If the answer is no, the code becomes fragile: adding return
to one block init
will affect the other blocks.
, init
, - :
class C {
init {
run {
if (someCondition) return@run
}
}
}
:
class C {
constructor() {
if (someCondition) return
}
}