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

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
}
主站蜘蛛池模板: 无棣县| 彭泽县| 昆山市| 清远市| 合川市| 凤翔县| 新平| 铁力市| 大田县| 鄢陵县| 玛纳斯县| 旅游| 沙湾县| 滕州市| 伊金霍洛旗| 乐昌市| 任丘市| 南和县| 印江| 申扎县| 泸州市| 衡山县| 定结县| 手机| 正镶白旗| 松原市| 大姚县| 齐齐哈尔市| 罗甸县| 石阡县| 洪湖市| 西盟| 天祝| 独山县| 招远市| 凉城县| 屏东市| 迁西县| 西峡县| 兴宁市| 深州市|