简体   繁体   English

Lombok与Java 8有关

[英]Lombok issues with Java 8

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. 我刚刚升级到Intellij构思14和Java 8,我也想到将我的项目升级到Java版本8,开始使用一些新功能。 But After configure the Intellij properly to use Java 8 I have still the issue with Lombok. 但是在正确配置Intellij以使用Java 8后,我仍然遇到了Lombok的问题。 Looks like there´sa conflict between Java 8 and lombok because now my @Getter and @Setter annotations do not work anymore. 看起来Java 8和@Getter之间存在冲突,因为现在我的@Getter@Setter注释不再起作用了。

The version of lombok is 1.10.8. lombok的版本是1.10.8。 Any suggestions? 有什么建议么?

Short answer: 简短回答:

Lombok supports Java 8, and has done so since version 1.12.2. Lombok支持Java 8,自版本1.12.2起就支持了Java 8。


Long answer 答案很长

Lombok supports Java 8, and has done so since version 1.12.2 (October 10th, 2013) according to the changelog : Lombok支持Java 8,并且自版本1。12。2(2013年10月10日)起根据更改日志进行了支持

PLATFORM: Initial JDK8 support, without affecting existing support for JDK6 and 7. Issue #451. 平台:初始JDK8支持,不影响对JDK6和7的现有支持。问题#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. 虽然lombok现在可以在JDK8 / javac8和netbeans 7.4及更高版本上运行,但lombok还没有(还)支持java8引入的新语言功能,例如lambda表达式。 Support for these features will be added in a future version. 将来的版本中将添加对这些功能的支持。

Since then further Java 8 support has been implemented: 从那时起,已经实现了进一步的Java 8支持:

  • v1.12.6 (March 6th, 2014) v1.12.6(2014年3月6日)

    PLATFORM: Initial JDK8 support for eclipse's alpha support in kepler. PLATFORM:对 kepler中eclipse的alpha支持的初始JDK8支持。 Issue #597 问题#597

  • v1.14.0 "Branching Cobra" (May 27th, 2014) v1.14.0“分支眼镜蛇”(2014年5月27日)

    BUGFIX: Usage of @SneakyThrows with a javac from JDK8 with -target 1.8 would result in a post compiler error. BUGFIX:使用带有-target 1.8的JDK8的javac的@SneakyThrows会导致编译后错误。 Issue #655 问题#655
    BUGFIX: Major work on improving support for JDK8, both for javac and eclipse. BUGFIX:主要致力于改进对JDK8的支持,包括javac和eclipse。

  • v1.14.6 (September 2nd, 2014) v1.14.6(2014年9月2日)

    BUGFIX: Usage of val would break starting with JDK8 release 1.8.0_20. BUGFIX:从JDK8版本1.8.0_20开始,val的使用将会中断。 Issue #731 问题#731

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. 换句话说,最新版本的Lombok应该能够很好地使用Java 8,而从版本1.12.2开始,没有新语言功能的Java 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. 编辑 :正如Roel所指出的,目前(2015年1月8日)有一个开放的错误 ,指出一个特定的Lombok功能( val )停止工作1.14.8。

This bug was closed 16th November 2015. 此错误已于2015年11月16日关闭。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM