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

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
}
主站蜘蛛池模板: 沁源县| 美姑县| 华安县| 包头市| 柞水县| 清水河县| 哈尔滨市| 佛教| 彭山县| 利辛县| 宁城县| 水城县| 裕民县| 清新县| 绥滨县| 刚察县| 资阳市| 乡城县| 金沙县| 阆中市| 垣曲县| 铜川市| 诸暨市| 桐城市| 泰州市| 商都县| 佳木斯市| 甘南县| 合作市| 西吉县| 乳源| 云南省| 治县。| 应城市| 宝丰县| 札达县| 依兰县| 城步| 宜丰县| 庆阳市| 慈利县|