Create from Usage: Do not generate secondary constructor body by default
This commit is contained in:
+1
@@ -462,6 +462,7 @@ class CallableBuilder(val config: CallableBuilderConfiguration) {
|
|||||||
CallableKind.FUNCTION, CallableKind.SECONDARY_CONSTRUCTOR -> {
|
CallableKind.FUNCTION, CallableKind.SECONDARY_CONSTRUCTOR -> {
|
||||||
val body = when {
|
val body = when {
|
||||||
containingElement is KtClass && containingElement.isInterface() && !config.isExtension -> ""
|
containingElement is KtClass && containingElement.isInterface() && !config.isExtension -> ""
|
||||||
|
callableInfo.kind == CallableKind.SECONDARY_CONSTRUCTOR -> ""
|
||||||
else -> "{}"
|
else -> "{}"
|
||||||
}
|
}
|
||||||
@Suppress("USELESS_CAST") // KT-10755
|
@Suppress("USELESS_CAST") // KT-10755
|
||||||
|
|||||||
Vendored
+1
-3
@@ -3,9 +3,7 @@
|
|||||||
interface T
|
interface T
|
||||||
|
|
||||||
class A: T {
|
class A: T {
|
||||||
constructor(i: Int) {
|
constructor(i: Int)
|
||||||
//To change body of created constructors use File | Settings | File Templates.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
|
|||||||
+1
-3
@@ -1,9 +1,7 @@
|
|||||||
// "Create secondary constructor" "true"
|
// "Create secondary constructor" "true"
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
constructor(i: Int) {
|
constructor(i: Int)
|
||||||
//To change body of created constructors use File | Settings | File Templates.
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-3
@@ -1,9 +1,7 @@
|
|||||||
// "Create secondary constructor" "true"
|
// "Create secondary constructor" "true"
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
constructor(i: Int) {
|
constructor(i: Int)
|
||||||
//To change body of created constructors use File | Settings | File Templates.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
|
|||||||
Vendored
+1
-3
@@ -1,9 +1,7 @@
|
|||||||
// "Create secondary constructor" "true"
|
// "Create secondary constructor" "true"
|
||||||
|
|
||||||
open class A {
|
open class A {
|
||||||
constructor(i: Int) {
|
constructor(i: Int)
|
||||||
//To change body of created constructors use File | Settings | File Templates.
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-3
@@ -1,9 +1,7 @@
|
|||||||
// "Create secondary constructor" "true"
|
// "Create secondary constructor" "true"
|
||||||
// ERROR: Primary constructor call expected
|
// ERROR: Primary constructor call expected
|
||||||
class Creation(val f: Int) {
|
class Creation(val f: Int) {
|
||||||
constructor() {
|
constructor()
|
||||||
//To change body of created constructors use File | Settings | File Templates.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val v = Creation()
|
val v = Creation()
|
||||||
+1
-3
@@ -1,9 +1,7 @@
|
|||||||
// "Create secondary constructor" "true"
|
// "Create secondary constructor" "true"
|
||||||
|
|
||||||
open class A {
|
open class A {
|
||||||
constructor(i: Int) {
|
constructor(i: Int)
|
||||||
//To change body of created constructors use File | Settings | File Templates.
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-3
@@ -5,7 +5,5 @@ class A {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(i: Int) {
|
constructor(i: Int)
|
||||||
//To change body of created constructors use File | Settings | File Templates.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user