Closed sergey-morenets closed 3 weeks ago
Please report it to the Lombok project. There is nothing we can do here.
@dstepanov Why do you think that it's Lombok issue? We have multiple Spring Boot projects with Java 22/Lombok and they compile and run without any issues. Lombok perfectly supports Java 22. So it's clearly Micronaut Data problem that it doesn't support Java 22. Please, mention that fact as limitation in the documentation.
You wrote that it works without Lombok, so why would it be a Micronaut limitation?
Lombok has to modify the Java compiler's private and internal models. It does not seem to be able to do this properly for Java 22, which breaks the annotation processors.
Please, read carefully my comments below. Lombok 1.18.32 is fully compatible with Java 22 and is able to generate getters and setters if you put @Getter/@Setter annotation on POJO classes. I checked that again today. But due to unknown reason Micronaut Data raises an error in such case (Lombok + Java 22). You can't just ignore this error because it would happen for any Micronaut project that will migrate from Java 21 to Java 22. So if you don't want to investigate this error, please add this fact as limitation in the documentation.
Please understand how Lombok works. It uses Javac's private/internal API to alter the internal model, add more methods, etc. For some unknown reason, those changes are not visible using the public annotation processor API. Just because the methods are generated doesn't mean it works correctly.
There is nothing that can be done to support it or fix it on our side. The BUG is on the Lombok side, please report it there.
Expected Behavior
Micronaut project should support Java 22.
Actual Behaviour
Hi
We changed our project JDK from 21 to 22 in JAVA_HOME. After that our Micronaut project fails to compile with error:
Unable to implement Repository method: PaymentProviderRepository.findById(Object id). Cannot query entity [PaymentProvider] on non-existent property: Id.
If we downgrade JDK from 22 to 21 then compilation succeeds. We use Lombok 1.18.32 (latest version) in our project. If we remove @Getter/@Setter annotations on BaseEntity and create getters/setters explicitly then compilation succeeds with JDK 22.
Steps To Reproduce
Here's our code and configuration:
Environment Information
JDK version: 22.0.1
Example Application
No response
Version
4.4.3