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

No-arg compiler plugin

Constructors are used to initialize the states of an object. Sometimes, however, we need to have default constructors that take no arguments. The no-arg compiler plugin is used to generate no-arg constructors (the default constructors) for classes that are annotated with a particular annotation. When we have a no-arg compiler plugin enabled, a no-arg constructor is added during compile-time. The generated default constructor can only be invoked by the reflection APIs and are not accessible directly from the Kotlin code. The no-arg compiler plugin enables the CDI or the JPA to instantiate the classes, though it doesn't have any default constructors defined in the code. 

In Java, a default constructor will always be added to the compiled code by the compiler and no additional plugin is required to do this. In Kotlin, however, when we have the  no-arg compiler plugin enabled , a default constructor will be added to the compiled code.
主站蜘蛛池模板: 牟定县| 琼中| 丹江口市| 抚远县| 东乡族自治县| 泸定县| 汤原县| 华阴市| 当阳市| 靖边县| 平度市| 灌阳县| 巩留县| 周口市| 新干县| 汾阳市| 镇康县| 汉川市| 栾川县| 太谷县| 红原县| 舞钢市| 资中县| 历史| 泊头市| 安平县| 泗水县| 济源市| 汉沽区| 江陵县| 秦安县| 南充市| 黄平县| 襄垣县| 尼勒克县| 德江县| 施甸县| 印江| 兴和县| 浮梁县| 当阳市|