如何龙目岛的工作? [英] How does lombok work?

查看:174
本文介绍了如何龙目岛的工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今天龙目岛的满​​足。结果
我非常急于想知道它是如何工作。结果
一个Java野人文章,给出了一些线索,但它不是非常清楚对我说:

I met lombok today.
I'm very anxious to know how it works.
A Java Geek Article gives some clues but it's not perfectly clear to me:

Java 6中删除apt和作出的javac能
  管理注释,简化
  该过程以得到一个更简单
  单步计算。这是在
  采取的龙目岛的路径。

Java 6 removes apt and make javac able to manage annotations, streamlining the process to obtain a simpler single step computing. This is the path taken by Lombok.

也许与Java 6的编译过程将是:
javac的 - >易 - >龙目岛贴切过程 - >阅读类文件,使用 ASM添加的set / get方法?

Maybe with Java 6 the compile process will be: javac -> apt -> lombok apt process -> read class files and add set/get methods using ASM?

您能告诉我有关该机制的更多详细信息?

Could you show me more details about the mechanism?

推荐答案

龙目也对内部API的确code,肖恩帕特里克·弗洛伊德说。然而,由于龙目岛的只有的参与编译阶段,主张其误导龙目只能在一个阳光VM上运行。它只会在编译或欧洲法院太阳的javac。然而,绝大多数的虚拟机在那里,如果他们出货编译器的一切,都是这两个中的一个。例如,苹果的VM附带股票太阳javac的,因此龙目岛的作品在Mac上就好了。这同样适用于soylatte VM,例如。

Lombok does indeed code against internal API, as Sean Patrick Floyd said. However, as lombok is ONLY involved in the compilation phase, its misleading to claim Lombok will only run on a sun VM. It'll only compile on ecj or sun's javac. However, the vast majority of VMs out there, if they ship a compiler at all, are one of those two. For example, the Apple VM ships with stock sun javac, and as such lombok works just fine on macs. Same goes for the soylatte VM, for example.

虽然javac的,我们真的要坚持自己的更新,现在部分原因是大量的他们的编译器正在进行的工作,我们已经有过日食很多很多的版本,以仅1小的调整对我们的支持日食。所以,当我们做对内部API code,它们是相对稳定的位。

While for javac we really do have to stick with their updates, partly because of a lot of ongoing work on their compiler right now, we've had to make just 1 minor adjustment to our eclipse support over many many versions of eclipse. So, while we do code against internal API, they are relatively stable bits.

如果有什么不龙目可以在不诉诸内部API来完成,我们就做了别的东西,但它不能做的,所以我们采取内部API的使用。

If what lombok does could be done without resorting to internal API, we'd have done something else, but it can't be done, so we resort to internal API usage.

注:我的龙目岛的铅开发商之一,所以,我可能有点偏颇:P

NB: I'm one of the lead developers of lombok, so, I'm probably a little biased :P

这篇关于如何龙目岛的工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆