- Kotlin for Enterprise Applications using Java EE
- Raghavendra Rao K
- 200字
- 2021-06-10 18:49:29
The all-open compiler plugin
When we define a class or declare a data member, it is final by default in Kotlin. We declare classes as final to make them non-extendable. Similarly, we make functions final so that they can't be overridden. Fields are declared as final to prevent the value from changing once it is initialized.
The Aspect-Oriented Programming (AOP) library and the Reflection API require classes to be non-final. These frameworks create proxy objects, so the classes and member variables have to be open and accessible.
The all-open compiler plugin makes sure Kotlin complies with the requirements of these libraries and frameworks when dealing with proxy objects. It makes classes and member variables that have specific annotations accessible to create proxy objects without explicitly specifying the open keyword in the code.
Let's take a look at an example of how we can use an all-open compiler plugin. When we are dealing with the CDI framework, we need classes that are annotated with specific annotations, such as @Inject or @Dependent, to make them open and accessible. Let's look at the all-open plugin support for both Maven and Gradle.
- Kali Linux Web Penetration Testing Cookbook
- 零基礎PHP學習筆記
- 神經網絡編程實戰:Java語言實現(原書第2版)
- AngularJS深度剖析與最佳實踐
- Learning Three.js:The JavaScript 3D Library for WebGL
- Elasticsearch Server(Third Edition)
- C語言程序設計習題與實驗指導
- Unity Character Animation with Mecanim
- Kotlin Programming By Example
- 大數據時代的企業升級之道(全3冊)
- Python+Office:輕松實現Python辦公自動化
- INSTANT Premium Drupal Themes
- Java Script從入門到精通(第5版)
- 算法學習與應用從入門到精通
- Mastering High Performance with Kotlin