Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Project Lombok support Java 9?

Tags:

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)

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.

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?

like image 742
zhuguowei Avatar asked Jan 07 '17 10:01

zhuguowei


People also ask

Can we use Lombok in Java 8?

Short answer: Lombok supports Java 8, and has done so since version 1.12. 2. Lombok supports Java 8, and has done so since version 1.12.

Does Lombok work with Java 11?

Latest version of Lombok and/or IntelliJ plugin perfectly supports Java 11.

Does Lombok work with Java 6?

Pretty sure Lombok supports JDK 6+, so there is no reason for you to change version.

What is the latest version of Lombok?

v1. 18.22 (October 6th, 2021)


2 Answers

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: Better support for jdk9 in the new IntelliJ, Netbeans and for Gradle.
  • BREAKING CHANGE: lombok config key lombok.addJavaxGeneratedAnnotation now defaults to false 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 to true, that is, by default lombok no longer automatically generates @ConstructorProperties annotations. New config key lombok.anyConstructor.addConstructorProperties now exists; set it to true 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.

(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.)

like image 148
Nicolai Parlog Avatar answered Oct 12 '22 00:10

Nicolai Parlog


The current status of lombok for Java 9 is tracked here: https://github.com/rzwitserloot/lombok/issues/985

As of right now this bug is still open and (apparently) actively being worked on. There is an edge release out there that solves most of the issues so at this point it looks like all you need to do is wait..

like image 22
Randakar Avatar answered Oct 12 '22 00:10

Randakar