How did Lombok access jdk.compiler

275 views
Skip to first unread message

denny yao

unread,
Jul 9, 2024, 3:34:32 PM7/9/24
to Project Lombok
I have created a feature similar to Lombok based on the JSR-269 specification, which inserts new method declarations into the interface through specified annotations. It works fine in jdk1.8, but after upgrading to jdk17, an error message "module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module xxx" appears during compilation. Based on the solution found online, I added the --add-exports parameter during compilation, but the problem still persists. I have noticed that lower versions of Lombok (such as 1.18.14) also have the same issue in jdk17. But it was resolved in a higher version (such as 1.18.20). I have checked the latest Lombok source code, but I do not understand which part solved the problem. I hope someone can help me clarify this. Thanks

Mat Jaggard

unread,
Jul 10, 2024, 2:00:42 AM7/10/24
to project-lombok
The main implementation of opening modules was done here, although there have been fixes after that. 


On Tue, 9 Jul 2024, 20:34 denny yao, <yaod...@gmail.com> wrote:
I have created a feature similar to Lombok based on the JSR-269 specification, which inserts new method declarations into the interface through specified annotations. It works fine in jdk1.8, but after upgrading to jdk17, an error message "module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module xxx" appears during compilation. Based on the solution found online, I added the --add-exports parameter during compilation, but the problem still persists. I have noticed that lower versions of Lombok (such as 1.18.14) also have the same issue in jdk17. But it was resolved in a higher version (such as 1.18.20). I have checked the latest Lombok source code, but I do not understand which part solved the problem. I hope someone can help me clarify this. Thanks

--
You received this message because you are subscribed to the Google Groups "Project Lombok" group.
To unsubscribe from this group and stop receiving emails from it, send an email to project-lombo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/project-lombok/10a2b668-681c-48d1-bd0a-5b4f5a171442n%40googlegroups.com.

张弘之

unread,
Jul 28, 2024, 10:56:14 AM7/28/24
to Project Lombok

Thanks for the reply. I read the main implementations of the open module. However I have a small question what is the role of the Parent class. As shown below what is the function of this line of code
```
long firstFieldOffset = getFirstFieldOffset(unsafe);
unsafe.putBooleanVolatile(m, firstFieldOffset, true);
```

张弘之

unread,
Jul 29, 2024, 6:10:13 PM7/29/24
to Project Lombok
I am experiencing the same problem. I refer to the lombok implementation to load jdk.compile in JDK21. However, the same error still occurs. I would like to know is there any other configuration required apart from this implementation.
Reply all
Reply to author
Forward
0 new messages