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

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
}
主站蜘蛛池模板: 东莞市| 湟中县| 三穗县| 兴和县| 乌拉特前旗| 石楼县| 清徐县| 翼城县| 浮山县| 博白县| 汕头市| 富锦市| 太保市| 沙田区| 延边| 荥阳市| 巴楚县| 双鸭山市| 临西县| 大埔县| 浙江省| 平乐县| 永平县| 灵寿县| 金门县| 津南区| 濮阳市| 汉阴县| 冕宁县| 东丰县| 筠连县| 南投县| 威海市| 绥江县| 清水县| 徐汇区| 大石桥市| 高州市| 重庆市| 普格县| 岳阳县|