Lombok项目是否支持Java 9? [英] Does Project Lombok support Java 9?
问题描述
我在项目中使用了Lombok,但我的同事不同意使用它,原因是(来自关于龙目岛文件的争议)
I have used Lombok in my project, but my colleague do not agree to use it, and his reason is (from controversy of lombok documents)
这两个Lombok项目都利用非公共API来完成其魔术.这意味着存在在后续的IDE或JDK版本中破坏Project Lombok的风险.
Both of these pieces of Project Lombok make use of non-public APIs to accomplish their sorcery. This means that there is a risk that Project Lombok will be broken with subsequent IDE or JDK releases.
但这是一个非常古老的文档,写于2010年,也许现在已经解决了这个问题,所以我想知道Lombok是否将支持Java 9,并且它是否仍使用非公开API:s?
But it's a very old document written in 2010, maybe now it has resolved the problem, so I want to know if Lombok will support Java 9 and does it still use the non-public API:s?
推荐答案
Lombok项目有一个问题跟踪Java 9支持.从2018年1月9日和版本1.16.20开始,Lombok正式支持Java9.来自更改日志:
The Lombok project has an issue tracking Java 9 support. As of January 9th 2018 and version 1.16.20, Lombok officially supports Java 9. From the changelog:
- PLATFORM:在新的IntelliJ,Netbeans和Gradle中更好地支持jdk9.
- BREAKING CHANGE:lombok配置键
lombok.addJavaxGeneratedAnnotation
现在默认为false
,而不是true. Oracle在JDK9发行版中打破了此注释,因此需要进行重大更改.- BREAKING更改:lombok配置键
lombok.anyConstructor.suppressConstructorProperties
现在已弃用,默认为true
,也就是说,默认情况下,lombok不再自动生成@ConstructorProperties
注释.现在,新的配置键lombok.anyConstructor.addConstructorProperties
存在;如果您想要旧的行为,请将其设置为true
. Oracle在JDK9发行版中或多或少地破坏了此注释,因此有必要进行重大更改.- 开发:现在可以在JDK1.9上编译lombok.
- PLATFORM: Better support for jdk9 in the new IntelliJ, Netbeans and for Gradle.
- BREAKING CHANGE: lombok config key
lombok.addJavaxGeneratedAnnotation
now defaults tofalse
instead of true. Oracle broke this annotation with the release of JDK9, necessitating this breaking change.- BREAKING CHANGE: lombok config key
lombok.anyConstructor.suppressConstructorProperties
is now deprecated and defaults totrue
, that is, by default lombok no longer automatically generates@ConstructorProperties
annotations. New config keylombok.anyConstructor.addConstructorProperties
now exists; set it totrue
if you want the old behavior. Oracle more or less broke this annotation with the release of JDK9, necessitating this breaking change.- DEVELOPMENT: Compiling lombok on JDK1.9 is now possible.
(目前,它还没有模块,因此您需要将其放在类路径上.谢谢 Tos的回答,它首先提到了这一点.)
(At the moment, it is no module, though, so you need to place it on the class path. Thanks Tos' answer, which first mentioned this.)
这篇关于Lombok项目是否支持Java 9?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!