lombok.ast
lombok.ast copied to clipboard
Is there any documentation about lombok.ast?
I'm new to lombok.ast and recently I want to do some code analysis work and need to use lombok.ast. But seems that there isn't any documentation about it. Would you offer some clues?
Yeah, I know. It was an ambitious project that got sidetracked. It's not quite finished. The tests are by far the best place to start reading, if you want to know how to use it. The current major hangups are:
-
We have concluded that we need a redesign of how the internals work. Our current setup is that we wish to have the capability of translating for example the JCTree AST to lombok.ast's internal representation, and then if you translate that representation back to JCTree AST, that is it perfectly the same. Every flag, every position, not even off by 1. We got stuck for MONTHS making it work this reliably and it is just not the right model. We need to move it all over to an interface-based, or at least a 'container/wrapper' based, system which will make the perfect translation idea happen simply by not translating most of it. Whatever didn't change just gets the 'old' node back verbatim. This should be much faster and means we don't have to sweat every little nook and cranny of JCTree AST to make sure we never, ever, ever screw up a position or a flag ever.
-
lombok.ast is based on an alpha release of parboiled, and parboiled as a project has since moved on. We need to do a lot of work, probably start from mostly scratch, to get our AST parser updated. We actually started on this and were about 4 complete days in when we released we were completely on the wrong track. That isn't helping efforts.
-
We should actually integrate what we have into lombok already: Instead of having 2 handlers for everything (one for eclipse, one for javac), I already have a proof of concept template system where you create some actual java code in a string or file with certain placeholders, then you load it in, and then you make calls to replace the placeholders with whatever is appropriate. This way, a single handler can do both the eclipse and the javac case, and it would be more feasible to try and make intellij support track the master branch of lombok closer and with less hassle once we undertake the major project of writing code that can translate lombok.ast ASTs to the AST library that jetbrains wrote, which is used by intellij. This is one of those things that is hard to find time for: It's a major change that will probably introduce bugs and doesn't result in any new features. It's really cool that we get invited to do presentations of lombok at for example Devoxx, but we feel obligated to come up with exciting new features every time, and as a result there's never quite the right timeslot to do this. Also, I start thinking that perhaps we should first tackle problems 1 and 2 on this list before moving on to this point, and then it just becomes easier to decide to work on other stuff.
-
Having said all that, as a product it is pretty much rock solid, we just have completely ridiculous requirements. We have a very large number of tests, parboiled's alpha status was a matter of API stability, not of product stability, and other than some positions which are very slightly off in extremely rare circumstances, even the translation aspects work very well, if you need them. The speed of the parser is also commendable. The only area where the product as it stands could use some work as an end product, is that error reporting could be better (this is one of the major aspects underlying the pretty big API changes to parboiled between what we use and the 1.0 version of parboiled, and requires quite some rewrites to get the benefit of the significantly improved error reporting).
--Reinier Zwitserloot
On 21 February 2014 08:18, liakong [email protected] wrote:
I'm new to lombok.ast and recently I want to do some code analysis work and need to use lombok.ast. But seems that there isn't any documentation about it. Would you offer some clues?
— Reply to this email directly or view it on GitHubhttps://github.com/rzwitserloot/lombok.ast/issues/7 .