- 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.
- INSTANT Mock Testing with PowerMock
- Python量化投資指南:基礎、數據與實戰(zhàn)
- Java游戲服務器架構實戰(zhàn)
- Python自然語言處理(微課版)
- Nginx Essentials
- Python完全自學教程
- MongoDB權威指南(第3版)
- 全棧自動化測試實戰(zhàn):基于TestNG、HttpClient、Selenium和Appium
- Python+Tableau數據可視化之美
- Hands-On Nuxt.js Web Development
- Distributed Computing in Java 9
- 從零開始構建深度前饋神經網絡:Python+TensorFlow 2.x
- Learning ECMAScript 6
- WCF全面解析
- 網絡綜合布線與組網實戰(zhàn)指南