简体   繁体   English

一次为不同的环境实现Lombok扩展(javac,Eclipse,IntelliJ IDEA等)

[英]Implementing Lombok extensions for different environments once (javac, Eclipse, IntelliJ IDEA, etc)

Recently I discovered Project Lombok that really looks very nice. 最近我发现了龙目岛项目真的很漂亮。 I'd even say that it really covers a lot of boilerplates at compile time while I still write a sort of workarounds that help in runtime. 我甚至会说它在编译时真的涵盖了很多样板,而我仍然编写了一些有助于运行时的变通方法。 I can't integrate Lombok to my current project because of lack of support in IntelliJ IDEA even for the basic support w/o Lombok extensions at all. 我无法将Lombok集成到我当前的项目中,因为IntelliJ IDEA缺乏支持,即使对于没有Lombok扩展的基本支持也是如此。 I also discovered a nice and useful Lombok extension called lombok-pg , that features really cool stuff like yield() (no more consumer-producer threads). 我还发现了一个名为lombok-pg的非常有用的Lombok扩展,它具有非常酷的东西,比如yield() (没有更多的消费者生产者线程)。 Having a little look at lombok-pg source code I noticed that it's written both for javac and Eclipse. 稍微了解一下lombok-pg源代码,我注意到它是为javac和Eclipse编写的。 Both implementations seem to look very similar, but as far as I understand Lombok extension implementation activity, let's say, IntelliJ IDEA support would require another, the third, implementation of the same thing, and it doesn't sound pretty encouraging. 这两个实现看起来看起来非常相似,但据我所知,Lombok扩展实现活动,让我们说,IntelliJ IDEA支持需要另一个,第三个实现相同的东西,这听起来不太令人鼓舞。

I'm just curious: is there any kind of a framework that provides some general interface to manage AST with implementations for different environments? 我只是好奇:有没有任何一种框架提供一些通用接口来管理AST与不同环境的实现?

I'm just curious: is there any kind of a framework that provides some general interface to manage AST with implementations for different environments? 我只是好奇:有没有任何一种框架提供一些通用接口来管理AST与不同环境的实现?

There ist the Lombok AST project trying to achieve exactly this. 龙目岛AST项目试图实现这一点。 However, this all is tricky and I don't know the exact status (I only know it's not dead, last commit two weeks ago). 然而,这一切都很棘手,我不知道确切的状态(我只知道它没有死,两周前最后一次提交)。 Besides the AST manipulation, there's some compiler specific hacking to be done, especially in Eclipse, which makes it all pretty complicated. 除了AST操作之外,还有一些编译器特定的黑客攻击要做,特别是在Eclipse中,这使得它非常复杂。

Basically, Lombok runs in Intellij IDEA via a plugin . 基本上,Lombok通过插件在Intellij IDEA中运行。 As the Lombok authors themselves don't use Intellij, the development has a lower priority AFAICT. 由于龙目岛作者本身不使用Intellij,因此开发的优先级较低的AFAICT。

Lombok-pg is cool, but no longer maintained. Lombok-pg很酷,但不再维护。 Porting it into Lombok is not trivial . 将它移植到龙目岛并非易事

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

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