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

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.
主站蜘蛛池模板: 临清市| 临泉县| 东安县| 瑞金市| 都江堰市| 文水县| 新余市| 杭州市| 焦作市| 涪陵区| 额敏县| 甘肃省| 印江| 于都县| 南溪县| 馆陶县| 长子县| 元氏县| 左云县| 丽水市| 宿州市| 图们市| 玛沁县| 体育| 温泉县| 大同市| 轮台县| 阜平县| 同仁县| 武定县| 炎陵县| 太白县| 清镇市| 永顺县| 安庆市| 北票市| 潞西市| 大埔区| 泰和县| 镇原县| 彰武县|