Lombok与Java 8有关 [英] Lombok issues with Java 8
问题描述
我刚刚升级到Intellij idea 14和Java 8,我也想到将我的项目升级到Java版本8,开始使用一些新功能。但是在正确配置Intellij以使用Java 8后,我仍然遇到了Lombok的问题。看起来Java 8和lombok之间存在冲突,因为现在我的 @Getter
和 @Setter
注释不再起作用了。
I just upgrade to Intellij idea 14 and Java 8 and I had on mind to upgrade my project to Java version 8 as well, to start using some new features. But After configure the Intellij properly to use Java 8 I have still the issue with Lombok. Looks like there´s a conflict between Java 8 and lombok because now my @Getter
and @Setter
annotations do not work anymore.
lombok的版本是1.10.8。有什么建议吗?
The version of lombok is 1.10.8. Any suggestions?
推荐答案
简答:
Lombok支持Java 8,自版本1.12.2以来已经这样做了。
Lombok supports Java 8, and has done so since version 1.12.2.
长答案
Lombok支持Java 8,并且自1.12.2版(2013年10月10日)起根据更改日志:
Lombok supports Java 8, and has done so since version 1.12.2 (October 10th, 2013) according to the changelog:
PLATFORM:初始JDK8支持,不影响对JDK6和7的现有支持。问题#451。虽然lombok现在可以在JDK8 / javac8和netbeans 7.4及更高版本上运行,但lombok还没有(还)支持java8引入的新语言功能,例如lambda表达式。将来版本中将添加对这些功能的支持。
PLATFORM: Initial JDK8 support, without affecting existing support for JDK6 and 7. Issue #451. While lombok will now work on JDK8 / javac8, and netbeans 7.4 and up, lombok does not (yet) support new language features introduced with java8, such as lambda expressions. Support for these features will be added in a future version.
此后,已实施进一步的Java 8支持:
Since then further Java 8 support has been implemented:
-
v1.12.6(2014年3月6日)
v1.12.6 (March 6th, 2014)
PLATFORM:在kepler中支持eclipse的alpha支持的初始JDK8。问题#597
PLATFORM: Initial JDK8 support for eclipse's alpha support in kepler. Issue #597
v1.14.0分支眼镜蛇(2014年5月27日)
v1.14.0 "Branching Cobra" (May 27th, 2014)
BUGFIX:使用带有-target 1.8的JDK8的javac的@SneakyThrows会导致编译后错误。问题#655
BUGFIX:主要工作是改善对JDK8的支持,包括javac和eclipse。
BUGFIX: Usage of @SneakyThrows with a javac from JDK8 with -target 1.8 would result in a post compiler error. Issue #655
BUGFIX: Major work on improving support for JDK8, both for javac and eclipse.
v1.14.6(2014年9月2日)
v1.14.6 (September 2nd, 2014)
BUGFIX:从JDK8版本1.8.0_20开始,val的使用将会中断。问题#731
BUGFIX: Usage of val would break starting with JDK8 release 1.8.0_20. Issue #731
换句话说,最新版本的龙目岛应该能够很好地使用Java 8,从版本1.12.2开始,没有新语言功能的Java 8代码应该可以工作。
In other words, the newest version of Lombok should be able to work with Java 8 fairly well, and since version 1.12.2, Java 8 code without the new language features should work.
编辑:正如 Roel 指出的那样,目前(2015年1月8日) 打开错误,指定一个特定的Lombok功能( val
)已停止工作1.14.8。
EDIT: As Roel pointed out, there is currently (8th january 2015) an open bug specifying that one specific Lombok feature (val
) stopped working for 1.14.8.
此错误已于2015年11月16日截止。
This bug was closed 16th November 2015.
这篇关于Lombok与Java 8有关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!