phax / jcodemodel

A heavily extended fork of the com.sun.codemodel (from 2013/09)
Other
93 stars 34 forks source link

Add convenience method JBlock#block(boolean, boolean) #29

Closed WonderCsabo closed 8 years ago

WonderCsabo commented 8 years ago

In #26, the behavior of JBlock#block() method changed in a breaking-way: now a new block is added with braces and indent. The previous behavior was adding a block with no indent and no braces.

In AndroidAnnotations, we are using the old behavior extensively: we create no-indent no-braces blocks as placeholders, so we can easily insert code in the desired order later. To achieve this now, we have to create the blocks in the following way:

JBlock block = body.block().bracesRequired(false).indentRequired(false);

It would be nice if the API would provide a much shorter convenience method, for example:

JBlock block = body.block(false, false);

Or maybe this, too:

JBlock block = body.blockWithoutBraces(); // with a better method name :)
phax commented 8 years ago

OK thanks. I added block(boolean,boolean) and blockSimple as block(false,false). Should do the trick.

WonderCsabo commented 8 years ago

No need for thanks, actually i thank you for the super-fast fix! :)