官术网_书友最值得收藏!

Using the no-org plugin in Gradle

Add the plugin in the buildscript dependencies section in the Gradle file:

buildscript {
dependencies {
classpath "org.jetbrains.kotlin:kotlin-noarg:$kotlin_version"
}
}

apply plugin: "kotlin-noarg"

Alternatively, we can enable the no-arg plugin using Gradle as follows:

plugins {
id "org.jetbrains.kotlin.plugin.noarg" version "1.2.41"
}

We can then specify the list of annotations in the plugin section. The no-arg plugin generates the default constructor for the classes that are annotated with the annotations that we specified in the noArg annotation section of the plugin:

noArg {
annotation("org.rao.kotlin.javaee.MyClass")
}

If we want to execute the initialization of member variables from the default constructor, we can use the invokeInitializers plugin option:

noArg {
invokeInitializers = true
}
主站蜘蛛池模板: 屯留县| 遵义市| 溧水县| 玉屏| 稻城县| 明溪县| 同心县| 广灵县| 沛县| 阿鲁科尔沁旗| 邓州市| 遵义市| 景洪市| 宁陕县| 江达县| 陈巴尔虎旗| 曲阳县| 沙湾县| 平江县| 陕西省| 黄大仙区| 永顺县| 大同市| 沙湾县| 沙田区| 长阳| 枣阳市| 揭阳市| 盈江县| 平阴县| 沙田区| 汕头市| 玉田县| 新巴尔虎左旗| 古浪县| 格尔木市| 诸暨市| 文昌市| 古蔺县| 德昌县| 昭觉县|