lishunli / projectlombok

Automatically exported from code.google.com/p/projectlombok
0 stars 0 forks source link

Make a delombok pretty mode #608

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Delombok currently generates code that's great to be processed by other 
tooling, but not so good for either migrating from lombok or rendering on a 
website.

Some issues are already logged to make this better, others can be added to this 
issue:
- Indentation by tabs or number of spaces (issue 604)
- Indentation of otherwise empty lines (issue 603)
- Suppress generation of @ConstructorProperties (issue 605)
- Suppress @SuppressWarnings("all") (issue 141)
- Suppress generation of delombok header comment
- Suppress "java.lang." for types in java.lang
- Have a more readable null-check in @Cleanup
- Suppress "final" for generated code except where obviously intended (val, 
@Value, ...)
- Use shorthand for exact import type matches

Original issue reported on code.google.com by r.spilker on 20 Nov 2013 at 1:09

GoogleCodeExporter commented 9 years ago
Other things to be fixed in the pretty printer, regardless of any switch:
- In try-with-resources in the list of resources, improve the rendering of 
multiple declarations, suppress "final" and the trailing semicolon.
- After case-statements, if it is followed by a block, render the opening brace 
on the same line
- Improve the rendering of labeled statements
- Don't render an empty line for the suppressed "super();" statement in 
constructors

Original comment by r.spilker on 20 Nov 2013 at 1:31

GoogleCodeExporter commented 9 years ago
Done so far (branch: pretty-delombok):

- Try-with-resources cleaned up.
- labelled statements cleanup
- super(); empty line suppression.
- infrastructure for conveying (via delombok commandline) and referencing 
format parameters.
- auto-detect and application of indent-or-blank empty lines behaviour.
- auto-detect and application of indent string (tabs, 4 spaces, etc) behaviour.

Original comment by reini...@gmail.com on 20 Nov 2013 at 7:28

GoogleCodeExporter commented 9 years ago
Tricky addition: Can we do some voodoo magic and truly copy-and-paste as many 
things that are in the original source file as possible? Presumably any node in 
the tree for which the rule holds nor it, nor any of its children (recursive) 
are generated or modified, can be copy-pasted straight from the source by using 
the start/end markers. I'm not sure how reliable the start/end markers are 
(they mostly aren't, IIRC, only lombok.ast offers start/end positions that are 
all-inclusive), so this might not be feasible, but would be a nice addition to 
have delombok's impact reduced to an absolute minimum.

Original comment by reini...@gmail.com on 21 Nov 2013 at 2:05

GoogleCodeExporter commented 9 years ago
Issue 605 has been merged into this issue.

Original comment by r.spilker on 11 Dec 2013 at 8:16

GoogleCodeExporter commented 9 years ago
Issue 604 has been merged into this issue.

Original comment by r.spilker on 11 Dec 2013 at 8:31

GoogleCodeExporter commented 9 years ago
Issue 603 has been merged into this issue.

Original comment by r.spilker on 11 Dec 2013 at 8:32

GoogleCodeExporter commented 9 years ago
Issue 141 has been merged into this issue.

Original comment by r.spilker on 11 Dec 2013 at 8:32

GoogleCodeExporter commented 9 years ago
... and it's live! At least in edge:

http://projectlombok.org/download-edge.html

give it a spin!

Original comment by reini...@gmail.com on 11 Dec 2013 at 9:47

GoogleCodeExporter commented 9 years ago
This fix is now part of the latest official release. 1.12.4 was just pushed for 
download and to maven central.

Original comment by reini...@gmail.com on 15 Jan 2014 at 9:27