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

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.
主站蜘蛛池模板: 营山县| 临泽县| 藁城市| 梅州市| 若尔盖县| 南江县| 青岛市| 长丰县| 石景山区| 滨海县| 安新县| 米易县| 牡丹江市| 华阴市| 启东市| 中卫市| 东兰县| 东宁县| 岳阳县| 安新县| 进贤县| 根河市| 嘉荫县| 微山县| 垫江县| 吉木萨尔县| 韩城市| 道真| 永丰县| 扎囊县| 五家渠市| 青河县| 洪泽县| 明光市| 金溪县| 闵行区| 旌德县| 大洼县| 睢宁县| 都安| 清涧县|