Why IntelliJ needs Lombok plugin?

断了今生、忘了曾经 提交于 2019-12-01 06:54:39

IntelliJ's code analysis engine does not use javac or run annotation processors. Instead, IntelliJ uses its own Java parser and reference resolution logic, and builds its own code model. The Lombok plugin extends the code model to provide information about declarations generated by the Lombok annotation processor.

It's because IDEA syntax highlighter uses internal Java parser. If IDEA used just javac, then it wouldn't be able to highlight syntax errors as you type. It also gives much better hints about wrong code, so each Java construct, feature or annotation must be implemented by JetBrains team or there's plugin for it like in this case.

Annotation processing option is just for building project which is done via javac, but it's not for syntax highlighting.

Ale IDEs use lombok plugin be it intelij-idea or eclipse. javac works fine with it - but remember that it works when for example you build you project with mvn clean package. Then when you have your IDE - it works differntly - the code is not processed like in build task.

The plugin make it know to IDE what is this annotation and what code it generates underhood without need of javac.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!